/* Шрифт интерфейса — Onest (SIL OFL 1.1, fonts/OFL-Onest.txt). Лежит в самой панели:
   у клиентов она бывает без выхода в интернет. Вариативный, начертания 400–700. */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/onest-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/onest-latin.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; }
/* Sentinel — тёмная NOC-тема (control room). Все классы совместимы со старой вёрсткой. */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg:      #0a0d12;   /* фон страницы */
  --bg-soft: #161d27;   /* трек метрик, вложенные плашки */
  --card:    #0e131b;   /* карточки/панели */
  --card-2:  #141b25;   /* hover / приподнятые */
  --line:    #1b232f;   /* границы (hairline) */
  --ink:     #d7dee8;   /* основной текст */
  --muted:   #8e99ad;   /* приглушённый (осветлён для читаемости) */
  --faint:   #6c778d;   /* совсем тихий (осветлён для читаемости) */

  --blue:   #5b93e0; --blue-d: #4880cc;
  --green:  #54c98a; --yellow: #e0b053; --red: #e06a72; --gray: #7a889f;
  --cyan:   #57d9c5; --violet: #a78bfa;

  --mono: ui-monospace, Consolas, monospace; /* @kind font */
  --radius: 4px; --radius-sm: 3px;
  --shadow: 0 2px 10px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--cyan); text-decoration: none; }
::selection { background: rgba(76,141,255,.35); }

/* тонкие скроллбары */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3550; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #384668; }

/* --- навигация --- */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
/* Бар — на всю ширину, а его содержимое центрировано в те же 1240px, что и
   контент страницы. Без этого пункты жались к левому краю, а контент был по
   центру — рассинхрон, который сразу бросается в глаза. */
.nav-inner {
  max-width: 1240px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; gap: 2px;
  padding: 0 22px; height: 58px;
}
.nav-links { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.nav-burger {
  display: none; background: transparent; border: 0; color: var(--ink);
  font-size: 22px; cursor: pointer; margin-left: auto; padding: 4px 8px; line-height: 1;
}
nav .brand {
  font-size: 18px; font-weight: 700; margin-right: 26px; letter-spacing: .3px;
  display: inline-flex; align-items: center; line-height: 1;
  background: none; color: var(--ink);
}
nav .brand span { -webkit-text-fill-color: initial; color: var(--cyan); }
nav a.nav-link {
  color: var(--muted); padding: 8px 12px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; display: inline-flex; align-items: center; line-height: 1;
  border-radius: var(--radius-sm); position: relative; transition: color .15s;
}
nav a.nav-link:hover { color: var(--ink); }
nav a.nav-link.active { color: var(--ink); }
nav a.nav-link.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; background: var(--cyan);
}
/* --- выпадающие группы в навигации ---
   Пунктов стало столько, что строка переносилась. Родственные собраны в группы:
   заголовок группы подсвечивается, если открыт любой её раздел. Меню на :hover,
   без JS — но с «мостиком» из padding-top, иначе курсор проваливается в зазор
   между заголовком и меню, и оно закрывается по дороге. */
nav .navgroup { position: relative; }
nav .navgroup > .nav-link { cursor: default; display: inline-flex; flex-direction: row; align-items: center; gap: 5px; line-height: 1.05; padding: 8px 12px; text-transform: uppercase; letter-spacing: .6px; font-size: 12px; font-weight: 700; }
nav .navgroup > .nav-link::before { content: ""; }
/* шеврон рядом с подписью (горизонтально), поворачивается при раскрытии; выпадашка едет вниз */
nav .navgroup > .nav-link .caret {
  font-size: 0; margin: 0; opacity: .45; display: inline-block; flex: none;
  width: 6px; height: 6px; box-sizing: border-box;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .18s ease, opacity .18s ease;
}
nav .navgroup:hover > .nav-link .caret, nav .navgroup:focus-within > .nav-link .caret {
  transform: translateY(0) rotate(-135deg); opacity: .85;
}
nav .navgroup .dropdown {
  display: none; position: absolute; top: 100%; left: 0; padding-top: 6px; min-width: 210px;
}
nav .navgroup:hover .dropdown, nav .navgroup:focus-within .dropdown { display: block; }
nav .navgroup .dropdown-inner {
  background: #11182b; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0,0,0,.45); padding: 6px; display: flex; flex-direction: column;
}
nav .navgroup .dropdown a {
  color: var(--muted); padding: 8px 12px; font-size: 13.5px; border-radius: var(--radius-sm);
  white-space: nowrap; transition: all .12s;
}
nav .navgroup .dropdown a:hover { color: var(--ink); background: rgba(255,255,255,.06); }
nav .navgroup .dropdown a.active { color: #fff; background: rgba(76,141,255,.16); }
nav .navgroup .dropdown .sep { height: 1px; background: var(--line); margin: 5px 4px; }
nav .navgroup .dropdown .who {
  color: var(--muted); font-size: 11px; padding: 4px 12px 6px; letter-spacing: .3px;
}
/* меню пользователя — по центру под блоком имени (а не уезжает влево) */
nav .navgroup.right .dropdown { left: 50%; right: auto; transform: translateX(-50%) translateY(-6px); }
nav .navgroup.right:hover .dropdown, nav .navgroup.right:focus-within .dropdown { transform: translateX(-50%); }

nav .spacer { flex: 1; }
nav .badge-alerts {
  background: transparent; color: var(--red); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 11px; padding: 3px 9px; margin-left: 6px;
  font-weight: 700; font-family: var(--mono); letter-spacing: .3px;
}
nav .nav-user {
  display: inline-flex; align-items: center; gap: 9px; margin-left: 16px;
  padding-left: 16px; border-left: 1px solid var(--line);
}
nav .nav-user-av {
  width: 30px; height: 30px; border-radius: var(--radius-sm); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--cyan); letter-spacing: .5px;
}
nav .nav-user-meta { display: flex; flex-direction: column; line-height: 1.2; }
nav .nav-user-meta .nu-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
nav .nav-user-meta .nu-role { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); }

main { max-width: 1240px; margin: 0 auto; padding: 26px; }
h1 { font-size: 20px; font-weight: 700; margin-bottom: 20px; letter-spacing: -.2px; }
h2 { font-size: 11px; font-weight: 600; margin: 26px 0 14px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); }

