/* PAM — интерфейс в стиле NetMap (Mantine AppShell): шапка 56px, слева дерево площадок 280px.
   Без инлайновых стилей: CSP портала разрешает только style-src 'self'. */
:root {
  --blue: #228be6; --blue-light: #e7f5ff; --blue-dark: #1971c2;
  --green: #40c057; --green-text: #2f9e44; --green-light: #ebfbee;
  --yellow: #fab005; --yellow-text: #e67700; --yellow-light: #fff9db;
  --red: #fa5252; --red-text: #e03131; --red-light: #fff5f5;
  --gray-light: #f1f3f5;
  /* Способы подключения — одни и те же на кнопках и плашках «кто подключён» */
  --ssh: #343a40; --rdp: #0c8599; --claude: #d97757; --copilot: #2b7de9; --agent: #7048e8;
  --vpn: #ea7e20;
  --text: #212529; --dimmed: #868e96; --border: #dee2e6; --body: #fff; --surface: #f8f9fa; --hover: #f1f3f5;
  --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.1);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue-light: rgba(34,139,230,.15); --green-light: rgba(64,192,87,.15); --yellow-light: rgba(250,176,5,.15);
    --red-light: rgba(250,82,82,.15); --gray-light: #2e2e2e; --ssh: #5c636a;
    --text: #c9c9c9; --dimmed: #8c8c8c; --border: #424242; --body: #242424; --surface: #1a1a1a; --hover: #2e2e2e;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--surface); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
svg.i { width: 16px; height: 16px; flex: none; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── Каркас ── */
header.shell { position: fixed; inset: 0 0 auto 0; height: 56px; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--body); }
nav.side { position: fixed; top: 56px; bottom: 0; left: 0; width: 280px; display: flex; flex-direction: column; z-index: 15;
  border-right: 1px solid var(--border); background: var(--body); }
main { margin: 56px 0 0 280px; padding: 16px 24px 48px; min-height: calc(100vh - 56px); }
main.bare { margin: 0 auto; max-width: 900px; padding: 24px; min-height: 0; }
body.menu-hidden nav.side { display: none; }
body.menu-hidden main { margin-left: 0; }

.burger { width: 34px; height: 34px; border: 0; background: none; border-radius: var(--radius); cursor: pointer; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.burger:hover { background: var(--hover); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: .5px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo img { width: 30px; height: 30px; }
.topnav { display: flex; gap: 4px; align-items: center; }
.topnav > a, .topnav summary { display: inline-flex; align-items: center; padding: 0 12px; height: 32px; border-radius: var(--radius);
  font-weight: 600; font-size: 13px; color: var(--dimmed); cursor: pointer; list-style: none; }
.topnav summary::-webkit-details-marker { display: none; }
.topnav > a:hover, .topnav summary:hover { background: var(--hover); text-decoration: none; }
.topnav > a.active, .topnav details.active > summary { background: var(--blue-light); color: var(--blue); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: 38px; left: 0; min-width: 240px; padding: 4px; background: var(--body); z-index: 30;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.dropdown-menu .label, .menu-label { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--dimmed); padding: 6px 10px 2px; }
.dropdown-menu a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); font-size: 13px; }
.dropdown-menu a:hover { background: var(--hover); text-decoration: none; }
.search { flex: 1; display: flex; justify-content: center; }
.search input { width: 100%; max-width: 520px; height: 34px; padding: 0 12px 0 34px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--body) url("search.svg") 11px center no-repeat; color: var(--text); font: inherit; }
.user { position: relative; }
.user summary { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: var(--radius); cursor: pointer; list-style: none; }
.user summary::-webkit-details-marker { display: none; }
.user summary:hover { background: var(--hover); }
.user .who-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.user .dropdown-menu { left: auto; right: 0; }
.user form { margin: 0; }
.user form button { width: 100%; text-align: left; background: none; color: var(--text); padding: 6px 10px; font-weight: 400; }
.user form button:hover { background: var(--hover); }

.side-body { flex: 1; overflow: auto; padding: 12px; }
.side-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
  font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--dimmed); }
.side-title a { width: 26px; height: 26px; border-radius: var(--radius); background: var(--blue-light); color: var(--blue);
  display: inline-flex; align-items: center; justify-content: center; }
