:root {
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #fbfaf7;
    --text: #2c2c2a;
    --muted: #6b6a65;
    --border: #e2e0d8;
    --border-strong: #c9c7bd;
    --accent: #534ab7;
    --ok: #3b7d11;
    --warn: #a86507;
    --down: #b3261e;
    --fo: #6a60cc;
    --fb: #2f7fd0;
    --mt: #888780;
    --edge: #d85a30;
    --core: #1d9e75;
    --copy: #ba7517;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1b1b19;
        --surface: #242422;
        --surface-2: #2c2c29;
        --text: #ecebe6;
        --muted: #a3a29b;
        --border: #3a3a36;
        --border-strong: #55554f;
        --accent: #a9a3f0;
        --ok: #8fc95a;
        --warn: #efa93b;
        --down: #f07a72;
        --fo: #a9a3f0;
        --fb: #7ab6ee;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 "Segoe UI", system-ui, -apple-system, sans-serif;
}

h1 { font-size: 22px; font-weight: 500; margin: 0 0 14px; }
a { color: var(--accent); }
code { font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.brand { font-size: 18px; font-weight: 500; }
.brand-sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
    border: 1px solid transparent;
    color: var(--text);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 8px;
}
.side nav a:hover { background: var(--surface-2); }
.side nav a.active { background: var(--surface-2); border-color: var(--border-strong); color: var(--accent); font-weight: 500; }
.who { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); font-size: 14px; }
.who form { margin-top: 8px; }
/* Р100: never the page's scroll anchor. It stands at the bottom of the full-height menu, and on a page scrolled to its end
   the browser held it in place as the page grew: a node picked at the bottom of the map (DNS, then b1) threw the page
   1188 px down to the panel under it, the map out of sight. */
.who { overflow-anchor: none; }
.content { padding: 22px 26px; min-width: 0; }

@media (max-width: 760px) {
    /* minmax(0, …): a plain 1fr took the width of the widest unbreakable row (the menu, a tab bar) and widened the page. */
    .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .side { border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; min-width: 0; }
    .content { padding: 16px; }
    /* Р86: on a phone the menu was a column of links a screen high above the page - one scrolling row now, the user a
       line under it. Settings tabs and tables in cards scroll sideways inside themselves, not the whole page. */
    .brand-sub { display: none; }
    .side nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
    .side nav a { white-space: nowrap; }
    .who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding-top: 8px; margin-top: 6px; }
    .who form { margin-top: 0; }
    .tabs { overflow-x: auto; scrollbar-width: none; }
    .tabs a { white-space: nowrap; }
    .card:has(> table.grid), details.card { overflow-x: auto; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}
.card.flush { padding: 0; overflow-x: auto; }

.banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 9px 14px;
    margin-bottom: 14px;
}
.banner.ok::first-letter { color: var(--ok); }
.banner.warn::first-letter { color: var(--warn); }
.banner.down::first-letter { color: var(--down); }
.banner.unknown::first-letter { color: var(--mt); }
/* The result of an action is scrolled into view when it is off-screen (ResultBanner.razor, Р100): a little room above it,
   and what the page shows right under it (a one-time password, "Остановить принудительно") stays in view too. */
.banner[role="status"] { scroll-margin: 12px 0 96px; }

.btn {
    font: inherit;
    font-size: 14px;
    padding: 6px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn.small { font-size: 13px; padding: 3px 10px; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 14px; }
.page-head .btn { margin-bottom: 14px; }

/* map */
.map-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 400px); gap: 14px; align-items: start; }
/* Р100: the one column of a narrow screen is minmax(0, 1fr) here and in the grids below - a plain 1fr is at least as wide
   as its widest unbreakable content: a long client's name in a select made «Новая ВМ» 629 px wide on a 375-px phone. */
@media (max-width: 1000px) { .map-grid { grid-template-columns: minmax(0, 1fr); } }
/* Р100: the node's card goes down the page with the map - it sat at the top of its column, and a click on b1 at the bottom
   of a map taller than the screen filled a card out of sight (at −947…−639 px on a 1536×730 screen). A card longer than the
   screen scrolls inside itself. On a narrow screen it is under the map, and the page brings it into view (Map.razor). */