/* --- карточки --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  background: var(--card);
  padding: 18px 20px; border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card:hover { border-color: #33405f; }
.card.ok   { border-color: rgba(52,211,153,.28); }
.card.warn { border-color: rgba(246,183,60,.32); }
.card.crit { border-color: var(--line); box-shadow: inset 3px 0 0 var(--red); }
.card.offline { border-color: var(--line); opacity: .72; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; letter-spacing: .1px; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--cyan); }
.card .sub { color: var(--muted); font-size: 11.5px; margin-bottom: 16px; font-variant-numeric: tabular-nums; }

/* --- индикаторы (метрики) --- */
.meter { margin: 13px 0; }
.meter .free { font-size: 11.5px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.meter .free b { color: var(--ink); font-weight: 600; }
.meter .lbl { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.meter .lbl span:first-child { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.meter .lbl span:last-child { color: var(--ink); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.meter .bar { height: 5px; background: var(--bg-soft); border-radius: 2px; overflow: hidden; }
.meter .bar i {
  display: block; height: 100%; border-radius: 2px;
  background: var(--blue);
  transition: width .5s ease;
}
.meter .bar i.warn { background: var(--yellow); }
.meter .bar i.crit { background: var(--red); }

/* --- статус-пилюли с точкой --- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; font-size: 11px; font-weight: 600; letter-spacing: .2px;
  border-radius: var(--radius-sm); border: 1px solid transparent; line-height: 1.4;
  text-transform: none; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; flex: none; }
.chip.critical { color: #ff8a94; background: rgba(255,93,108,.13); border-color: rgba(255,93,108,.3); }
.chip.warning  { color: #ffcb6b; background: rgba(246,183,60,.13); border-color: rgba(246,183,60,.3); }
.chip.info     { color: #8fbcff; background: rgba(76,141,255,.14); border-color: rgba(76,141,255,.32); }
.chip.ok       { color: #5ce2ad; background: rgba(52,211,153,.13); border-color: rgba(52,211,153,.3); }
.chip.off      { color: #9aa7bd; background: rgba(122,136,159,.13); border-color: rgba(122,136,159,.28); }
.chip.small    { font-size: 10px; padding: 2px 7px; }
.chip.ok::before { animation: pulse 2s infinite; }
/* чипы-фильтры на <button>: у кнопки дефолтный белый фон — в тёмной теме сбрасываем.
   Цветные классы (.critical/.warning/…) перебивают фон/цвет по специфичности и остаются. */
button.chip { appearance: none; -webkit-appearance: none; font: inherit; cursor: pointer;
  background: rgba(122,136,159,.10); color: #9aa7bd;
  transition: border-color .12s, background .12s, opacity .12s; }
button.chip:hover { border-color: rgba(122,136,159,.42); }
button.chip.active { border-color: currentColor; box-shadow: 0 0 0 2px rgba(91,147,224,.15); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* --- таблицы --- */
table { width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  background: #0b1018; color: var(--faint); font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .7px;
}
th.th-sortable { cursor: pointer; user-select: none; transition: color .12s; }
th.th-sortable:hover { color: var(--ink); }
th[data-sd] { color: var(--ink); }
th .sort-ind { opacity: .7; font-size: 9px; }
tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,255,255,.025); }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
td b { font-weight: 600; }
td .msg { color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-word; }
td .since { color: var(--faint); font-size: 11.5px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* --- формы и кнопки --- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0;
  padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  color: #fff; border-radius: var(--radius-sm); transition: filter .15s;
  background: var(--blue);
}
.btn:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.green { background: #22b07d; }
.btn.red   { background: #e64656; }
.btn.gray  { background: var(--card-2); box-shadow: none; border: 1px solid var(--line); }
.btn.gray:hover { background: #1c2534; }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: var(--radius-sm); }
/* поле выбора файла — кнопка в цветах темы, а не системная белая */
input[type=file] { font-size: 12.5px; color: var(--muted); }
input[type=file]::file-selector-button { margin-right: 10px; padding: 5px 11px; font: inherit; font-size: 12px; color: var(--ink);
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
input[type=file]::file-selector-button:hover { border-color: var(--cyan, var(--line)); }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=datetime-local], input:not([type]), select, textarea {
  border: 1px solid var(--line); padding: 9px 11px; font-size: 13px;
  font-family: inherit; background: var(--bg-soft); color: var(--ink); width: 100%;
  border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
/* поле без type= (напр. живой фильтр <input data-filter-all>) — тоже светлый текст (был чёрный дефолт) */
input:not([type]):focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76,141,255,.18); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76,141,255,.18); }
select option { background: var(--card); }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 15px; }
.form-row { margin-bottom: 13px; }
.panel {
  background: var(--card); padding: 20px 22px; margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.panel h2 { margin-top: 0; }
.inline-form { display: inline; }

.flash {
  background: rgba(76,141,255,.1);
  border: 1px solid rgba(76,141,255,.3); color: var(--ink);
  padding: 12px 16px; margin-bottom: 18px; font-size: 13px; word-break: break-word;
  border-radius: var(--radius-sm);
}
.help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.help .mono, .mono { color: #b9c4da; }
/* подробные пояснения видны только пользователю с правом dev; остальным — чистый UI */
.help.detail, .detail { display: none; }
body.dev .help.detail, body.dev .detail { display: block; }
body.dev .detail.inline { display: inline; }
/* маркер режима dev в шапке */
.dev-badge { display: none; }
body.dev .dev-badge { display: inline-flex; }
/* --- сегментированные вкладки (Настройки и т.п.) --- */
.tabbar {
  display: inline-flex; gap: 2px; margin-bottom: 18px; padding: 3px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap;
}
.tab-btn {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 7px 15px; font-size: 13px; font-weight: 600; border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); background: var(--card-2); box-shadow: inset 0 -2px 0 var(--cyan); }

.filters { display: flex; gap: 12px; margin-bottom: 16px; align-items: end; flex-wrap: wrap; }
.filters > div { min-width: 160px; }

/* Живой фильтр списков (поиск + чипы). Прячет неподходящие строки на клиенте. */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 12px; }
.toolbar .tfilter { min-width: 220px; flex: 1 1 240px; max-width: 420px; }
.toolbar .tcount { color: var(--muted); font-size: 12px; white-space: nowrap; }
.toolbar .chips-inline { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.chip.filter { cursor: pointer; user-select: none; opacity: .62; transition: opacity .12s, border-color .12s; }
.chip.filter:hover { opacity: .85; }
.chip.filter.active { opacity: 1; border-color: currentColor; box-shadow: 0 0 0 2px rgba(91,147,224,.15); }
.empty {
  color: var(--muted); padding: 44px 30px; text-align: center;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}

/* --- карта сети (подсети) --- */
.net-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.net-node {
  background: var(--bg-soft); padding: 14px 18px; min-width: 138px; text-align: center;
  border: 1px solid var(--line); border-top: 3px solid var(--gray); border-radius: var(--radius-sm);
  font-size: 13px; transition: transform .15s;
}
.net-node:hover { transform: translateY(-2px); }
.net-node.ok  { border-top-color: var(--green); }
.net-node.off { border-top-color: var(--faint); opacity: .8; }
.net-node.gw  { border-top-color: var(--blue); }
.net-node.other { border-top-color: var(--yellow); }
.net-node .net-icon { font-size: 24px; margin-bottom: 5px; }
.net-node a { color: var(--ink); }
.net-link { align-self: center; width: 28px; height: 2px; background: var(--line); }

/* --- схема сети (Zabbix-стиль) --- */
.scheme {
  position: relative; height: 680px; overflow: hidden; touch-action: none;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 24px 24px,
    #080d16;
  border: 1px solid var(--line); border-radius: 0;
}
/* связи-линии между узлами: SVG-слой под узлами, клики сквозь него */
.scheme-links {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
.scheme-links .link-net {
  stroke: #26304a; stroke-width: 1; opacity: 1;
}
.scheme-links .link-dep {
  stroke: var(--blue); stroke-width: 1; opacity: .5;
  stroke-dasharray: 4 4;
}
@keyframes linkFlow { to { stroke-dashoffset: -12; } }
.node { position: absolute; width: 152px; text-align: center; cursor: grab; user-select: none; padding: 6px 4px; z-index: 1; }
.node:active { cursor: grabbing; z-index: 10; }
.node a { text-decoration: none; }
.node-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; font-size: 15px; font-family: ui-monospace, Consolas, monospace;
  font-weight: 600; letter-spacing: .04em; color: var(--muted); border-radius: 0;
  background: var(--card); border: 1px solid #26304a; transition: border-color .12s;
}
.node:hover .node-ring { border-color: var(--faint); }
.node-ring.critical { background: var(--card); border-color: var(--red); color: var(--red); }
.node-ring.warning  { background: var(--card); border-color: var(--yellow); color: var(--yellow); }
.node-ring.info     { background: var(--card); border-color: var(--blue); color: var(--blue); }
.node-name { color: var(--ink); font-weight: 600; font-size: 13px; margin-top: 6px; }
.node-name a { color: var(--ink); }
.node-host { color: var(--faint); font-size: 11px; font-family: ui-monospace, Consolas, monospace; }
.node-status { font-size: 11px; margin-top: 3px; line-height: 1.3; word-break: break-word; }
.st-green { color: var(--green); } .st-red, .st-critical { color: var(--red); }
.st-warning { color: var(--yellow); } .st-info { color: var(--blue); } .st-gray { color: var(--muted); }

/* --- карты сети: несколько карт, полка машин, ресайз узлов и холста --- */
.map-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.map-wrap { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; }
.map-tray {
  flex: 0 0 210px; align-self: stretch; max-height: 700px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.map-tray-head { font-weight: 600; color: var(--ink); margin-bottom: 8px; display: flex; gap: 6px; align-items: baseline; }
.tray-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px;
  border: 1px solid var(--line); margin-bottom: 6px; cursor: grab; background: rgba(255,255,255,.02);
  transition: border-color .15s, background .15s, transform .1s;
}
.tray-item:hover { border-color: var(--blue); background: rgba(76,141,255,.08); }
.tray-item:active { cursor: grabbing; transform: scale(.97); }
.tray-item > span:first-child { font-size: 18px; }
.tray-name { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-ip { font-size: 11px; color: var(--faint); }

#scheme { flex: 0 0 auto; }
#scheme.drop { outline: 2px dashed var(--blue); outline-offset: -6px; background-color: rgba(76,141,255,.05); }

/* Масштаб узла — через реальные размеры (calc с --k), а НЕ transform:scale:
   в WebView2/старом Chrome `transform: scale(var(--k))` не применялся, плюс узлу
   нельзя transition (иначе перетаскивание лагает — position анимируется). */
.node { transition: none; width: calc(152px * var(--k, 1)); }
.node .node-ring {
  width: calc(52px * var(--k, 1)); height: calc(52px * var(--k, 1));
  font-size: calc(15px * var(--k, 1));
}
.node .node-name { font-size: calc(13px * var(--k, 1)); }
.node .node-host { font-size: calc(11px * var(--k, 1)); }
.node .node-status { font-size: calc(11px * var(--k, 1)); }
.node-del {
  position: absolute; top: -2px; right: 20px; width: 20px; height: 20px; line-height: 18px;
  border: 0; border-radius: 50%; background: rgba(255,93,108,.15); color: var(--red);
  font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.node:hover .node-del { opacity: 1; }
.node-del:hover { background: var(--red); color: #fff; }
.node-resize {
  position: absolute; right: 30px; bottom: -4px; width: 12px; height: 12px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  cursor: nwse-resize; opacity: 0; transition: opacity .15s;
}
.node:hover .node-resize { opacity: .7; }
.canvas-resize {
  position: absolute; right: 3px; bottom: 3px; width: 16px; height: 16px; z-index: 5;
  border-right: 3px solid var(--blue); border-bottom: 3px solid var(--blue);
  cursor: nwse-resize; opacity: .5; transition: opacity .15s;
}
.canvas-resize:hover { opacity: 1; }

/* --- режим связей: рисование/удаление линий --- */
.map-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.scheme-links .link-hit { stroke: transparent; stroke-width: 14px; pointer-events: none; }
.scheme.linkmode .scheme-links { pointer-events: none; }
.scheme.linkmode .scheme-links .link-hit { pointer-events: stroke; cursor: pointer; }
.scheme.linkmode .scheme-links .link-hit:hover + .link-net,
.scheme.linkmode .scheme-links .link-hit:hover { stroke: var(--red); opacity: 1; }
.scheme.linkmode .node { cursor: crosshair; }
.scheme.linkmode .node .node-del, .scheme.linkmode .node .node-resize,
.scheme.linkmode .canvas-resize { display: none; }
.node.link-sel .node-ring { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }

/* --- вход --- */
.login-box {
  max-width: 380px; margin: 12vh auto; background: var(--card);
  padding: 36px 34px; border: 1px solid var(--line); border-radius: var(--radius);
}
.login-box h1 { text-align: center; font-size: 22px; letter-spacing: .3px; margin-bottom: 4px;
  color: var(--ink); }
.login-box .cap { text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--faint); margin-bottom: 26px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 16px; padding: 11px; }
.error { color: #ff8a94; font-size: 13px; margin-top: 10px; text-align: center; }

/* --- «Не получается войти?» — свёрнутая помощь под формой --- */
.login-help { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.login-help summary {
  list-style: none; cursor: pointer; text-align: center; color: var(--muted);
  font-size: 13px; transition: color .15s; user-select: none;
}
.login-help summary::-webkit-details-marker { display: none; }
.login-help summary:hover { color: var(--ink); }
.login-help summary::before { content: "🔑 "; }
.login-help[open] summary { color: var(--ink); margin-bottom: 12px; }
.login-help-body { animation: riseIn .3s cubic-bezier(.16,1,.3,1) both; }
.login-help-body p { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 10px; }
.login-help-body ol { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 12px 0 0; padding-left: 20px; }
.login-help-body ol li { margin-bottom: 5px; }
.login-help-body ol li b { color: var(--ink); }
.login-help-note { margin-top: 12px !important; font-size: 12px !important; opacity: .8; }
.btn.ghost {
  display: inline-flex; width: 100%; justify-content: center; background: transparent;
  border: 1px solid var(--line); color: var(--ink); padding: 9px; margin: 4px 0;
}
.btn.ghost:hover { border-color: var(--blue); background: rgba(76,141,255,.08); }

/* =====================================================================
   ПРЕМИАЛЬНЫЙ СЛОЙ — движение, глубина, отклик (17.07.2026)
   Правила: быстро (150–450 мс), тонко, easing с «выбегом», и всё
   отключается для prefers-reduced-motion. Цвета и вёрстка не тронуты.
   ===================================================================== */

/* --- переходы между страницами: мягкий кроссфейд вместо белой вспышки
       (Chrome/Edge/WebView2 126+; старые браузеры просто игнорируют) --- */
@view-transition { navigation: auto; }

/* --- вход контента: страница «всплывает», карточки — каскадом --- */
/* backwards, не both: после анимации на main не должен оставаться transform — иначе он становится
   «окном» для всех position:fixed внутри (меню, подсказки) и они встают не туда */
main { animation: pageIn .45s cubic-bezier(.16, 1, .3, 1) backwards; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }

.cards > * { animation: riseIn .5s cubic-bezier(.16, 1, .3, 1) backwards; }
.cards > *:nth-child(1)  { animation-delay: .02s; }
.cards > *:nth-child(2)  { animation-delay: .05s; }
.cards > *:nth-child(3)  { animation-delay: .08s; }
.cards > *:nth-child(4)  { animation-delay: .11s; }
.cards > *:nth-child(5)  { animation-delay: .14s; }
.cards > *:nth-child(6)  { animation-delay: .17s; }
.cards > *:nth-child(7)  { animation-delay: .20s; }
.cards > *:nth-child(8)  { animation-delay: .23s; }
.cards > *:nth-child(9)  { animation-delay: .26s; }
.cards > *:nth-child(10) { animation-delay: .29s; }
.cards > *:nth-child(11) { animation-delay: .32s; }
.cards > *:nth-child(12) { animation-delay: .35s; }
.panel { animation: riseIn .45s cubic-bezier(.16, 1, .3, 1) backwards; }
.panel:nth-of-type(2) { animation-delay: .06s; }
.panel:nth-of-type(3) { animation-delay: .12s; }
.panel:nth-of-type(4) { animation-delay: .18s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } }

/* --- метрики наполняются слева направо при появлении --- */
.meter .bar i {
  transform-origin: left center;
  animation: barGrow .8s cubic-bezier(.22, 1, .36, 1) .15s backwards;
}
@keyframes barGrow { from { transform: scaleX(0); } }

/* --- кнопки: плоские, без блика --- */
.btn { position: relative; overflow: hidden; }
.btn:active { filter: brightness(.95); }

/* --- выпадающие меню: появляются, а не телепортируются --- */
nav .navgroup .dropdown {
  display: block; visibility: hidden; opacity: 0; transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .22s cubic-bezier(.16, 1, .3, 1),
              visibility .18s;
}
nav .navgroup:hover .dropdown, nav .navgroup:focus-within .dropdown {
  visibility: visible; opacity: 1; transform: none; pointer-events: auto;
}

/* --- flash-сообщения: въезжают и сами тают через 6 секунд --- */
.flash {
  overflow: hidden; max-height: 220px;
  animation: flashIn .4s cubic-bezier(.16, 1, .3, 1) both,
             flashOut .6s ease 6s forwards;
}
@keyframes flashIn { from { opacity: 0; transform: translateY(-10px); } }
@keyframes flashOut {
  to { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0;
       margin-bottom: 0; border-width: 0; }
}

/* --- шапка: становится плотнее, когда страница прокручена (JS ставит класс) --- */
nav { transition: box-shadow .25s ease, background .25s ease; }
nav.scrolled {
  background: rgba(11,17,31,.96);
  box-shadow: 0 1px 0 var(--line);
}

/* --- вход: карточка всплывает, логотип дышит, ошибка трясётся --- */
.login-box { animation: loginIn .55s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes loginIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.login-box h1 { animation: none; }
.error { animation: shake .45s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* --- скелетон-шиммер для блоков, которые грузятся отдельно (RAS и т.п.) --- */
.skeleton {
  position: relative; overflow: hidden; min-height: 56px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--faint);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* --- сворачиваемые секции (details.fold): стрелка у заголовка, состояние
       запоминается в localStorage (JS в base.html) --- */
details.fold > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: baseline; gap: 8px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: "▸"; color: var(--muted); font-size: 12px;
  transition: transform .2s cubic-bezier(.16, 1, .3, 1);
  transform-origin: center; align-self: center;
}
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary h2 { margin-bottom: 12px; }
details.fold > summary:hover h2 { color: var(--cyan); }

/* --- клавиатурная навигация: заметное кольцо фокуса --- */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* --- таблицы: плавный hover строк --- */
tr td { transition: background .15s ease; }

/* --- уважение к reduced-motion: всё движение выключается --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* графики (SVG) — контейнеры */
[id^="chart-"] svg { max-width: 100%; }

details summary { color: var(--muted); }
details summary:hover { color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* Узкие экраны: ссылки прячутся за гамбургер и выезжают панелью сверху вниз.
   Порог 900px — раньше пунктов уже не хватает места по ширине. */
@media (max-width: 900px) {
  .nav-inner { padding: 0 14px; }
  .nav-burger { display: block; }
  .nav-links {
    display: none; position: absolute; top: 58px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #0d1117; border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 30px rgba(0,0,0,.5); padding: 8px; max-height: 80vh; overflow-y: auto;
  }
  nav.open .nav-links { display: flex; animation: riseIn .25s cubic-bezier(.16,1,.3,1) both; }
  .nav-links .spacer { display: none; }
  .nav-links > a.nav-link, nav .navgroup > .nav-link { padding: 11px 12px; border-radius: 8px; }
  nav .navgroup { position: static; }
  /* на тач-экране :hover не работает — раскрываем группы сразу, с отступом.
     Селектор с `nav` обязателен: премиум-слой (`nav .navgroup .dropdown`) специфичнее
     голого `.navgroup .dropdown`, а медиазапрос специфичность не добавляет — без `nav`
     visibility:hidden побеждал и группы на телефоне были невидимы. */
  nav .navgroup .dropdown {
    display: block; position: static; padding: 0 0 0 14px; min-width: 0;
    visibility: visible; opacity: 1; transform: none; pointer-events: auto;
  }
  nav .navgroup .dropdown-inner { background: transparent; border: 0; box-shadow: none; padding: 0; }
  nav .navgroup .caret { display: none; }
  nav .navgroup.right .dropdown { padding-left: 14px; }
}
@media (max-width: 700px) {
  main { padding: 14px; }
  table { display: block; overflow-x: auto; }
}

/* Папки-проекты на «Обзоре» (заголовок-плашка, вариант B) */
details.pfold { margin-bottom: 8px; }
.pfold > .phead {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 11px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 14px; position: relative; overflow: hidden; transition: background .12s;
}
.pfold > .phead::-webkit-details-marker { display: none; }
.pfold > .phead::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--pa, var(--blue));
}
.pfold > .phead:hover { background: var(--card-2); }
.phead .chev {
  width: 7px; height: 7px; flex: none; box-sizing: border-box;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: rotate(-45deg); transition: transform .18s ease; margin-left: 2px;
}
.pfold[open] > .phead .chev { transform: rotate(45deg); }
.phead .fic { width: 15px; height: 15px; flex: none; stroke: var(--pa, var(--blue)); fill: none; stroke-width: 1.6; }
.phead .pname { font-size: 13.5px; font-weight: 600; color: var(--ink); letter-spacing: .2px; }
.phead .pspacer { flex: 1; }
.phead .pmeta { display: flex; align-items: center; gap: 13px; }
.phead .rb { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
.phead .rb svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.phead .pmdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.phead .pm-ok { color: var(--green); }
.phead .pm-bad { color: var(--red); }
.pfold > .pbody { padding: 12px 2px 6px; }
.pbody .pgl { margin: 10px 0 4px; }
.pbody .pgl:first-child { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .phead .chev { transition: none; } }

/* ============================================================
   РЕДИЗАЙН: боковая навигация (Вариант B) + темы (одним релизом)
   ============================================================ */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.layout { display: flex; align-items: stretch; height: 100vh; overflow: hidden; }

.sidebar {
  width: 236px; flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 50;
}
.side-brand {
  display: flex; align-items: center; height: 50px; padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line); flex: none;
}
.side-brand a { font-size: 17px; font-weight: 700; letter-spacing: .3px; color: var(--ink);
  display: inline-flex; align-items: center; }
.side-brand a .hl { color: var(--cyan); }
/* плавающий переключатель на правом крае панели — скрыт, выезжает при наведении на панель. Стоит на уровне
   логотипа (строка 50px): посередине края он закрывал подписи пунктов меню */
.side-collapse { position: absolute; top: 25px; right: -12px; z-index: 60;
  width: 24px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(-50%) translateX(-5px);
  transition: opacity .16s ease, transform .16s ease, color .15s, border-color .15s, background .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.sidebar:hover .side-collapse, .side-collapse:focus-visible {
  opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0); }
.side-collapse:hover { color: var(--ink); border-color: var(--blue); background: var(--card); }
.side-collapse .ic { width: 14px; height: 14px; transition: transform .16s ease; }
body.side-collapsed .side-collapse .ic { transform: rotate(180deg); }

/* .side-nav — это <nav>; глушим унаследованные от старого верхнего меню правила */
.side-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 8px;
  position: static; background: none; border: 0; display: block;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
/* тонкий ненавязчивый скроллбар — чтобы плавающий переключатель не путался с широкой полосой */
.side-nav::-webkit-scrollbar { width: 7px; }
.side-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 7px; }
.side-nav::-webkit-scrollbar-thumb:hover { background: #2a3446; }
.side-nav::-webkit-scrollbar-track { background: transparent; }
.side-group { margin: 4px 0; }
.side-glbl { display: flex; align-items: center; gap: 11px; padding: 12px 10px 6px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); font-weight: 700;
  cursor: pointer; user-select: none; }
.side-glbl .ic { width: 15px; height: 15px; opacity: .85; }
.side-group.ghas .side-glbl { color: var(--cyan); }
.side-glbl:hover { color: var(--muted); }
.side-group.ghas .side-glbl:hover { color: #7ee9d8; }
/* шеврон сворачивания группы */
.side-glbl::after { content: ""; width: 6px; height: 6px; flex: none; margin-left: auto;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px); opacity: .55; transition: transform .18s ease; }
.side-group.collapsed .side-glbl::after { transform: rotate(-45deg) translateX(-1px); }
.side-group.collapsed .sitem { display: none; }

.sitem { display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 7px;
  color: var(--muted); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.sitem .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sitem.sub { padding-left: 12px; }
.sitem:hover { color: var(--ink); background: rgba(255,255,255,.04); text-decoration: none; }
.sitem.on { color: #eef2f8; background: color-mix(in srgb, var(--cyan) 12%, transparent); box-shadow: inset 2px 0 0 var(--cyan); }
.sitem.on .ic { color: var(--cyan); }

.side-foot { flex: none; border-top: 1px solid var(--line); padding: 10px; display: flex;
  flex-direction: column; gap: 10px; }
.theme-seg { display: flex; gap: 3px; padding: 3px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 7px; }
.theme-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center;
  padding: 6px; background: transparent; border: 0; color: var(--muted); cursor: pointer; border-radius: 5px; }
.theme-seg button:hover { color: var(--ink); }
.theme-seg button.on { color: var(--ink); background: var(--card-2); box-shadow: inset 0 -2px 0 var(--cyan); }
.theme-seg .ic { width: 16px; height: 16px; }

.side-user { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.su-av { width: 32px; height: 32px; border-radius: 7px; flex: none; display: inline-flex;
  align-items: center; justify-content: center; background: var(--card-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--cyan); letter-spacing: .5px; }
.su-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.su-name { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role { font-size: 10px; text-transform: uppercase; letter-spacing: .7px; color: var(--faint); }
.side-user-links { display: flex; gap: 6px; padding: 0 4px; }
.side-user-links a { flex: 1; text-align: center; font-size: 12px; color: var(--muted);
  padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
.side-user-links a:hover { color: var(--ink); border-color: var(--blue); background: rgba(76,141,255,.08); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* верхняя панель = полоса вкладок (как в браузере) */
.topbar { display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 8px; flex: none;
  background: var(--card); border-bottom: 1px solid var(--line); }
.side-burger { display: none; background: transparent; border: 0; color: var(--ink); font-size: 22px;
  cursor: pointer; padding: 4px 8px; line-height: 1; flex: none; }
.tabstrip { display: flex; align-items: center; gap: 3px; flex: 1; min-width: 0; height: 100%; overflow-x: auto; }
.tabstrip::-webkit-scrollbar { height: 0; }
.tabstrip .tab { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; height: 36px; flex: none;
  border-radius: 7px; color: var(--muted); font-size: 12.5px; font-weight: 600; max-width: 200px;
  cursor: pointer; border: 1px solid transparent; background: transparent; }
.tabstrip .tab .fav { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.tabstrip .tab .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabstrip .tab .x { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px; color: var(--muted); font-size: 15px; flex: none; }
.tabstrip .tab .x:hover { background: rgba(255,255,255,.12); color: var(--ink); }
.tabstrip .tab:hover { color: var(--ink); background: var(--bg-soft); }
.tabstrip .tab.on { color: var(--ink); background: var(--bg-soft); border-color: var(--line); }
.tabstrip .tab.on .fav { background: var(--cyan); }
.tab-add { flex: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 18px; border-radius: 6px; cursor: pointer; border: 0; background: transparent; }
.tab-add:hover { background: var(--bg-soft); color: var(--ink); }
.tab-scroll { display: none; flex: none; width: 26px; height: 32px; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--muted); cursor: pointer; border-radius: 6px; font-size: 20px; line-height: 1; }
.tab-scroll:hover { background: var(--bg-soft); color: var(--ink); }
.tab-scroll.show { display: inline-flex; }
.tab-scroll.dis { opacity: .25; pointer-events: none; }
.tabhost { flex: 1; position: relative; min-height: 0; background: var(--bg); }
.tabhost iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; background: var(--bg); }
.tabhost iframe.on { display: block; }

/* свёрнутый сайдбар (только иконки) */
body.side-collapsed .sidebar { width: 66px; }
body.side-collapsed .side-brand .bt,
body.side-collapsed .sitem .lbl,
body.side-collapsed .side-glbl .lbl,
body.side-collapsed .side-user,
body.side-collapsed .side-user-links,
body.side-collapsed .theme-seg button:not(.on) { display: none; }
body.side-collapsed .sitem, body.side-collapsed .side-glbl { justify-content: center; padding-left: 11px; gap: 0; }
body.side-collapsed .side-brand { justify-content: center; align-items: center; padding: 0; }
body.side-collapsed .side-brand .brand-a { justify-content: center; width: 100%; font-size: 19px; line-height: 1; }
body.side-collapsed .side-glbl { padding-left: 10px; }
/* в свёрнутом режиме прячем скроллбар, чтобы иконки центрировались как логотип (полоса съедала ~10px справа) */
body.side-collapsed .side-nav { scrollbar-width: none; }
body.side-collapsed .side-nav::-webkit-scrollbar { width: 0; height: 0; }
body.side-collapsed .side-glbl .ic { opacity: .5; }
body.side-collapsed .side-glbl::after { display: none; }
body.side-collapsed .side-group.collapsed .sitem { display: flex; }
body.side-collapsed .side-collapse svg { transform: rotate(180deg); }
body.side-collapsed .theme-seg { flex-direction: column; }

/* --- узкие экраны: сайдбар уезжает влево, выезжает по бургеру ---
   Порог 640px: десктоп-приложение обычно в узком окне (~760px) — там нужен полноценный
   сайдбар с плавающим переключателем, а не мобильный off-canvas. Мобильный режим — только на
   действительно узких окнах/телефонах (<640). */
@media (max-width: 640px) {
  .side-burger { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.16,1,.3,1); box-shadow: 0 0 40px rgba(0,0,0,.5); z-index: 60; }
  body.side-open .sidebar { transform: none; }
  body.side-collapsed .sidebar { width: 236px; }
  .side-collapse { display: none; }
}

/* ==================== СВЕТЛАЯ ТЕМА ==================== */
/* токены светлых тем — static/themes.css */
:root[data-tone="light"] a:hover { color: var(--blue-d); }
:root[data-tone="light"] th { background: #eef2f8; color: #6b7688; }
:root[data-tone="light"] tr:hover td { background: rgba(20,30,50,.03); }
:root[data-tone="light"] ::selection { background: rgba(47,111,237,.20); }
:root[data-tone="light"] ::-webkit-scrollbar-thumb { background: #c4cedd; border-color: var(--bg); }
:root[data-tone="light"] .side-brand a span,
:root[data-tone="light"] .topbar-brand span,
:root[data-tone="light"] .side-group.ghas .side-glbl,
:root[data-tone="light"] .sitem.on .ic { color: var(--cyan); }
:root[data-tone="light"] .sitem:hover { background: rgba(20,30,50,.05); }
:root[data-tone="light"] .sitem.on { color: var(--ink); background: color-mix(in srgb, var(--cyan) 12%, transparent); box-shadow: inset 2px 0 0 var(--cyan); }
:root[data-tone="light"] .theme-seg button.on { box-shadow: inset 0 -2px 0 var(--blue); }
:root[data-tone="light"] .chip.ok { color: #0a8f5b; }
:root[data-tone="light"] .chip.info { color: #2f6fed; }
:root[data-tone="light"] .chip.warning { color: #a5730a; }
:root[data-tone="light"] .chip.critical { color: #d33646; }
:root[data-tone="light"] .chip.off { color: #5c6875; }
:root[data-tone="light"] .btn.gray { background: #eef2f8; color: var(--ink); }
:root[data-tone="light"] .btn.gray:hover { background: #e3e9f2; }
:root[data-tone="light"] .card:hover { border-color: #b9c6da; }

/* ============ ПОЛЯ ПОИСКА — вариант 1 (лупа+панель ТОЛЬКО у живого фильтра) ============ */
/* Роли разведены: серверный фильтр (форма .filters с name="q" и кнопкой «Фильтр») остаётся
   обычным полем формы; лупа и панель — только у мгновенного фильтра таблицы (.toolbar/.tfilter). */
.tfilter,
input[type="search"],
input[data-filter],
input[data-filter-all],
.toolbar input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e99ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center;
  padding-left: 36px; border-radius: 8px;
}
/* тулбар списка = единая панель: поиск + счётчик + чипы-фильтры в одном блоке */
.toolbar { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; gap: 12px; align-items: center; }
.toolbar input, .toolbar .tfilter { background-color: transparent; border: 0; height: 32px; padding-left: 32px; box-shadow: none; }
.toolbar input:focus, .toolbar .tfilter:focus { box-shadow: none; border: 0; outline: none; }
/* единый приглушённый тон для плейсхолдера и счётчика (было три разных серых) */
.toolbar input::placeholder, .toolbar .tfilter::placeholder { color: var(--muted); }
.toolbar .tcount { color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
.toolbar .tcount b { color: var(--ink); font-weight: 700; }
.toolbar .chips-inline { margin-left: 0; border-left: 1px solid var(--line); padding-left: 12px; }

/* ============ СОВЕТНИК НАСТРОЕК ПОД ЖЕЛЕЗО (MSSQL / RAS) ============ */
.advisor { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); }
.advisor > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--ink);
  display: flex; align-items: center; gap: 10px; list-style: none; user-select: none; }
.advisor > summary::-webkit-details-marker { display: none; }
.advisor > summary::before { content: "\25B8"; color: var(--muted); transition: transform .15s ease; }
.advisor[open] > summary::before { transform: rotate(90deg); }
.advisor > summary:hover { color: var(--cyan); }
.adv-tbl { width: 100%; border-collapse: collapse; margin: 0; }
.adv-tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--faint); font-weight: 600; padding: 8px 12px; border-top: 1px solid var(--line); }
.adv-tbl td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; font-size: 13px; color: var(--ink); }
.adv-st { width: 30px; text-align: center; }
.adv-dot { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; }
.adv-dot.ok { background: rgba(67,209,122,.16); color: #43d17a; }
.adv-dot.warn { background: rgba(230,176,70,.18); color: #e6b046; }
.adv-dot.na { background: var(--bg-soft); color: var(--faint); }
.adv-tbl .mono { font-family: var(--mono); font-size: 12.5px; }
.adv-fix { margin: 7px 0 0; padding: 7px 9px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: pre-wrap;
  overflow-x: auto; user-select: all; overflow-wrap: anywhere; }

/* применение рекомендаций ТНФ (кнопка в блоке советника) */
.adv-apply { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 12px; border-top: 1px solid var(--line); }
.adv-apply label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--muted); margin: 0; }
.adv-apply input[type=number] { width: 120px; }

/* ============ ВЕБ-СЕРВЕРЫ (IIS / Apache) ============ */
.adv-dot.crit { background: rgba(255,93,108,.18); color: #ff8a94; }
.adv-tbl tr.adv-good td { opacity: .72; }
.tbl-wrap { overflow-x: auto; }
.web-srv { margin-bottom: 16px; }
.web-h { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink);
  display: flex; align-items: baseline; gap: 8px; }
.web-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.web-kpi > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.web-kpi b { font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.web-kpi span { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }
.web-kpi .k-crit b { color: var(--red); }
.web-kpi .k-warn b { color: var(--yellow); }
.web-bind { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 1px 0; }
.web-app { font-size: 12px; padding: 1px 0; }
.web-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); }
.web-facts > div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.web-facts > div > span:first-child { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .4px; }
.web-conf { margin-top: 6px; }
.web-conf > summary { cursor: pointer; }
@media (max-width: 640px) { .web-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ============ БАЗА «ЭТАЛОННЫЕ НАСТРОЙКИ» ============ */
.kb-lead { max-width: 760px; margin: -4px 0 14px; font-size: 13px; line-height: 1.55; white-space: normal; }
.kb-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kb-bar #kb-q { flex: 1 1 260px; max-width: 380px; }
.kb-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.kb-only { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0; }
.kb-group { margin-top: 18px; }
.kb-group > h2 { margin: 0 0 4px; }
.kb-list { display: flex; flex-direction: column; gap: 8px; }
.kb-item { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 16px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.kb-item.kb-bad { box-shadow: inset 3px 0 0 var(--yellow); }
.kb-param { font-weight: 600; color: var(--ink); font-size: 14px; }
.kb-rec { margin-top: 3px; font-family: var(--mono); font-size: 12.5px; color: var(--cyan); line-height: 1.5; }
.kb-why { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.55; max-width: 72ch; }
.kb-fix { margin-top: 6px; }
.kb-fix > summary { cursor: pointer; font-size: 12px; color: var(--muted); user-select: none; }
.kb-fix > summary:hover { color: var(--cyan); }
.kb-side { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.kb-srv { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; }
@media (max-width: 640px) { .kb-item { grid-template-columns: 1fr; gap: 8px; } }

.adv-scope { font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.web-at { margin: -6px 0 6px; }
.web-srv .adv-tbl td:last-child { min-width: 260px; max-width: 520px; }
.kb-item[hidden], .kb-area[hidden], .kb-group[hidden], #kb-none[hidden] { display: none; }

/* ============ УГРОЗЫ (CVE) ============ */
.th-src { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.th-src-act { margin-left: auto; display: inline-flex; gap: 8px; }
.th-src-act form { margin: 0; }
.th-import label { cursor: pointer; margin: 0; }
.th-adv { margin-bottom: 18px; }
.th-head { display: flex; align-items: center; gap: 10px; }
.th-head h2 { margin: 0; text-transform: none; letter-spacing: 0; font-size: 17px; color: var(--ink); }
.th-cves { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.th-cve { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card-2); font-size: 12px; color: var(--ink); text-decoration: none; }
.th-cve:hover { border-color: var(--cyan); }
.th-cve b { font-variant-numeric: tabular-nums; color: var(--muted); }
.th-cve b.c9 { color: var(--red); } .th-cve b.c7 { color: var(--yellow); }
.th-kev { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #ff8a94; }
.th-sum { margin: 8px 0; max-width: 90ch; line-height: 1.55; color: var(--muted); font-size: 13.5px; }
.th-target { font-size: 13px; margin: 4px 0 6px; }
.th-target .help { white-space: normal; max-width: 90ch; margin-top: 3px; }
.th-item { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 2px 0; }
.th-item-cve { font-size: 12px; color: var(--muted); min-width: 92px; }
.th-ioc { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; color: #ff8a94; }
.th-acts { min-width: 210px; }
.th-acts form { margin: 0 0 6px; }
.th-acts .help { white-space: normal; margin: -2px 0 6px; }
.th-status select { font-size: 12px; padding: 3px 6px; max-width: 200px; }
tr.th-done td { opacity: .6; }
.th-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 6px 22px; }
.th-steps ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.5; }
.th-iocnote { margin-top: 12px; }
.th-links { margin-top: 10px; white-space: normal; }
.th-more { margin-bottom: 14px; }
.th-iocnote { padding: 10px 12px; border: 1px solid rgba(246,183,60,.3); background: rgba(246,183,60,.08);
  border-radius: var(--radius); font-size: 13px; color: var(--ink); line-height: 1.5; }

.th-svcs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.th-cvelist { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.th-cve.sm { padding: 1px 6px; font-size: 11px; gap: 5px; }
.th-cve.sm .th-kev { font-size: 9px; }
.th-safe { margin-top: 6px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.th-tally { margin: 10px 0 6px; font-size: 13px; color: var(--muted); }
.th-tally b { color: var(--ink); font-variant-numeric: tabular-nums; } .th-tally b.c9 { color: var(--red); }
.th-allcves { margin: 4px 0 6px; } .th-allcves > summary { cursor: pointer; }
/* вход через SSO */
.login-box .sso-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; color: var(--faint); font-size: 12px; }
.login-box .sso-or::before, .login-box .sso-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-box a.sso-btn { display: flex; text-decoration: none; margin-top: 12px; background: transparent; border: 1px solid var(--line); color: var(--ink); }
.login-box a.sso-btn:hover { border-color: var(--cyan); }
/* настройки → доступ: ссылки на вход в панель */
.set-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.set-links a { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.set-links a:hover { border-color: var(--cyan); }
.set-links a span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
/* настройки → обновление панели */
.upd-head { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.upd-ver { display: flex; flex-direction: column; gap: 2px; }
.upd-ver b { font-size: 22px; font-family: var(--mono); }
.upd-act { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.upd-err { color: var(--s-crit, #ff5d6c) !important; }
.upd-new { color: var(--ink) !important; }
.upd-prog { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.upd-prog.bad { border-color: var(--s-crit, #ff5d6c); }
.upd-stage { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; margin-bottom: 8px; }
.upd-bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.upd-bar i { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .4s ease; }
.upd-bar i.ind { width: 100% !important; background: linear-gradient(90deg, transparent, var(--cyan), transparent); background-size: 50% 100%;
  background-repeat: no-repeat; animation: updInd 1.2s linear infinite; }
@keyframes updInd { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { .upd-bar i.ind { animation: none; background: var(--cyan); opacity: .5; } }
.upd-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--faint); }
.upd-steps li::before { content: "○ "; }
.upd-steps li.on { color: var(--ink); } .upd-steps li.on::before { content: "◐ "; color: var(--cyan); }
.upd-steps li.ok { color: var(--muted); } .upd-steps li.ok::before { content: "● "; color: var(--s-ok, #34d399); }
.upd-steps li.err { color: var(--s-crit, #ff5d6c); } .upd-steps li.err::before { content: "✕ "; }
.upd-changes { margin: 10px 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; max-height: 360px; overflow: auto; }
.upd-changes ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.45; }
.upd-auto { display: block; margin: 12px 0 4px; color: var(--ink); font-size: 13.5px; }
.tab-btn .upd-dot { color: var(--cyan); font-style: normal; font-size: 10px; vertical-align: middle; }
#upd [hidden] { display: none !important; }
.upd-msg { margin: 4px 0 8px; font-size: 13px; }
.tab-btn .upd-dot { color: var(--cyan); font-style: normal; font-size: inherit; }