.side-title a svg.i { width: 14px; height: 14px; }
.side-title a:hover { background: var(--blue); color: #fff; }
.side-title a:hover { text-decoration: none; }
.org-name { padding: 8px 10px 2px; font-weight: 700; font-size: 13px; }
.navlink { display: block; padding: 6px 10px; border-radius: var(--radius); color: var(--text); }
.navlink:hover { background: var(--hover); text-decoration: none; }
.navlink.active { background: var(--blue-light); color: var(--blue); }
.navlink small { display: block; color: var(--dimmed); font-size: 12px; line-height: 1.35; min-height: 1em; }
.navlink .emoji { margin-right: 6px; }
.navlink .counter { float: right; font-size: 11px; color: var(--dimmed); }
.sites { padding-left: 10px; }
.r-ico { float: right; display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; }
.r-ico svg.i { width: 12px; height: 12px; }
.side-foot { padding: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--dimmed); line-height: 1.4; }

/* ── Общие элементы ── */
.crumbs { font-size: 13px; color: var(--dimmed); margin-bottom: 4px; }
.crumbs a { color: var(--dimmed); }
.page-head, .title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
h1 { font-size: 24px; margin: 0; line-height: 1.3; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 12px; margin: 22px 0 10px; text-transform: uppercase; color: var(--dimmed); letter-spacing: .3px; }
.dim, .muted, .hint { color: var(--dimmed); font-weight: 400; }
.hint, .muted { font-size: 12.5px; }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 200px; }
.paper, .card, table { background: var(--body); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { padding: 20px; display: grid; gap: 14px; max-width: 820px; margin-bottom: 16px; }
.card h2 { margin: 0; }
.card.narrow { max-width: 380px; }
.stack { display: grid; gap: 14px; }
.error { color: var(--red-text); background: var(--red-light); border: 1px solid var(--red); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 14px; }
.field-error { color: var(--red-text); font-weight: 400; font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .25px; white-space: nowrap;
  background: var(--blue-light); color: var(--blue); vertical-align: middle; }
.badge.gray, .badge.vpn, .badge.proto { background: var(--gray-light); color: var(--dimmed); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dimmed); flex: none; vertical-align: middle; }
.dot.on, .dot.green { background: var(--green); }

/* Формы */
label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
label.inline { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.inline input { margin-top: 3px; }
input, select, textarea { font: inherit; font-weight: 400; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--body); color: var(--text); }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 56px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-light); border-color: var(--blue); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 16px; display: grid; gap: 12px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
button, .button { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; height: 32px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius); background: var(--blue); color: #fff; cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { background: var(--blue-dark); text-decoration: none; }
button.secondary, .button.secondary, .button.secondary-link, .button.default { background: var(--body); color: var(--text); border-color: var(--border); }
button.secondary:hover, .button.secondary:hover, .button.secondary-link:hover, .button.default:hover { background: var(--hover); }
button.light, .button.light { background: var(--blue-light); color: var(--blue); }
button.danger { background: var(--red); }
button.link { background: none; color: var(--blue); padding: 0; height: auto; }
button.sm, .button.sm { height: 26px; padding: 0 10px; font-size: 12px; }
button[disabled] { opacity: .45; cursor: default; }
details.hint pre { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px; overflow-x: auto; font-size: 12px; white-space: pre; }
details.hint summary { cursor: pointer; color: var(--blue); }
.check { border-radius: var(--radius); padding: 10px 14px; border: 1px solid var(--border); }
.check.ok { border-color: var(--green); }
.check.fail { border-color: var(--red); }
.check ul { margin: 6px 0 0; padding-left: 20px; }
.check .problem { color: var(--red-text); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--gray-light); border-radius: var(--radius); justify-self: start; }
.seg a, .seg label { padding: 3px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--dimmed); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg .on, .seg label:has(input:checked) { background: var(--body); color: var(--text); box-shadow: var(--shadow); }
.seg input { display: none; }
.emoji-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.emoji-pick label { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--body);
  font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.emoji-pick input { display: none; }
.emoji-pick label:has(input:checked) { border-color: var(--blue); background: var(--blue-light); box-shadow: 0 0 0 1px var(--blue); }