@media (min-width: 1001px) { .map-grid > .card:last-child { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; } }
svg.map { width: 100%; height: auto; display: block; }
.node { cursor: pointer; }
.node rect { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.5; }
.node.sel rect { stroke-width: 3; }
.node .n-name { fill: var(--text); font-size: 14px; font-weight: 500; text-anchor: middle; }
.node .n-status { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.node circle { fill: var(--mt); }
.node.st-ok rect, .node.st-ok circle { stroke: var(--ok); }
.node.st-ok circle { fill: var(--ok); }
.node.st-warn rect { stroke: var(--warn); } .node.st-warn circle { fill: var(--warn); } .node.st-warn .n-status { fill: var(--warn); }
.node.st-down rect { stroke: var(--down); stroke-dasharray: 5 3; } .node.st-down circle { fill: var(--down); } .node.st-down .n-status { fill: var(--down); }
.node.st-fo rect { stroke: var(--fo); stroke-dasharray: 5 3; } .node.st-fo circle { fill: var(--fo); } .node.st-fo .n-status { fill: var(--fo); }
.node.st-fb rect { stroke: var(--fb); } .node.st-fb circle { fill: var(--fb); } .node.st-fb .n-status { fill: var(--fb); }
.node .n-status.tw-start { font-weight: 600; text-decoration: underline; } /* Р157 stage 5: a cell down - its twins start from the card */
.node.st-mt rect { stroke: var(--mt); }
/* Hosts and disks are buttons for the keyboard too (Р96): the focus is drawn on the box itself, over its state's colour,
   not as a square around it. */
.node:focus-visible, .dk:focus-visible { outline: none; }
.node:focus-visible > rect { stroke: var(--accent); stroke-width: 3; stroke-dasharray: none; }
.link { stroke-width: 1.5; fill: none; }
.link.core { stroke: var(--core); }
.link.backup { stroke: var(--copy); }
.link.edge { stroke: var(--edge); stroke-dasharray: 5 4; }
.link.dns { stroke: var(--mt); stroke-dasharray: 2 4; }
.link.pcie { stroke: var(--border-strong); stroke-width: 5; stroke-linecap: round; }
.link.down { stroke: var(--down); stroke-dasharray: 3 3; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; background: var(--mt); }
.legend .line { display: inline-block; width: 22px; height: 0; margin-right: 5px; vertical-align: middle; border-top: 2px solid; }
.legend .line.edge { border-top: 2px dashed var(--edge); }
.legend .line.core { border-top-color: var(--core); }
.legend .line.backup { border-top-color: var(--copy); }
.legend .line.dns { border-top: 2px dotted var(--mt); }
.legend .line.pcie { border-top: 4px solid var(--border-strong); }
.legend .disk-ico {
    display: inline-block; width: 9px; height: 13px; margin-right: 5px; vertical-align: -2px; border-radius: 2px;
    border: 1.5px solid var(--border-strong); background: linear-gradient(to top, var(--s1) 45%, var(--surface) 45%);
}
.dot.st-ok { background: var(--ok); } .dot.st-warn { background: var(--warn); } .dot.st-down { background: var(--down); }
.dot.st-fo { background: var(--fo); } .dot.st-fb { background: var(--fb); } .dot.st-mt { background: var(--mt); }

.state { font-size: 13px; white-space: nowrap; }
.state.st-ok { color: var(--ok); } .state.st-warn { color: var(--warn); } .state.st-down { color: var(--down); }
.state.st-fo { color: var(--fo); } .state.st-fb { color: var(--fb); }
/* Text in --mt was 3.6:1 on white - "выключена", "нет данных" read poorly; --muted is 5.4:1 (Р86), as .pill.st-mt. */
.state.st-mt, .state.st-unknown { color: var(--muted); }

.nc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nc-title { font-size: 17px; font-weight: 500; }
.props { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 10px 0 0; font-size: 14px; }
.props dt, .props dd { padding: 5px 0; border-bottom: 1px solid var(--border); margin: 0; }
.props dt { color: var(--muted); padding-right: 12px; }
.props dd { text-align: right; overflow-wrap: anywhere; }
.nc-back { margin-top: 12px; }
/* The map's quick actions under the node's card (Р115): a button and, beside it, what it does or why it is off. */
.na { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-strong); }
.na-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.na-facts { margin: 0 0 10px; padding-left: 18px; }
.na-facts li { margin: 2px 0; }
.na-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.na-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; justify-items: start; }
.na-row .btn { white-space: nowrap; }
.na-confirm { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.na-confirm .fld input { max-width: 360px; }
/* Р157 stage 5: the cell's VMs in «Запустить двойники» - a checkbox and two lines each, fits the narrow card and a phone. */
.tw-vms { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tw-vm { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; overflow-wrap: anywhere; }
.tw-vm input { margin-top: 3px; }
.tw-vm .block, .na .block { display: block; }
.tw-vm.off { color: var(--muted); }
.na-facts.tw-plain { list-style: none; padding-left: 0; }

/* forms */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-grid .card { display: flex; flex-direction: column; gap: 8px; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.fld input, .fld select, .fld textarea {
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 7px 10px;
    min-width: 0;
}
.fld-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.suffix-input { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.suffix-input input { border: 0; border-radius: 0; flex: 1; }
.suffix-input > span { padding: 7px 10px; color: var(--muted); border-left: 1px solid var(--border); white-space: nowrap; }
.req { color: var(--down); }
.ok-line { color: var(--ok); font-size: 14px; }
dd.fit { color: var(--ok); }
dd.nofit { color: var(--muted); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.steps { list-style: none; padding: 0; margin: 6px 0; font-size: 14px; }
.steps li { padding: 3px 0; }
.steps li.done { color: var(--ok); }
.steps li.now { color: var(--fb); font-weight: 500; }
.steps li.todo { color: var(--muted); }
a.btn { text-decoration: none; display: inline-block; }
.btn.danger { border-color: var(--down); color: var(--down); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.inline-form { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.danger-zone { border-color: var(--down); }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 6px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.settings-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 14px; }

/* event log */
h2.section { font-size: 17px; font-weight: 500; margin: 22px 0 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
/* Р100: a select in a table (a user's role) and the network page's filters look the same - they were the browser's bare
   19-px controls, a small target for a finger. */
.filters select, .filters input, table.grid select, .ln-filter {
    font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 9px;
}
.filters input { flex: 1; min-width: 220px; }
table.events tr.ev { cursor: pointer; }
table.events tr.ev:hover td { background: var(--surface-2); }
table.events tr.ev-down td:first-child { box-shadow: inset 3px 0 0 var(--down); }
table.events tr.ev-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
table.events tr.ev-details td { background: var(--surface-2); }
table.events pre {
    white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 6px 0 0;
    font-family: Consolas, "Cascadia Mono", monospace; max-height: 420px; overflow: auto;
}
.nowrap { white-space: nowrap; }

/* tables */
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-weight: 500; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.grid tr:last-child td { border-bottom: 0; }
/* A sortable column's header (SortHeader.razor, Р96): a button that looks like the header's text. */
.th-sort { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.th-sort:hover, th[aria-sort] .th-sort { color: var(--text); }
.sort-mark { display: inline-block; width: 1em; margin-left: 2px; font-size: 10px; text-align: center; }
/* Sorting and filtering of every list (table-tools.js): headers that sort on a click, the filter row under them. */
table.tt-sortable thead tr:first-child th[tabindex] { cursor: pointer; user-select: none; }
table.tt-sortable thead tr:first-child th[tabindex]:hover, table.tt-sortable th[aria-sort] { color: var(--text); }
table.grid tr.tt-filter th { padding: 4px 6px 6px; }
table.grid tr.tt-filter input {
    width: 100%; min-width: 60px; box-sizing: border-box; font: inherit; font-size: 12px; font-weight: 400;
    color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px;
}
table.grid tr.tt-filter input:not(:placeholder-shown) { border-color: var(--accent, var(--border-strong)); }
table.grid tr[hidden] { display: none; }

/* sign-in */
.bare { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card.login { width: 100%; max-width: 360px; padding: 26px; }
.card.login .brand { font-size: 22px; }
.card.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.card.login label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.card.login input {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
}
.card.login label.remember { flex-direction: row; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.card.login .remember input { width: 16px; height: 16px; margin: 0; padding: 0; }
.card.login .btn { margin-top: 6px; padding: 8px; }
.card.login .banner { margin: 14px 0 0; }
/* The code step (Р77): the hint above the form, "send again" and "another user" under it. */
.card.login p { margin: 14px 0 0; }
.card.login form.code-more { margin-top: 8px; gap: 6px; align-items: center; }
/* The code step keeps its forms on the page when the sign-in is gone, hidden (Р97): "display: flex" above would show them. */
.card.login form[hidden] { display: none; }
.field-error, .validation-message { color: var(--down); font-size: 13px; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 10px 18px;
    background: var(--surface);
    border-top: 1px solid var(--down);
    z-index: 10;
}

/* VM health and load (З46) */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --grid: #e9e7df; }
@media (prefers-color-scheme: dark) { :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --grid: #33332f; } }
.health-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 12px; }
.health-head .state { font-size: 15px; font-weight: 500; }
.problems { flex-basis: 100%; margin: 4px 0 0; padding-left: 20px; font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 20px; font-weight: 500; line-height: 1.3; }
.tile-value.state { font-size: 15px; }
.fs-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
dl.mini { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: 14px; }
dl.mini dt { color: var(--muted); padding: 1px 12px 1px 0; }
dl.mini dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.warn-text { color: var(--warn); font-weight: 500; }
.ok-text { color: var(--ok); font-weight: 500; }
/* Р268: an on/off switch - a checkbox drawn as a slider (the 1C key server's mark) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; margin: 6px 0; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 10px;
    background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; }
.switch input::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::before { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: default; }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.netkey .lic-list .btn { margin-left: 8px; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter.compact { height: 5px; width: 56px; }
.meter-fill { height: 100%; background: var(--s1); border-radius: 3px; }
.meter-fill.warn { background: var(--warn); }
.meter-fill.crit { background: var(--down); }
.loadbars { display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 1px 6px; font-size: 12px; }
.lb-label { color: var(--muted); }
.lb-val { font-variant-numeric: tabular-nums; text-align: right; }
td.load-cell { padding-top: 5px; padding-bottom: 5px; }

.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; margin: 12px 0 10px; }
.seg button { font: inherit; font-size: 13px; padding: 4px 11px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--surface-2); color: var(--text); font-weight: 500; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.mchart-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 6px; min-width: 0; }
.mchart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.mchart-title { font-size: 14px; font-weight: 500; }
.mchart-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.key { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--s1); vertical-align: middle; margin-right: 5px; }
.key.s2 { border-top-color: var(--s2); } .key.s3 { border-top-color: var(--s3); }
.mchart { position: relative; padding-left: 58px; padding-bottom: 18px; }
.mchart svg { display: block; width: 100%; height: 150px; overflow: visible; }
.mchart .grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mchart .refline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.mchart .line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mchart .line.s2 { stroke: var(--s2); } .mchart .line.s3 { stroke: var(--s3); }
.mchart .xhair { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; visibility: hidden; }
.mchart-y { position: absolute; left: 0; top: 0; width: 54px; height: 150px; font-size: 11px; color: var(--muted); }
.mchart-y span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mchart-x { position: absolute; left: 58px; right: 0; bottom: 0; height: 16px; font-size: 11px; color: var(--muted); }
.mchart-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.mchart-tip { position: absolute; top: 4px; margin-left: 58px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 9px; font-size: 12px; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.12); z-index: 2; white-space: nowrap; }
.mchart-tip .tip-time { color: var(--muted); margin-bottom: 2px; }
.mchart-tip .tip-row b { font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums; }
.mchart-tip .tip-row span { color: var(--muted); }
.mchart-empty { height: 150px; display: flex; align-items: center; justify-content: center; }

/* Proxmox host load on the map */
.node .bar-label, .node .bar-val { fill: var(--muted); font-size: 11px; }
.node .bar-val { text-anchor: end; font-variant-numeric: tabular-nums; }
.node .bar rect.bar-bg { fill: var(--surface); stroke: var(--border); stroke-width: 1; stroke-dasharray: none; }
.node .bar rect.bar-fill { fill: var(--s1); stroke: none; }
.node .bar rect.bar-fill.warn { fill: var(--warn); }

/* physical disks hanging under a host on the map */
.disks { cursor: pointer; }
.disks .dk-hang, .disks .dk-bus { stroke: var(--border-strong); stroke-width: 1.5; }
.disks .dk-bus { stroke-width: 3; stroke-linecap: round; }
.dk .dk-body { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.dk:hover .dk-body { stroke-width: 2; }
.dk.dk-warn .dk-body { stroke: var(--warn); stroke-width: 1.8; }
.dk.dk-down .dk-body { stroke: var(--down); stroke-width: 2.2; stroke-dasharray: 4 2; }
.dk.sel .dk-body { stroke: var(--accent); stroke-width: 2.6; stroke-dasharray: none; }
.dk:focus-visible .dk-body { stroke: var(--accent); stroke-width: 2.6; stroke-dasharray: none; }
.dk .dk-type { fill: var(--muted); font-size: 8px; font-weight: 600; text-anchor: middle; }
.dk .dk-led { fill: var(--mt); stroke: var(--surface); stroke-width: 1.5; }
.dk.dk-ok .dk-led { fill: var(--ok); } .dk.dk-warn .dk-led { fill: var(--warn); } .dk.dk-down .dk-led { fill: var(--down); }
.dk .dk-tank { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.dk .dk-level { fill: var(--s1); }
.dk .dk-level.warn { fill: var(--warn); } .dk .dk-level.crit { fill: var(--down); }
.dk .dk-life-bg { fill: var(--border); }
.dk .dk-life { fill: var(--ok); } .dk .dk-life.warn { fill: var(--warn); } .dk .dk-life.down { fill: var(--down); }
.dk .dk-pct { fill: var(--text); font-size: 10.5px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.dk .dk-size { fill: var(--muted); font-size: 9.5px; text-anchor: middle; }

/* VMs as small two-unit servers inside their host's box on the map */
.vms .vm-label { fill: var(--muted); font-size: 11px; }
.vmi { cursor: pointer; }
.vmi .vmi-u { fill: var(--surface); stroke: var(--ok); stroke-width: 1.2; }
.vmi .vmi-led { fill: var(--ok); }
.vmi .vmi-id { fill: var(--muted); font-size: 9px; text-anchor: middle; font-variant-numeric: tabular-nums; }
/* the VMID on the icon itself - a VM and its twin carry the same number */
.vmi-n { fill: var(--text); font-size: 8.5px; text-anchor: middle; font-variant-numeric: tabular-nums; letter-spacing: -.2px; pointer-events: none; }
.vmi.vmi-off .vmi-n, .vmi.vmi-del .vmi-n { fill: var(--muted); } .vmi.vmi-del .vmi-n { text-decoration: line-through; }
.vmi.vmi-away .vmi-n { fill: var(--fo); }
.vmt .vmi-n { fill: var(--muted); } .vmt.tw-lag .vmi-n { fill: var(--warn); } .vmt.tw-old .vmi-n { fill: var(--down); }
.vmi .vmi-fo { fill: var(--fo); font-size: 8px; }
.vmt-orphans text { font-size: 10.5px; } .vmt-orphans { cursor: help; }
.vmi.vmi-warn .vmi-u { stroke: var(--warn); } .vmi.vmi-warn .vmi-led, .vmi.vmi-warn .vmi-id { fill: var(--warn); }
.vmi.vmi-down .vmi-u { stroke: var(--down); stroke-width: 1.6; } .vmi.vmi-down .vmi-led, .vmi.vmi-down .vmi-id { fill: var(--down); }
.vmi.vmi-off .vmi-u { fill: var(--surface-2); stroke: var(--border-strong); } .vmi.vmi-off .vmi-led { fill: var(--border-strong); }
.vmi.vmi-del { opacity: .55; }
.vmi.vmi-del .vmi-u { fill: none; stroke: var(--mt); stroke-dasharray: 2 1.5; } .vmi.vmi-del .vmi-led { fill: none; }
.vmi.vmi-del .vmi-id { text-decoration: line-through; }
/* R93: the stopped copy of a VM that runs on a reserve now */
.vmi.vmi-away .vmi-u { fill: none; stroke: var(--fo); stroke-dasharray: 3 1.5; } .vmi.vmi-away .vmi-led, .vmi.vmi-away .vmi-id { fill: var(--fo); }
/* Р157: a VM's twin - a dotted outline, no lights (it is a stopped copy, not a VM to switch on); colour - freshness */
.vmt { cursor: pointer; }
.vmt .vmt-u { fill: none; stroke: var(--ok); stroke-width: 1.1; stroke-dasharray: 1.2 1.2; }
.vmt.tw-lag .vmt-u { stroke: var(--warn); } .vmt.tw-lag .vmi-id { fill: var(--warn); }
.vmt.tw-old .vmt-u { stroke: var(--down); } .vmt.tw-old .vmi-id { fill: var(--down); }
.vmt.tw-seeding .vmt-u { stroke: var(--fb); stroke-dasharray: none; } .vmt.tw-seeding .vmi-n { fill: var(--fb); }
.vmt.tw-leaving { opacity: .55; } .vmt.tw-leaving .vmt-u { stroke: var(--border-strong); stroke-dasharray: 2 1.5; }
.vmt.tw-orphan { opacity: .55; } .vmt.tw-orphan .vmt-u { stroke: var(--border-strong); stroke-dasharray: 2 1.5; }
/* the pair under the pointer: the VM and its twin, on two hosts */
.vmi.pair .vmi-u, .vmt.pair .vmt-u { stroke: var(--accent, var(--text)); stroke-width: 2.2; }
.vmi.pair .vmi-n, .vmt.pair .vmi-n { fill: var(--text); font-weight: 600; }
.vmt:hover .vmt-u { stroke-width: 1.8; } .vmt:hover .vmi-id { fill: var(--text); }
/* the mark in a VM's corner: the state of its twin */
.vmi .vmi-tw { stroke: var(--surface); stroke-width: 1; fill: var(--ok); }
.vmi .vmi-tw.tw-lag { fill: var(--warn); } .vmi .vmi-tw.tw-old, .vmi .vmi-tw.tw-none { fill: var(--down); }
.legend .vm-ico.twin { border-style: dotted; background: none; }
.legend .dot.tw-mark { background: var(--down); }
.vmi:hover { opacity: 1; }
.vmi:hover .vmi-u { stroke-width: 2; }
.vmi:hover .vmi-id { fill: var(--text); }
.legend .vm-ico {
    display: inline-block; width: 12px; height: 10px; margin-right: 5px; vertical-align: -1px; border-radius: 2px;
    border: 1.5px solid var(--ok); background: linear-gradient(to bottom, transparent 38%, var(--ok) 38%, var(--ok) 58%, transparent 58%);
}
dl.mini dt.sub, dl.mini dd.sub { font-size: 12px; color: var(--muted); padding-left: 10px; }
.down-text { color: var(--down); font-weight: 500; }

/* Reconnect dialog (App.razor, panel.js): one text at a time, picked by Blazor's classes on the dialog. */
dialog.reconnect {
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    padding: 20px 24px;
    width: min(380px, calc(100vw - 32px));
    box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
dialog.reconnect::backdrop { background: rgba(0, 0, 0, .35); }
dialog.reconnect p { margin: 0 0 12px; }
.reconnect .rc-first, .reconnect .rc-repeat, .reconnect .rc-failed, .reconnect .rc-paused,
.reconnect .rc-resume-failed, .reconnect .rc-spinner { display: none; }
.reconnect.components-reconnect-show .rc-spinner { display: block; }
.reconnect.components-reconnect-show:not(.components-reconnect-retrying) p.rc-first,
.reconnect.components-reconnect-retrying p.rc-repeat,
.reconnect.components-reconnect-failed p.rc-failed,
.reconnect.components-reconnect-paused p.rc-paused,
.reconnect.components-reconnect-resume-failed p.rc-resume-failed { display: block; }
.reconnect.components-reconnect-failed button.rc-failed,
.reconnect.components-reconnect-paused button.rc-paused,
.reconnect.components-reconnect-resume-failed button.rc-resume-failed { display: inline-block; }
.rc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-spinner {
    width: 26px; height: 26px; margin-bottom: 12px;
    border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
    animation: rc-spin .9s linear infinite;
}
@keyframes rc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rc-spinner { animation-duration: 3s; } }

/* VM list: filter and summary above the table */
.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.list-filter {
    font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 9px; flex: 0 1 340px; min-width: 200px;
}

/* VM page: head, actions, tabs, overview, published ports */
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.icon.muted { color: var(--muted); }
.icon-btn {
    display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
    border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn.done { color: var(--ok); }
.icon-btn.danger:hover:not(:disabled) { color: var(--down); }
.btn.ico { display: inline-flex; align-items: center; gap: 7px; }
.btn.solid { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.solid:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn.on { background: var(--surface-2); border-color: var(--text); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--down) 8%, var(--surface)); }
.spin {
    display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 6px;
    border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
    animation: rc-spin .9s linear infinite;
}
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 2px; }
.form-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 700px) { .form-2, .fld-row { grid-template-columns: minmax(0, 1fr); } }

.crumbs { margin: -8px 0 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.vm-head {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px 28px;
    padding: 18px 20px; margin-bottom: 14px;
}
.vm-head-main { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.vm-title-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.vm-title { margin: 0 6px 0 0; font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.vm-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.vm-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; font-size: 14px; color: var(--muted); }
.vm-facts b { color: var(--text); font-weight: 500; }
.vm-ip { display: inline-flex; align-items: center; gap: 2px; color: var(--text); }
.vm-actions { flex: 0 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vm-actions .sep { width: 1px; height: 24px; background: var(--border); margin: 0 2px; }
@media (min-width: 1100px) { .vm-actions { justify-content: flex-end; } }

.pill {
    display: inline-flex; align-items: center; gap: 7px; font-size: 13px; line-height: 1; padding: 5px 11px;
    border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
    white-space: nowrap; text-decoration: none;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.st-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 28%, var(--surface)); }
.pill.st-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 28%, var(--surface)); }
.pill.st-down { color: var(--down); background: color-mix(in srgb, var(--down) 10%, var(--surface)); border-color: color-mix(in srgb, var(--down) 28%, var(--surface)); }
.pill.st-fb { color: var(--fb); background: color-mix(in srgb, var(--fb) 10%, var(--surface)); border-color: color-mix(in srgb, var(--fb) 28%, var(--surface)); }
.pill.st-mt, .pill.st-unknown { color: var(--muted); }
a.pill:hover { filter: brightness(.97); }

.vm-tabs {
    position: sticky; top: 0; z-index: 3; display: flex; gap: 2px; margin: 0 0 16px; padding-top: 4px;
    background: var(--bg); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.vm-tabs a {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; margin-bottom: -1px;
    color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 14px; border-bottom: 2px solid transparent;
}
.vm-tabs a:hover { color: var(--text); }
.vm-tabs a.active { color: var(--text); font-weight: 500; border-bottom-color: var(--accent); }
/* Р110: a move to the reserve or back runs - the «Резерв» title blinks until it ends. */
.vm-tabs a.tab-busy { color: var(--accent); animation: tab-blink 1.2s ease-in-out infinite; }
@keyframes tab-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .vm-tabs a.tab-busy { animation: none; text-decoration: underline dotted; } }
.tab-count {
    font-size: 12px; line-height: 1; padding: 3px 7px; border-radius: 999px; font-weight: 500;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.vm-tabs a.active .tab-count { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: transparent; color: var(--accent); }
.vm-pane > h2.section:first-child { margin-top: 0; }
/* A tab's answer brought into view (ResultBanner, Р100) clears the sticky tabs above it (46 px), not only the page top. */
.vm-pane .banner[role="status"] { scroll-margin-top: 58px; }

.qtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 12px; margin-bottom: 14px; }
.qtile {
    display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: inherit;
    background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, box-shadow .15s;
}
.qtile:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0, 0, 0, .06); }
.qtile-label { font-size: 13px; color: var(--muted); }
.qtile-value { font-size: 16px; font-weight: 500; }
.vm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; align-items: start; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.card-title:last-child { margin-bottom: 0; }
.subhead { font-size: 14px; font-weight: 600; margin: 16px 0 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.secret { display: inline-flex; align-items: center; gap: 2px; }
.create-card { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress-fill { height: 100%; background: var(--fb); border-radius: 3px; transition: width .4s; }

/* ProgressBar.razor: transfers and downloads. A light sheen runs over the fill while it is not full. */
.pbar { display: flex; flex-direction: column; gap: 4px; min-width: 160px; max-width: 520px; margin: 6px 0; }
.pbar-row { display: flex; align-items: center; gap: 10px; }
.pbar-track {
    position: relative; flex: 1; height: 10px; border-radius: 999px; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--border); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06);
}
.pbar-fill {
    position: relative; height: 100%; min-width: 4px; border-radius: 999px; overflow: hidden;
    background: linear-gradient(90deg, color-mix(in srgb, var(--fb) 70%, var(--accent)), var(--fb));
    transition: width .6s ease;
}
.pbar-fill::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
    transform: translateX(-100%); animation: pbar-sheen 1.8s ease-in-out infinite;
}
.pbar-fill.full { background: var(--ok); }
.pbar-fill.full::after { animation: none; }
.pbar-track.indeterminate::before {
    content: ""; position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--fb), transparent);
    animation: pbar-slide 1.4s ease-in-out infinite;
}
.pbar-pct { min-width: 44px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.pbar-caption { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pbar-label { color: var(--text); margin-right: 6px; }
.pbar.compact { margin: 4px 0 0; }
.pbar.compact .pbar-track { height: 7px; }
.pbar.compact .pbar-pct { font-size: 12px; min-width: 36px; }
@keyframes pbar-sheen { to { transform: translateX(100%); } }
@keyframes pbar-slide { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
    .pbar-fill::after { animation: none; }
    .pbar-track.indeterminate::before { animation-duration: 4s; }
}

.ports-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.proto {
    display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 2px 7px; margin-right: 4px; border-radius: 6px;
    color: var(--fb); background: color-mix(in srgb, var(--fb) 12%, var(--surface));
}
.proto.udp { color: var(--core); background: color-mix(in srgb, var(--core) 12%, var(--surface)); }
.addr { display: inline-flex; align-items: center; gap: 2px; }
.addr b { font-weight: 600; }
table.ports td { vertical-align: middle; }
.row-actions { text-align: right; }
.port-form { border-color: var(--accent); }
.check-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 30px; font-size: 14px; }
.check-line.ok { color: var(--ok); }
.check-line.bad { color: var(--down); }
.check-line .btn { margin-left: 4px; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty-title { color: var(--text); font-weight: 500; margin-bottom: 4px; }
details.hint { margin-top: 12px; }
details.hint summary { cursor: pointer; color: var(--muted); font-size: 13px; width: max-content; max-width: 100%; }
details.hint summary:hover { color: var(--text); }
.callout { margin-top: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.callout .block { display: block; margin-top: 6px; }
/* Blazor focuses the page heading after a navigation (FocusOnNavigate): no ring around a heading. */
h1:focus { outline: none; }

/* Client card (З35): a field over the whole row, a multi-line note. */
.fld.wide { flex: 1 1 100%; }
.fld textarea { resize: vertical; }

/* Prices and packages (Р85): the "Тарифы" page, the package picker and the price card of the VM forms */
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section-title { font-size: 17px; font-weight: 500; margin: 22px 0 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid th.num, table.grid td.num { text-align: right; }
.ok-num { color: var(--ok); }
.warn-num { color: var(--warn); }
.bad-num { color: var(--down); }
.fld-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fld-check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }
.fld-check input { width: 16px; height: 16px; margin: 3px 0 0; flex: none; }

.plan-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-opt {
    display: flex; flex-direction: column; align-items: flex-start; min-width: 120px; padding: 6px 10px;
    border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text);
    font: inherit; font-size: 13px; line-height: 1.4; text-align: left; cursor: pointer;
}
.plan-opt:hover:not(:disabled) { border-color: var(--accent); }
.plan-opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.plan-opt:disabled { opacity: .55; cursor: not-allowed; }
.plan-opt-name { font-weight: 600; }
.plan-opt.featured .plan-opt-name::after { content: " ★"; color: var(--accent); }
.plan-opt-price { font-variant-numeric: tabular-nums; }
.plan-opt-meta { color: var(--muted); font-size: 12px; }
.plan-opt-why { color: var(--warn); font-size: 12px; }

.price-box { display: flex; flex-direction: column; gap: 6px; }
.price-total { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
.price-num { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.price-delta { font-size: 13px; }
.price-delta.up { color: var(--warn); }
.price-delta.down { color: var(--ok); }
.price-lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.price-lines td { padding: 4px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.price-lines td.qty { color: var(--muted); padding: 4px 10px; white-space: nowrap; }
.price-lines td.num { text-align: right; }
.price-hint {
    display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap;
    padding: 7px 10px; border: 1px dashed var(--accent); border-radius: 8px; font-size: 13px;
}
.resize-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .resize-grid { grid-template-columns: minmax(0, 1fr); } }

.pricing-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .pricing-grid { grid-template-columns: minmax(0, 1fr); } }
.pricing-grid .card { display: flex; flex-direction: column; gap: 8px; }
.price-table td { vertical-align: top; }
.included { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.included li + li { margin-top: 2px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; }
.plan-card.featured { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-price { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan-specs { list-style: none; margin: 2px 0; padding: 0; font-size: 14px; }
.plan-specs li { padding: 2px 0; border-bottom: 1px solid var(--border); }
/* Р88: the price sits at the bottom of the card, level across the row. */
.plan-card .plan-foot { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.plan-card .form-actions { padding-top: 6px; }
@media (max-width: 700px) { .fld-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* VM list on a phone: only the number, the name and the cell fitted before a sideways scroll. The secondary columns
   (Vms.razor, class "opt") are dropped at the phone layout's width; the VM's own page has them all. */
@media (max-width: 760px) {
    table.grid th.opt, table.grid td.opt { display: none; }
    /* Р100: a table in a card that scrolls sideways was as wide as its longest unbroken line. A state wraps («● внимание:
       диск данных заполнен на 91 %» held the VM list's health column at 285 px); file and user names break anywhere.
       Both keep 12 characters of width: a table wider than its card gives every column only its narrowest, and that was
       a lone "●" over one word a line. */
    table.grid td .state { white-space: normal; display: inline-block; min-width: 12ch; }
    table.grid td.mono, table.grid td .mono, table.grid td .wrap-any { overflow-wrap: anywhere; min-width: 12ch; }
    /* Below 16 px iOS Safari zooms the page in on a field's focus and leaves it zoomed. */
    input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px !important; }
    /* A sort header's button covers its whole cell, not only its 22-px line of text. */
    table.grid th .th-sort { padding: 9px 12px; margin: -9px -12px; }
}

/* --- Р111: the client's cabinet --- */
.cab-shell { min-height: 100vh; display: flex; flex-direction: column; }
.cab-bar {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px 24px;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.cab-brand { font-weight: 600; font-size: 17px; color: var(--text); text-decoration: none; }
.cab-brand .muted { font-weight: 400; font-size: 14px; }
.cab-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.cab-nav a { padding: 6px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.cab-nav a:hover { background: var(--surface-2); }
.cab-nav a.active { background: var(--surface-2); color: var(--accent); font-weight: 500; }
.cab-who { display: flex; align-items: center; gap: 10px; }
.cab-who form { margin: 0; }
.cab-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 24px 48px; }
.cab-foot { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 24px 24px; }
.cab-h2 { font-size: 17px; font-weight: 600; margin: 22px 0 10px; }
.cab-tiles { margin-bottom: 8px; }
.cab-list { display: flex; flex-direction: column; gap: 10px; }
.cab-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cab-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cab-vm { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.cab-vm:hover { border-color: var(--accent); }
.cab-vm-name { font-weight: 600; }
.cab-order { display: flex; flex-direction: column; gap: 8px; }
.cab-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.cab-form .cab-h2 { margin-top: 10px; }
.cab-narrow { max-width: 480px; display: flex; flex-direction: column; gap: 10px; }
.cab-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cab-name input { flex: 1 1 200px; min-width: 0; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; }
.cab-base { padding: 8px 0; border-bottom: 1px solid var(--border); }
.cab-facts dd { text-align: left; }
.cab-done { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }

.cab-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 10px; }
.cab-plan {
    position: relative; display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; cursor: pointer;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; font: inherit;
}
.cab-plan:hover:not(:disabled) { border-color: var(--accent); }
.cab-plan.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface-2); }
.cab-plan:disabled { opacity: .5; cursor: not-allowed; }
.cab-plan-name { font-weight: 600; }
.cab-plan-meta { font-size: 13px; color: var(--muted); }
.cab-plan-price { font-size: 18px; font-weight: 600; margin-top: auto; padding-top: 4px; font-variant-numeric: tabular-nums; }
.cab-plan-why { font-size: 12px; color: var(--warn); }
.cab-plan-tag { position: absolute; top: -9px; right: 10px; font-size: 11px; padding: 0 8px; border-radius: 9px;
    background: var(--accent); color: var(--surface); }

.cab-config { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; margin-top: 14px; align-items: start; }
.cab-fields { display: flex; flex-direction: column; gap: 10px; }
.cab-field { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 2px 12px; align-items: center; }
.cab-field-title { font-size: 14px; }
.cab-field-price { grid-column: 1 / -1; }
.cab-stepper { display: flex; align-items: center; gap: 6px; }
.cab-stepper .btn { width: 34px; padding: 4px 0; text-align: center; }
.cab-stepper .muted { width: 36px; }
.cab-stepper input { width: 84px; padding: 6px 8px; text-align: right; border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.cab-price { position: sticky; top: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.cab-price hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.cab-price-from { color: var(--muted); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.cab-price-month { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cab-price-now { font-size: 22px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.cab-price dl.mini { font-size: 13px; }

@media (max-width: 760px) {
    .cab-bar { padding: 10px 16px; gap: 6px 8px; justify-content: space-between; }
    .cab-nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -8px; }
    .cab-nav a { white-space: nowrap; }
    .cab-brand .muted { display: none; }
    .cab-main { padding: 16px 16px 40px; }
    .cab-config { grid-template-columns: 1fr; }
    .cab-price { position: static; }
    .cab-field { grid-template-columns: 1fr; }
}
.cab-table { overflow-x: auto; max-width: 100%; }
/* Р112: the registration form - the sign-in card, wider, in two sections; the trap field is out of sight. */
.card.login.register { max-width: 460px; }
.reg-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.reg-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.card.login label.remember span { font-size: 13px; }

/* --- UX pass (2026-09-29): spacing, small screens, shared helpers --- */
/* One vertical rhythm: blocks stacked in the page's flow stand 14 px apart. Cards used to touch - a table's card right on
   the form under it (users, Telegram, client page). Only block-flow parents: in a grid or a flex column the gap does it. */
:is(.content, .cab-main, .vm-pane, .flow) > :is(.card, .tiles, .qtiles, .vm-grid, .form-grid, .pricing-grid, .resize-grid,
    .plan-grid, .charts, .cab-plans, .cab-list, .settings-grid, .map-grid, .stack):not(:last-child),
:is(.content, .cab-main, .vm-pane, .flow) > div:not([class]) > :is(.card, .tiles, .vm-grid, .form-grid, .charts):not(:last-child) {
    margin-bottom: 14px;
}
/* A card's title in a header row or in a card that spaces its children itself. */
:is(.nc-head, .ports-bar, .chart-head, .page-head, .na-head, .cab-row) > .card-title,
:is(.form-grid, .pricing-grid) .card > .card-title, :is(.inline-form, .create-card, .plan-card, .cab-order, .cab-form, .stack) > .card-title {
    margin-bottom: 0;
}
/* A row of buttons under facts, a table or text in a card is not glued to the last line. */
.card > :is(dl, table, p, ul, .props) + :is(.cab-actions, .form-actions, .actions, .bar-actions) { margin-top: 12px; }
.card > :is(.cab-actions, .form-actions) + .callout { margin-top: 10px; }
.callout > .cab-actions, .callout > .form-actions { margin-top: 8px; }
/* A spinner inside a button sits on the text's line. */
.btn .spin { margin-right: 6px; vertical-align: -1px; }

/* Helpers the pages use instead of inline styles. */
.flow { display: block; }
.stack-top { margin-top: 14px; }
.mt { margin-top: 10px; }
.narrow { max-width: 980px; }
.wrap-any { overflow-wrap: anywhere; }
.notes-text { white-space: pre-wrap; margin: 0; }
.big { font-size: 20px; font-weight: 500; }
.btn-link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.btn-link:disabled { opacity: .5; cursor: not-allowed; }
/* A field over the whole row of a .fld-row grid; a button beside fields is level with the inputs, not their labels. */
.fld-row > .fld.wide { grid-column: 1 / -1; }
.fld-row > :is(.fld-btn, .form-actions), .form-2 > :is(.fld-btn, .form-actions) { align-self: end; }
.fld-row > .form-actions { margin-top: 0; }
/* A small form inside a .props value (custom price, password): left-aligned under its label. */
.props dd .dd-form { margin-top: 6px; text-align: left; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.props dd:has(> .btn) { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
/* Logs and command output in a VM tab or a card: wrap, never widen the page. */
:is(.vm-pane, .card) pre, pre.log {
    white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 6px 0 0; max-height: 420px; overflow: auto;
    font-family: Consolas, "Cascadia Mono", monospace;
}
.day-picker { display: flex; flex-wrap: wrap; gap: 6px; max-width: 380px; margin-top: 4px; }
.day-picker .btn { min-width: 2.6em; }
.topic-list { display: flex; flex-direction: column; gap: 4px; }
.sig-preview { max-height: 70px; max-width: 200px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
table.grid td .bar-actions { flex-wrap: wrap; gap: 6px; }

/* The menu in groups: a thin line between map/networks, the business pages and the log/settings. */
.side nav .nav-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.side nav a:focus-visible, .cab-nav a:focus-visible, .tabs a:focus-visible, .vm-tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* An event row opened by the keyboard shows where the focus is. */
table.events tr.ev:focus-visible { outline: none; }
table.events tr.ev:focus-visible td { background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }

/* Scrolling rows of links (menu, cabinet menu, tabs) scroll without a bar across the page. */
.side nav, .cab-nav, .tabs, .vm-tabs { scrollbar-width: none; }
:is(.side nav, .cab-nav, .tabs, .vm-tabs)::-webkit-scrollbar { display: none; }

@media (max-width: 760px) {
    /* Two tiles a row on a phone: four tall tiles one under another took the whole first screen. */
    .tiles, .qtiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .tile, .qtile { padding: 10px 12px; }
    .tile-value { font-size: 18px; }
    .cab-plans { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    /* Finger-sized targets: small buttons were 27 px high, icon buttons 28 px. */
    .btn { min-height: 38px; }
    a.btn { display: inline-flex; align-items: center; justify-content: center; }
    .btn.small { min-height: 34px; padding: 5px 12px; }
    .icon-btn { width: 36px; height: 36px; }
    .cab-stepper .btn { width: 44px; min-height: 40px; }
    .side nav a, .cab-nav a { padding: 8px 12px; }
    .side nav .nav-sep { width: 1px; height: auto; margin: 6px 2px; flex: none; }
    /* The map keeps readable text: it scrolls sideways in its card instead of shrinking to 5-px letters. */
    .map-grid > .card:first-child { overflow-x: auto; }
    svg.map { min-width: 640px; }
    .page-head h1 { margin-bottom: 10px; }
    .page-head .btn { margin-bottom: 10px; }
    .vm-head { padding: 14px; }
    .vm-title { font-size: 20px; }
    h1 { font-size: 20px; overflow-wrap: anywhere; }
}
/* Very wide screens: a little more air at the page edges. */
@media (min-width: 1800px) {
    .content { padding-left: 32px; padding-right: 32px; }
}
.row-actions .bar-actions { justify-content: flex-end; }
.cab-name .muted { overflow-wrap: anywhere; }

/* --- UX pass, round 2 (2026-09-30, walked on prod at 1653 and 375 px) --- */
/* Inside a card that lays its children out as plain blocks, a field, a check box and a button row keep 10 px apart:
   the CD/DVD card had its select, check box and «Вставить» 3 px apart. Cards that space children themselves are left out. */
.card:not(.inline-form, .create-card, .plan-card, .cab-vm, .cab-order, .cab-form, .settings-group, .stack):not(:is(.form-grid, .pricing-grid) > .card)
    > * + :is(.form-2, .fld-row, .fld, .fld-check, .actions, .form-actions, .bar-actions, .dd-form) { margin-top: 10px; }
.card > .actions:last-child { margin-bottom: 0; }
/* A lone field in a wide card stops at a sensible width (the reinstall confirmation was 1100 px wide). */
.card > .fld:not(.wide), .card > label.fld:not(.wide) { max-width: 560px; }
/* Explanations in wide cards read in lines of a comfortable length. */
.card > p, .card > .callout, .settings-group > p { max-width: 120ch; }
/* A full-width card's facts: label and value stay close, not at the two ends of a 1 200-px row. */
.vm-pane > .card > .props { max-width: 900px; }
summary { max-width: 100%; overflow-wrap: anywhere; }

@media (max-width: 760px) {
    /* Period switches on charts: finger-sized too. */
    .seg button { padding: 7px 12px; }
    .vm-actions .sep { display: none; }
}
@media (max-width: 480px) {
    /* Facts on a phone: the label over its value - two squeezed columns broke «из buh.dt (913,6 МБ), 25.09…» word by word. */
    .props { grid-template-columns: minmax(0, 1fr); }
    .props dt { border-bottom: 0; padding-bottom: 0; }
    .props dd { text-align: left; padding-top: 2px; }
    .props dd:has(> .btn) { justify-content: flex-start; }
}
/* A long health text in the VM head («не хватает памяти: 121 подкачек…») wraps instead of pushing the page 47 px wider. */
.vm-pills .pill { max-width: 100%; white-space: normal; line-height: 1.3; }
/* Tablet width (760-1000 px, the side menu still on): the settings tabs ran 140 px past the page and a table in a
   half-width card (the client's VMs) 46 px - the scroll inside them was switched on for a phone only. */
.tabs { overflow-x: auto; }
.tabs a { white-space: nowrap; }
.card:has(> table.grid) { overflow-x: auto; }
/* R127: the map's server actions folded until opened (each opening asks the server over SSH). */
details.na > summary { cursor: pointer; font-weight: 500; width: max-content; max-width: 100%; }
details.na > summary:hover { color: var(--accent, var(--text)); }
details.na[open] > summary { margin-bottom: 8px; }
/* R127 (table-tools.js): a filter on - "Показано N из M" under the table, the totals over all rows dimmed. */
table.grid > caption.tt-count { caption-side: bottom; text-align: left; padding: 6px 12px; }
table.grid > tfoot.tt-filtered { opacity: .55; }
/* Р146: the VM's 1C licenses in brief on the «1С» tab (OnecLicenseSummary). */
.lic-sum .nc-head { flex-wrap: wrap; }
.lic-sum .nc-title .pill { margin-left: 6px; }
.lic-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }

/* Р157: the twins between servers on the map - one line per cell -> holder, thickness by the daily change (Map.razor).
   Faint by default: with 5+ servers they would be a web over the map; a host under the pointer (panel.js, .hot) or the
   line itself brings out only its own lines. The wide transparent copy (.twl-hit) is what the pointer catches. */
.link.twins { stroke: var(--accent); opacity: .3; stroke-linecap: round; }
.twl-head { fill: var(--accent); }
.twl.tw-lag .link.twins { stroke: var(--warn); } .twl.tw-old .link.twins { stroke: var(--down); }
.twl-hit { fill: none; stroke: transparent; stroke-width: 10; }
.twl-t { fill: var(--muted); font-size: 10px; text-anchor: middle; opacity: .6; font-variant-numeric: tabular-nums; pointer-events: none;
    paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.twl-t.v { text-anchor: start; }
.twl:hover .link.twins, .twl.hot .link.twins { opacity: 1; }
.twl:hover .twl-t, .twl.hot .twl-t { opacity: 1; fill: var(--text); font-weight: 600; }
.legend .line.twins { border-top: 3px solid var(--accent); opacity: .55; }
/* Р157 «Много ВМ»: a holder's twins folded into a counter per source server; the dot - its worst twin. */
.twc, .twc-fold { cursor: pointer; }
.twc .vmt-u { fill: var(--surface); stroke: var(--ok); stroke-width: 1.1; stroke-dasharray: 1.2 1.2; }
.twc .twc-t { fill: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.twc.tw-lag .vmt-u { stroke: var(--warn); } .twc.tw-old .vmt-u { stroke: var(--down); }
.twc .vmi-tw { stroke: var(--surface); stroke-width: 1; fill: var(--ok); }
.twc .vmi-tw.tw-lag { fill: var(--warn); } .twc .vmi-tw.tw-old { fill: var(--down); }
.twc:hover .vmt-u { stroke-width: 1.8; } .twc:hover .twc-t, .twc-fold:hover text { fill: var(--text); }
.twc:focus-visible, .twc-fold:focus-visible { outline: none; } .twc:focus-visible .vmt-u { stroke: var(--accent); stroke-width: 2.2; }

/* Р161: a wide table inside a card with other content scrolls on its own on a phone. */
.scroll-x { overflow-x: auto; }
