/* НДУ · карта сети — стиль resspb.ru (СЗЦ РЭС) */

@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
  src: url('/fonts/montserrat-400-cyr.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122;
  src: url('/fonts/montserrat-400-lat.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 500;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
  src: url('/fonts/montserrat-500-cyr.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 500;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122;
  src: url('/fonts/montserrat-500-lat.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 600;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
  src: url('/fonts/montserrat-600-cyr.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 600;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+2000-206F,U+20AC,U+2122;
  src: url('/fonts/montserrat-600-lat.woff2') format('woff2');
}

:root {
  --accent: #ea5621;
  --red: #e44e56;
  --warn: #ff9e45;
  --green: #2f9e44;
  --ink: #1b1b1b;
  --gray-6: #6c6d74;
  --gray-4: #b4b5ba;
  --gray-2: #e5e5e7;
  --bg: #f8f9fa;
}

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

html, body {
  height: 100%;
  font-family: 'Montserrat', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: #fff;
  padding: 10px 20px; min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { height: 44px; width: auto; }
.brand-title { font-weight: 600; font-size: 17px; letter-spacing: .3px; }
.brand-sub { font-size: 11.5px; color: var(--gray-4); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.summary { display: flex; gap: 8px; }
.chip {
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 12px;
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18);
  white-space: nowrap;
}
.chip b { font-weight: 600; }
.chip.ok b { color: #7ddb93; }
.chip.bad b { color: #ff9b9f; }
.updated { font-size: 11.5px; color: var(--gray-4); min-width: 150px; text-align: right; }
.btn {
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--accent); border: none; border-radius: 6px;
  padding: 8px 14px; transition: filter .15s;
}
.btn:hover { filter: brightness(1.1); }

/* ---------- тулбар ---------- */
.toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--gray-2);
}
#search {
  font-family: inherit; font-size: 13px; padding: 8px 12px; width: 320px;
  border: 1px solid var(--gray-2); border-radius: 6px; outline: none;
}
#search:focus { border-color: var(--accent); }
.chk { font-size: 12px; color: var(--gray-6); display: flex; align-items: center; gap: 6px; }
.logout { font-size: 12px; color: var(--gray-6); text-decoration: none; border: 1px solid var(--gray-2); border-radius: 6px; padding: 5px 10px; }
.logout:hover { color: var(--red); border-color: var(--red); }
.wrap2 { max-width: 640px; margin: 30px auto; background: #fff; border: 1px solid var(--gray-2); border-radius: 10px; padding: 24px 28px; }
.wrap2 h2 { border: none; font-size: 14px; margin: 18px 0 8px; }
.qrbox { text-align: center; padding: 12px 0; }
.qrbox svg { border: 1px solid var(--gray-2); border-radius: 8px; }
.mono { font-family: Consolas, monospace; font-size: 13px; background: #f1f2f4; padding: 8px 10px; border-radius: 6px; word-break: break-all; }
.mono.big { font-size: 17px; font-weight: 600; letter-spacing: 2px; text-align: center; }
.legend { display: flex; gap: 14px; margin-left: auto; font-size: 11.5px; color: var(--gray-6); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.up { background: var(--green); }
.dot.down { background: var(--red); }
.dot.warn { background: var(--warn); }
.dot.unknown { background: var(--gray-4); }
.dot.info { background: #8a97c9; }

/* ---------- карта ---------- */
.map-wrap { position: relative; height: calc(100vh - 190px); min-height: 480px; overflow: hidden; }
#map { width: 100%; height: 100%; display: block; cursor: grab; }
#map.panning { cursor: grabbing; }

.zone-rect { fill: #fff; stroke: var(--gray-2); stroke-width: 1.2; rx: 10; }
.zone-title { font-size: 13px; font-weight: 600; fill: var(--ink); }
.zone-sub { font-size: 10.5px; fill: var(--gray-6); }

.edge { stroke: var(--gray-4); stroke-width: 1.4; fill: none; }
.edge.thick { stroke: var(--gray-6); stroke-width: 3; }
.edge.thin { stroke: #d7d8db; stroke-width: 1; }
.edge.dashed { stroke-dasharray: 6 4; stroke: var(--gray-4); }
.edge.thin-dashed { stroke-dasharray: 3 4; stroke: #cfd0d4; stroke-width: 1; }
.edge-label { font-size: 10px; fill: var(--gray-6); paint-order: stroke; stroke: #fff; stroke-width: 3px; font-weight: 500; }
.edge-label.main { fill: var(--accent); font-weight: 600; }

.node { cursor: pointer; }
.node-card { fill: #fff; stroke: var(--gray-2); stroke-width: 1.4; }
.node:hover .node-card { stroke: var(--accent); }
.node.selected .node-card { stroke: var(--accent); stroke-width: 2.2; }
.node.dimmed { opacity: .18; }
.node-name { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.node-sub { font-size: 10px; fill: var(--gray-6); }
.node-ip { font-size: 9.5px; fill: var(--gray-4); }
.node-icon { fill: none; stroke: var(--gray-6); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.node-icon.accent { stroke: var(--accent); }
.status-dot { stroke: #fff; stroke-width: 1.5; }
.childlist { fill: #fbfbfc; stroke: var(--gray-2); stroke-width: 1; }
.child-name { font-size: 9.5px; font-weight: 500; fill: var(--ink); }
.child-sub { font-size: 8.5px; fill: var(--gray-6); }
.child-row { cursor: pointer; }
.child-row:hover .child-name { fill: var(--accent); }
.child-note-warn { fill: var(--warn); font-size: 8.5px; font-weight: 600; }

.failover-chip { fill: #fff; stroke: var(--gray-2); }
.failover-text { font-size: 10px; fill: var(--gray-6); font-weight: 500; }
.failover-on { fill: var(--green); font-weight: 600; }
.failover-off { fill: var(--gray-4); }
.failover-err { fill: var(--red); }

/* ---------- панель деталей ---------- */
.panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 360px;
  background: #fff; border: 1px solid var(--gray-2); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(27,27,27,.12);
  padding: 18px 20px; overflow-y: auto; z-index: 10;
}
.panel-close {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 22px; color: var(--gray-4); cursor: pointer; line-height: 1;
}
.panel-close:hover { color: var(--red); }
.panel h2 { font-size: 16px; font-weight: 600; margin-bottom: 2px; padding-right: 24px; }
.panel .kind-tag {
  display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}
.panel .state-line { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 12.5px; }
.panel h3 { font-size: 12px; font-weight: 600; color: var(--gray-6); text-transform: uppercase; letter-spacing: .5px; margin: 14px 0 6px; }
.panel ul { list-style: none; }
.panel li { font-size: 12px; color: var(--ink); padding: 3px 0; line-height: 1.45; }
.panel li.muted { color: var(--gray-6); }
.probe-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--gray-2); font-size: 12px; }
.probe-row .ms { color: var(--gray-6); font-size: 11px; margin-left: auto; }
.probe-row .ok { color: var(--green); font-weight: 600; }
.probe-row .fail { color: var(--red); font-weight: 600; }
.panel .note { font-size: 11.5px; color: var(--gray-6); background: #fbfbfc; border: 1px solid var(--gray-2); border-radius: 6px; padding: 8px 10px; margin-top: 10px; line-height: 1.5; }
.panel .note.warn { border-color: var(--warn); background: #fff8ef; color: #8a5a16; }

/* ---------- подвал ---------- */
.foot {
  padding: 8px 20px; font-size: 11px; color: var(--gray-4);
  border-top: 1px solid var(--gray-2); background: #fff;
}

/* ---------- таблица подключённых устройств (L2) ---------- */
.devices {
  margin: 14px 20px 18px;
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: 12px;
  padding: 16px 18px;
}
.devices-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.devices-head h2 { font-size: 15px; font-weight: 600; }
.devices-count { color: var(--gray-6); font-weight: 400; font-size: 13px; }
.devices-head input {
  margin-left: auto;
  border: 1px solid var(--gray-2); border-radius: 8px;
  padding: 6px 10px; font: inherit; width: 280px; background: var(--bg);
}
.devices-meta { color: var(--gray-6); font-size: 12px; width: 100%; }
.devices-table-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.devices-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.devices-table th {
  text-align: left; color: var(--gray-6); font-weight: 600; font-size: 12px;
  border-bottom: 2px solid var(--gray-2); padding: 6px 10px; position: sticky; top: 0; background: #fff;
}
.devices-table td { border-bottom: 1px solid var(--gray-2); padding: 6px 10px; vertical-align: top; }
.devices-table tr:hover td { background: var(--bg); }
.dev-name { font-weight: 500; }
.dev-comment { color: var(--gray-6); font-size: 12px; }
.dev-ip { font-family: Consolas, monospace; white-space: nowrap; }
.dev-mac { font-family: Consolas, monospace; color: var(--gray-6); white-space: nowrap; }
.loc-chip {
  display: inline-block;
  background: var(--bg); border: 1px solid var(--gray-2); border-radius: 6px;
  padding: 1px 8px; margin: 1px 4px 1px 0; white-space: nowrap; font-size: 12px;
}
.wifi-badge {
  display: inline-block; background: #eef3ff; color: #3b5bdb;
  border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 600;
}

/* v1.2: вендор, устаревшие строки, CSV-кнопка */
.dev-vendor { color: var(--gray-6); font-size: 12px; }
.stale-badge {
  display: inline-block; background: #fff4e0; color: #b26a00;
  border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 600;
}
tr.stale-row td { opacity: 0.75; }
.devices-head .btn { padding: 6px 12px; font: inherit; font-size: 12px; cursor: pointer; }

/* v1.3: бейдж перемещений устройства */
.move-badge {
  display: inline-block; background: #eef7ee; color: #2b7a3d;
  border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 600;
}