/* Таблицы */
table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--dimmed); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--border); }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.group td { background: var(--surface); font-weight: 700; font-size: 12.5px; }
.status, .vpn-state { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--gray-light); color: var(--dimmed); white-space: nowrap; }
.status-redeemed, .vpn-connecting { background: var(--blue-light); color: var(--blue); }
.status-ended, .vpn-up { background: var(--green-light); color: var(--green-text); }
.status-failed, .status-timed_out, .vpn-error { background: var(--red-light); color: var(--red-text); }
.row-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.row-actions form { margin: 0; }
.tabs { display: flex; gap: 16px; margin: -4px 0 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
table.journal td { vertical-align: top; }
table.journal td.details { font-size: 12.5px; color: var(--dimmed); max-width: 420px; overflow-wrap: anywhere; }
table.journal tr.alarm td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.nowrap { white-space: nowrap; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.props dt { color: var(--dimmed); }
.props dd { margin: 0; }
.details { word-break: break-all; }

/* ── Кто подключён: аватар Entra в плашке способа, в углу — маршрут ── */
.online { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex: none; object-fit: cover; }
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.av0 { background: #7048e8; } .av1 { background: #0ca678; } .av2 { background: #f76707; }
.av3 { background: #1c7ed6; } .av4 { background: #d6336c; } .av5 { background: #5c940d; }
.who { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 2px 8px 2px 2px; border-radius: 14px;
  color: #fff; white-space: nowrap; }
.who:hover { text-decoration: none; filter: brightness(1.1); }
/* Обводка аватара — состояние: зелёная — на связи, серая — сессия числится идущей, но связи нет; в истории — нейтральная */
.who .avatar { box-shadow: 0 0 0 2px var(--green); margin-right: 2px; }
.who.stale .avatar { box-shadow: 0 0 0 2px #adb5bd; }
.who.hist .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.who svg.i { width: 13px; height: 13px; }
.who.ssh { background: var(--ssh); } .who.rdp { background: var(--rdp); } .who.claude { background: var(--claude); }
.who.copilot { background: var(--copilot); } .who.agent { background: var(--agent); }
.who.stale { opacity: .55; }
.who .via { position: absolute; right: -4px; top: -5px; width: 15px; height: 15px; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--body); }
.who .via svg.i { width: 10px; height: 10px; }
.who .via.vpn { background: var(--vpn); }
.who .via.pam, .pam-ico { background: url("pam.png") center / contain no-repeat; }
.pam-ico { display: inline-block; width: 14px; height: 14px; flex: none; }
.r-ico .pam-ico { width: 12px; height: 12px; }
.who-server { font-size: 12px; color: var(--dimmed); margin-right: 6px; }
.ri-direct { color: var(--green-text); } .ri-vpn { color: var(--vpn); }

/* ── Кнопки подключения и меню маршрута ── */
.connect { display: inline-flex; position: relative; margin: 0; }
.connect form { margin: 0; display: inline-flex; }
.conn-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 8px; border-radius: var(--radius);
  border: 0; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.conn-btn.ssh, .connect.ssh .caret { background: var(--ssh); }
.conn-btn.rdp, .connect.rdp .caret { background: var(--rdp); }
.conn-btn.ssh:hover, .connect.ssh .caret:hover { background: #495057; }
.conn-btn.rdp:hover, .connect.rdp .caret:hover { background: #0b7285; }
.connect.menu .conn-btn { border-radius: var(--radius) 0 0 var(--radius); padding-right: 8px; }
.route-pick { display: inline-flex; }
.route-pick summary.caret { list-style: none; border-left: 1px solid rgba(255,255,255,.25); color: #fff; width: 20px; height: 28px; cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; }
.route-pick summary::-webkit-details-marker { display: none; }
.route-menu { position: absolute; top: 32px; left: 0; z-index: 25; width: 300px; padding: 4px; background: var(--body); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.15); font-size: 13px; }
.route-menu form { display: block; }
.route-menu .item { display: flex; gap: 8px; align-items: flex-start; width: 100%; height: auto; padding: 6px 10px; border-radius: 6px;
  background: none; color: var(--text); font-weight: 400; text-align: left; white-space: normal; border: 0; }
.route-menu .item:hover { background: var(--hover); }
.route-menu .item[disabled]:hover { background: none; }
.route-menu .chk { width: 14px; flex: none; color: var(--blue); font-weight: 700; }
.route-menu .ico { width: 16px; flex: none; display: inline-flex; justify-content: center; padding-top: 2px; }
.route-menu .item small { display: block; color: var(--dimmed); font-size: 11.5px; line-height: 1.35; }
.route-menu .foot { border-top: 1px solid var(--border); margin-top: 4px; padding: 6px 10px; font-size: 11.5px; color: var(--dimmed); line-height: 1.4; }

/* ИИ: режим и кнопки клиентов — одной капсулой */
.ai-group { display: inline-flex; align-items: center; gap: 3px; padding: 2px; border-radius: 16px; background: var(--gray-light); }
.ai-mode { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: help; }
.ai-mode svg.i { width: 15px; height: 15px; }
.ai-group.read .ai-mode { color: var(--blue); }
.ai-group.full .ai-mode { color: var(--yellow-text); }
.ai-group.off .ai-mode { color: var(--dimmed); }
.ai-btn { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--body); border: 1.5px solid; padding: 0; }
.ai-btn:hover { text-decoration: none; }
.ai-btn.claude { color: var(--claude); border-color: var(--claude); }
.ai-btn.copilot { border-color: #c9d6f2; }
.ai-btn.copilot svg.i { width: 17px; height: 17px; }
.ai-btn.claude:hover { background: var(--claude); color: #fff; }
.ai-btn.copilot:hover { background: var(--blue-light); border-color: var(--copilot); }

/* ── Площадка ── */
.site-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 16px; }
.site-info > div { padding: 12px 16px; border-right: 1px solid var(--border); }
.site-info > div:last-child { border-right: 0; }
.site-info .k { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--dimmed); }
.site-info .v { margin-top: 2px; display: flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }
.route-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.route { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap; cursor: help; }
.route svg.i { width: 13px; height: 13px; }
.route.direct { background: var(--green-light); color: var(--green-text); }
.route.vpn { background: rgba(234,126,32,.14); color: #d9480f; }
.route.pam { background: var(--blue-light); color: var(--blue-dark); }
.route.none { background: var(--gray-light); color: var(--dimmed); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.hv { margin-bottom: 20px; }
.hv-head { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.hv-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; }
.hv-icon svg.i { width: 24px; height: 24px; }
.hv-icon.pve { background: #e57000; } .hv-icon.hyperv { background: #0078d4; } .hv-icon.esxi { background: #607078; }
.hv-icon.sm { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; vertical-align: middle; }
.hv-icon.sm svg.i { width: 13px; height: 13px; }
.hv-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hv-title h2 { font-size: 17px; margin: 0; }
.hv-title h2 a { color: inherit; }
.hv-meta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--dimmed); margin-top: 2px; }
.hv-meta b { color: var(--text); font-weight: 600; }
.hv-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.hv .grid { padding: 14px 16px 16px; }
.vm { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--body); transition: box-shadow .15s, border-color .15s; }
.vm:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(34,139,230,.12); }
.vm-top { display: flex; align-items: flex-start; gap: 10px; }
.os { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.os.linux { background: #495057; } .os.windows { background: #1c7ed6; }
.os svg.i { width: 17px; height: 17px; }
.vm-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.vm-name a { color: inherit; }
.vm-host { font-size: 12px; color: var(--dimmed); font-family: var(--mono); }
.vm-now { min-height: 28px; display: flex; align-items: center; }
.vm-last { font-size: 11.5px; color: var(--dimmed); display: flex; align-items: center; gap: 5px; }
.vm-last svg.i { width: 13px; height: 13px; }
.vm-last.ok svg.i { color: var(--green-text); }
.vm-last.fail { color: var(--red-text); }
.vm-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.spacer { flex: 1; }
.vm-add { border: 1px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  min-height: 140px; color: var(--dimmed); font-weight: 600; }
.vm-add:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); text-decoration: none; }
.empty { padding: 40px; text-align: center; color: var(--dimmed); }

/* Форма площадки: маршруты */
.routes-edit { display: grid; gap: 8px; }
.route-row { display: grid; grid-template-columns: auto 20px 1fr auto auto; gap: 10px; align-items: start; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 400; }
.route-row .move { display: grid; gap: 2px; }
.route-row .move button { height: 18px; width: 22px; padding: 0; justify-content: center; background: var(--body); color: var(--dimmed); border-color: var(--border); font-size: 10px; }
.route-row .ico { padding-top: 4px; }
.route-row .ico svg.i, .route-row .ico .pam-ico { width: 17px; height: 17px; }
.route-row .name { font-weight: 700; }
.route-row .name small { display: block; font-weight: 400; color: var(--dimmed); font-size: 12px; }
.route-row .del { background: none; color: var(--dimmed); font-size: 18px; padding: 0 6px; }
.route-row .del:hover { background: var(--hover); }
.route-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  nav.side { display: none; } main { margin-left: 0; padding: 12px 16px 40px; }
  body.menu-open nav.side { display: flex; width: 100%; }
  .topnav, .search { display: none; } .user .who-name { display: none; } header.shell { justify-content: space-between; }
  .hv-head { grid-template-columns: auto 1fr; } .hv-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .site-info > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .two { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}

/* ── Вход ── */
body.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(34,139,230,.18), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(12,133,153,.14), transparent 60%), var(--surface); }
main.login { margin: 0; width: 100%; max-width: 400px; padding: 0; min-height: 0; }
.login-card { background: var(--body); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.08);
  padding: 32px 28px 24px; display: grid; gap: 16px; text-align: center; }
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-card .brand img { width: 56px; height: 56px; }
.login-card h1 { font-size: 22px; }
.login-card .login-sub { color: var(--dimmed); font-size: 13px; margin-top: -8px; }
.login-card .button { justify-content: center; height: 42px; font-size: 14px; }
.login-card .ms { width: 18px; height: 18px; }
.login-card form { text-align: left; }
.login-card .divider { display: flex; align-items: center; gap: 10px; color: var(--dimmed); font-size: 12px; }
.login-card .divider::before, .login-card .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-foot { text-align: center; color: var(--dimmed); font-size: 12px; margin-top: 16px; }
.login-card button { justify-content: center; height: 40px; }

/* ── Карточка сервера ── */
.sv-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sv-head .os { width: 44px; height: 44px; border-radius: 10px; }
.sv-head .os svg.i { width: 26px; height: 26px; }
.sv-head h1 { font-size: 22px; }
.sv-head .host { font-family: var(--mono); color: var(--dimmed); font-size: 13px; }
.sv-head .meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.sv-head .spacer { flex: 1; }
.sv-head form { margin: 0; display: inline-flex; }
.sv-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.sv-cols.journal { grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
.sv-col { display: grid; gap: 16px; margin: 0; }
.sv-col.side { position: sticky; top: 72px; }
.blk { background: var(--body); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 16px; display: grid; gap: 12px; }
.blk-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--dimmed); letter-spacing: .3px; }
.blk-title svg.i { width: 15px; height: 15px; }
.blk-title .spacer, .sub-title .spacer { flex: 1; }
.blk-title a { text-transform: none; font-weight: 600; letter-spacing: 0; }
.sub { border-top: 1px dashed var(--border); padding-top: 12px; display: grid; gap: 10px; }
.sub-title { font-size: 12px; font-weight: 700; color: var(--dimmed); display: flex; align-items: center; gap: 6px; }
.sub-title svg.i { width: 14px; height: 14px; }
.info { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  color: var(--dimmed); border: 1px solid var(--border); cursor: help; text-transform: none; vertical-align: middle; }
.field-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.field-row > span:first-child { color: var(--dimmed); }
.field-row input, .field-row select { width: 100%; }
.inline-in { display: flex; gap: 6px; align-items: center; }
.inline-in input { flex: 1; min-width: 0; }
.icon-btn2 { width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--body); color: var(--dimmed);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: none; cursor: pointer; }
.icon-btn2:hover { background: var(--hover); color: var(--text); }
.icon-btn2 svg.i { width: 15px; height: 15px; }
.icon-btn2.danger { color: var(--red-text); background: var(--body); }
.icon-btn2.danger:hover { background: var(--red-light); color: var(--red-text); }
.seg.icons label { padding: 4px 10px; }
.seg.icons svg.i { width: 15px; height: 15px; }
.seg.full { display: flex; justify-self: stretch; } .seg.full label { flex: 1; justify-content: center; }
.proto { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.proto > input[type=checkbox] { display: none; }
.proto:has(> input:checked) { border-color: var(--blue); background: var(--blue-light); }
.proto .name { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; width: 64px; }
.proto input.port { width: 70px; text-align: center; }
.proto .spacer { flex: 1; }
.switch { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--border); flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: left .15s; }
.proto:has(> input:checked) .switch { background: var(--blue); }
.proto:has(> input:checked) .switch::after { left: 16px; }
.kv-mini { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; font-size: 12.5px; margin: 0; }
.kv-mini dt { color: var(--dimmed); } .kv-mini dd { margin: 0; overflow-wrap: anywhere; }
.fp { font-family: var(--mono); font-size: 11.5px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 12px; border-radius: var(--radius); background: var(--green-light); color: var(--green-text); margin-bottom: 16px; }
.check-line.fail { background: var(--red-light); color: var(--red-text); }
.check-line svg.i { width: 15px; height: 15px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 12px 0; background: linear-gradient(transparent, var(--surface) 30%); z-index: 5; }
.jr { max-height: calc(100vh - 260px); overflow: auto; }
.jr-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.jr-filter span { padding: 2px 9px; border-radius: 11px; font-size: 11.5px; font-weight: 600; background: var(--gray-light); color: var(--dimmed); cursor: pointer; }
.jr-filter span.on { background: var(--blue-light); color: var(--blue); }
.tl { list-style: none; margin: 0; padding: 0; display: grid; }
.tl[data-filter="session"] li:not([data-kind="session"]), .tl[data-filter="ai"] li:not([data-kind="ai"]),
.tl[data-filter="change"] li:not([data-kind="change"]) { display: none; }
.tl li { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.tl li:last-child { border-bottom: 0; }
.tl .when { color: var(--dimmed); font-size: 11.5px; }
.tl .what { line-height: 1.4; min-width: 0; }
.tl .what b { font-weight: 600; }
.tl .det { color: var(--dimmed); font-size: 12px; overflow-wrap: anywhere; }
.tl .det code { font-size: 11.5px; background: var(--gray-light); padding: 0 4px; border-radius: 4px; }
.tl .ev { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gray-light); color: var(--dimmed); }
.tl .ev svg.i { width: 14px; height: 14px; }
.tl .ev.edit { background: var(--blue-light); color: var(--blue); }
.tl .ev.key { background: var(--yellow-light); color: var(--yellow-text); }
.tl .ev.ok { background: var(--green-light); color: var(--green-text); }
.tl .ev.bad { background: var(--red-light); color: var(--red-text); }
.tl .who { height: 26px; padding-right: 6px; }
.tl .who .avatar { width: 22px; height: 22px; }
@media (max-width: 1100px) { .sv-cols, .sv-cols.journal { grid-template-columns: 1fr; } .sv-col.side { position: static; } }

/* Карточка сервера на широком экране: блоки формы — в две колонки (как газетные), шапка компактнее */
.online-slot { display: contents; }
.head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.head-actions .spacer { display: none; }
.sv-form { display: block; columns: 2 460px; column-gap: 16px; }
.sv-form > .blk { break-inside: avoid; margin-bottom: 16px; }
.sv-form > input { display: none; }
.sv-cols.journal { grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
.field-row { max-width: 720px; }

/* Меню маршрута у кнопок справа (гипервизор, шапка сервера) раскрывается влево, чтобы не уходить за край */
.hv-actions .route-menu, .head-actions .route-menu, .route-menu.to-left { left: auto; right: 0; }

/* ── Подключение ── */
.connect-page { display: flex; justify-content: center; padding-top: 8vh; }
.connect-card { width: 100%; max-width: 560px; padding: 24px; gap: 18px; }
.connect-title { display: flex; align-items: center; gap: 14px; }
.connect-title .os { width: 44px; height: 44px; border-radius: 10px; }
.connect-title .os svg.i { width: 26px; height: 26px; }
.connect-title h1 { font-size: 22px; }
.connect-status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(34,139,230,.25); border-top-color: var(--blue); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.dim-on-blue { opacity: .75; font-weight: 500; }

/* Нет записи Passwork */
.nocreds { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--yellow-light); color: var(--yellow-text); cursor: help; }
.nocreds svg.i { width: 15px; height: 15px; }
.conn-btn[disabled] { opacity: .35; cursor: not-allowed; }
/* Список: значки ОС и типа */
td.list-ico { width: 1%; white-space: nowrap; }
td.list-ico .os, td.list-ico .hv-icon { margin-right: 4px; vertical-align: middle; }
.os.sm { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; }
.os.sm svg.i { width: 13px; height: 13px; }

/* Плашка «ОС + тип»: слева ОС, справа тип на затемнённой части (как «аватар + способ подключения») */
.ostype { display: inline-flex; align-items: stretch; height: 30px; border-radius: 8px; overflow: hidden; color: #fff; flex: none; }
.ostype.linux { background: #495057; } .ostype.windows { background: #1c7ed6; }
.ostype .o, .ostype .t { display: inline-flex; align-items: center; justify-content: center; }
.ostype .o { width: 30px; } .ostype .o svg.i { width: 17px; height: 17px; }
.ostype .t { width: 22px; background: rgba(0,0,0,.18); } .ostype .t svg.i { width: 13px; height: 13px; opacity: .9; }
.ostype.sm { height: 22px; border-radius: 6px; vertical-align: middle; } .ostype.sm .o { width: 22px; } .ostype.sm .o svg.i { width: 13px; height: 13px; }
.ostype.sm .t { width: 17px; } .ostype.sm .t svg.i { width: 10px; height: 10px; }
.sv-head .ostype { height: 44px; border-radius: 10px; } .sv-head .ostype .o { width: 44px; } .sv-head .ostype .o svg.i { width: 26px; height: 26px; }
.sv-head .ostype .t { width: 30px; } .sv-head .ostype .t svg.i { width: 17px; height: 17px; }
.hv-head .ostype { height: 44px; border-radius: 10px; } .hv-head .ostype .o { width: 44px; } .hv-head .ostype .o svg.i { width: 24px; height: 24px; }
.hv-head .ostype .t { width: 28px; }
/* Нет записи Passwork: кнопка серая, замок внутри */
.conn-btn.locked, .conn-btn.locked:hover { background: #adb5bd; color: #fff; opacity: 1; cursor: not-allowed; }
.conn-btn.locked .lock { width: 13px; height: 13px; margin-left: 2px; }

/* ── Панель хоста: разделы ВМ и контейнеров, сворачивание ── */
.hv .hv-section { padding: 12px 16px 4px; }
.hv .hv-section + .hv-section { border-top: 1px solid var(--border); }
.hv .hv-section > summary { list-style: none; cursor: pointer; }
.hv .hv-section > summary::-webkit-details-marker { display: none; }
.hv .hv-section:not([open]) { padding-bottom: 12px; }
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--dimmed); letter-spacing: .3px; margin-bottom: 10px; }
.hv-section:not([open]) .sec-title { margin-bottom: 0; }
.sec-title svg.i { width: 15px; height: 15px; }
.sec-title .cnt { background: var(--gray-light); border-radius: 9px; padding: 0 7px; font-size: 11px; }
.sec-title .spacer { flex: 1; }
.sec-title a { text-transform: none; font-weight: 600; letter-spacing: 0; }
.chev { transition: transform .15s; }
details[open] > summary .chev { transform: rotate(90deg); }
.peek { display: inline-flex; gap: 4px; margin-left: 4px; }
details[open] .peek { display: none; }
.hv .hv-section .grid { padding: 0 0 12px; }
.sec-empty { margin: 0 0 12px; }
.hv-toggle { width: 28px; height: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--body); color: var(--dimmed);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.hv-toggle:hover { background: var(--hover); color: var(--text); }
.hv-toggle svg.i { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .15s; }
.hv.collapsed .hv-toggle svg.i { transform: none; }
.hv.collapsed .hv-section { display: none; }
.hv.collapsed .hv-head { border-bottom: 0; }
.hv .when-collapsed { display: none; }
.hv.collapsed .when-collapsed { display: inline; }

/* Цветной значок Copilot в плашке сессии — на белом кружке */
.who .badge-ic { width: 20px; height: 20px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; }
.who .badge-ic svg.i { width: 14px; height: 14px; }
.tl .lead { display: flex; align-items: flex-start; }

/* До двух панелей хостов в ряд на широком экране; уже — друг под другом */
.hv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.hv-grid > .hv { margin-bottom: 0; min-width: 0; }
@media (min-width: 1500px) { .hv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Список: строка хоста — заголовок группы, сворачивается */
table.hosts tr.host-row td { background: var(--surface); }
table.hosts td.list-ico { white-space: nowrap; }
.hv-toggle.sm { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin-right: 6px; vertical-align: middle; }
.hv-toggle.sm svg.i { width: 12px; height: 12px; }
tbody.host.collapsed .hv-toggle svg.i { transform: none; }
tbody.host.collapsed tr:not(.host-row) { display: none; }
tbody.host .when-collapsed { display: none; }
tbody.host.collapsed .when-collapsed { display: inline; }
tbody.host.collapsed .peek.when-collapsed { display: inline-flex; }
tbody.host tr:not(.host-row) td.list-ico { padding-left: 40px; } /* под значком хоста, правее кнопки сворачивания */
table.hosts tbody + tbody tr:first-child td { border-top: 1px solid var(--border); }
