:root {
  --bg: #0b0e11; --surface: #13171b; --border: #282e33; --text: #edf1f3; --muted: #98a4ad;
  --green: #43d18d; --yellow: #efc66d; --red: #ff6681; --blue: #70b8ef;
  --mono: "Fira Mono", ui-monospace, Consolas, monospace;
  --sans: Montserrat, system-ui, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 var(--sans); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; }

.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.login-card label.check { display: flex; align-items: center; gap: 8px; }
input:not([type=checkbox]) { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; color: var(--text); padding: 9px 10px; font: inherit; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.login-card button { background: var(--blue); color: #06121b; border: 0; border-radius: 5px; padding: 10px; font-weight: 600; }
.error { color: var(--red); min-height: 1.2em; margin: 0; font-size: 12px; }

.layout { display: grid; grid-template-columns: minmax(380px, 440px) 1fr; height: 100vh; }
.side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--bg); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.side-head h1 { font-size: 16px; }
.actions { display: flex; gap: 4px; align-items: center; }
.slot-mobile { display: none; }
.seg .short { display: none; }
@media (max-width: 800px) {
  .slot-mobile { display: block; margin-right: 4px; }
  .slot-mobile .seg button { padding: 5px 9px; font-size: 11px; }
  .slot-mobile .seg .long { display: none; }
  .slot-mobile .seg .short { display: inline; }
}
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; margin: auto; }
.icon { background: transparent; border: 1px solid transparent; border-radius: 5px; width: 30px; height: 30px; color: var(--muted); }
.icon:hover { border-color: var(--border); color: var(--text); }
.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 16px; }
.counter { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.counter .num { font-size: 20px; color: var(--text); }
.counter.ok .num { color: var(--green); }
.counter.bad .num { color: var(--red); }
#source-line { padding: 8px 16px 4px; margin: 0; }

.nodes { list-style: none; margin: 0; padding: 4px 8px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.node { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: start; gap: 0 8px; min-height: 36px; padding: 4px 8px; border-radius: 5px; border-bottom: 1px solid var(--border); }
.node .gut { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 6px; }
.node .nbody { min-width: 0; }
.node .hd { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.node .nmwrap { flex: 1; min-width: 0; display: flex; align-items: center; }
.node .nmwrap .name { flex: 0 1 auto; min-width: 0; }
.node .nmwrap .badge { flex: none; }
.node .users { display: inline-flex; align-items: center; gap: 4px; }
.ic.sm { width: 14px; height: 14px; display: inline-block; margin: 0; flex: none; }
.node .speed, .node .upt { display: none; }
.node:hover { background: var(--surface); }
.node .flag { display: flex; align-items: center; justify-content: center; }
.flag-img { width: 20px; height: 15px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); display: inline-block; vertical-align: -2px; }
.flag-chip { display: inline-block; min-width: 20px; padding: 0 3px; font: 600 10px/15px var(--mono); text-align: center; color: var(--muted); border: 1px solid var(--border); border-radius: 2px; }
dd .flag-img { margin-right: 4px; }
.node .name { background: none; border: 0; padding: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node .name:hover { text-decoration: underline; }
.badge { font-size: 11px; color: var(--blue); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.node .users { color: var(--muted); font-size: 12px; min-width: 3ch; text-align: right; }
.node .st { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 12px; min-width: 20px; }
.node .st .ic { width: 18px; height: 18px; display: block; margin: 0; flex: none; }
body.full .node .st .ic { width: 20px; height: 20px; }
/* Слово статуса везде заменено иконкой (и в компактном, и в полном режиме); текст остаётся для экранных читалок и подсказки. */
.node .st .stt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.node .st.spin .ic { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.node .sshc { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.node .sshc[hidden] { display: none; }
.node .sshc.ssh-ok { color: var(--green); } .node .sshc.ssh-warn { color: var(--yellow); } .node .sshc.ssh-bad { color: var(--red); }
.node .sshc.stale { opacity: .55; }
body.full .node .sshc { display: none; }
.node.online .st { color: var(--green); }
.node.offline .st { color: var(--red); }
.node.unknown .st { color: var(--muted); }
.node.connecting .st, .node.disabled .st { color: var(--yellow); }
.node.blocked .st { color: var(--red); }
.node.warn .st { color: var(--yellow); }
.scan { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scan svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.scan.ok { color: var(--green); }
.scan.warn { color: var(--yellow); }
.scan.block { color: var(--red); }
.scan.stale { opacity: .55; }
.scan[hidden] { display: none; }
.strip { display: grid; grid-template-columns: repeat(48, 1fr); gap: 1px; margin: 8px 0 4px; }
.strip i { height: 16px; background: var(--border); border-radius: 1px; }
.strip i.ok { background: var(--green); }
.strip i.warn { background: var(--yellow); }
.strip i.block { background: var(--red); }
.scanners { margin: 8px 0 0; padding: 0; list-style: none; max-height: 180px; overflow-y: auto; font-size: 12px; border-top: 1px solid var(--border); }
.scanners li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.scanners .v-ok { color: var(--green); }
.scanners .v-bad { color: var(--red); }
.scanners .v-unk { color: var(--muted); }
#nd-result.ok { color: var(--green); }
#nd-result.err { color: var(--red); }
body.full .node { grid-template-columns: 62px minmax(0, 1fr); gap: 0 12px; padding: 10px 10px 8px; }
body.full .node .gut { border-right: 1px solid var(--border); padding: 2px 10px 0 0; min-height: 100%; }
body.full .node .flag .flag-img { width: 28px; height: 21px; }
body.full .node .speed { display: grid; gap: 3px; text-align: center; font-size: 13px; }
body.full .node .speed .dn, body.full .node .speed .upl { display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
body.full .node .speed .dn { color: var(--green); }
body.full .node .speed .upl { color: var(--blue); }
body.full .node .speed .unit { font-size: 10px; color: var(--muted); }
body.full .node .upt { display: block; margin-top: auto; padding-top: 8px; font-size: 11px; color: var(--muted); }

.main { padding: 20px 24px; overflow-y: auto; display: grid; align-content: start; gap: 14px; }
.main-head { display: flex; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: 6px 12px; font-size: 12px; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--border); color: var(--text); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.panel.warn { border-color: var(--yellow); color: var(--yellow); }
.big { font-size: 32px; }

.infra { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.infra-item { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; background: var(--bg); }
.infra-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.infra-head .name { background: none; border: 0; padding: 0; text-align: left; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.infra-head .name:hover { text-decoration: underline; }
.chip { font-size: 11px; white-space: nowrap; color: var(--muted); }
.infra-item.ok .chip { color: var(--green); }
.infra-item.warn .chip { color: var(--yellow); }
.infra-item.bad .chip { color: var(--red); }
.infra-item.bad { border-color: var(--red); }
.infra-full { display: grid; gap: 6px; padding-top: 6px; }
.infra-full[hidden] { display: none; }
.infra-full .bars { grid-template-columns: repeat(3, 1fr); }
.clients { font-size: 12px; color: var(--muted); }
.clients[hidden] { display: none; }
:root { color-scheme: dark; }
.nodes, .scanners, dialog { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.overview { display: grid; gap: 12px; }
.ov-top { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 20px; align-items: start; }
.ov-value { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ov-value .ic { width: 26px; height: 26px; color: var(--muted); margin: 0; flex: none; }
.ov-chart { min-width: 0; position: relative; }
.seg.mini { position: absolute; right: 0; top: -2px; z-index: 1; }
.seg.mini button { padding: 3px 9px; font-size: 11px; }
.chart { padding-top: 22px; }
.chart-empty { margin: 14px 0; }
.chart-scale { display: flex; justify-content: space-between; margin-bottom: 2px; font-size: 11px; }
.chart-plot { position: relative; height: 84px; touch-action: pan-y; cursor: crosshair; }
.chart-svg { width: 100%; height: 100%; display: block; }
.chart-line { fill: none; stroke: var(--blue); stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart-area { fill: var(--blue); opacity: .12; }
.chart-guide { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .6; }
.chart-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px rgba(112, 184, 239, .25); pointer-events: none; }
.chart-tip { position: absolute; top: -4px; transform: translateX(-50%); background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 3px 8px; font: 12px var(--mono); white-space: nowrap; pointer-events: none; z-index: 2; }
.chart-tip[hidden] { display: none; }
.chart-time { display: flex; justify-content: space-between; font-size: 11px; margin-top: 2px; }
.cost-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
.cost-total { font-size: 20px; }
.costform { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.costform label { color: var(--muted); font-size: 12px; }
.costrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.costrow input { width: 140px; }
.costrow .cur { color: var(--muted); }
.chip.cost { color: var(--text); }
/* Общий онлайн показан в верхнем ряду счётчиков и на телефоне, и на компьютере. */
.counters { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.counter { padding: 7px 8px; font-size: 11px; }
.counter .num { font-size: 18px; }
.counter.online-c .num { display: inline-flex; align-items: center; gap: 4px; }
.counter.online-c .ic { color: var(--muted); }
@media (max-width: 800px) {
  .ov-top { grid-template-columns: 1fr; gap: 8px; }
  .chart { padding-top: 26px; }
}
.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.panel-head h3 { margin: 0; }
.panel-head .link { margin-left: auto; }
.map-panel { display: none; }
body.full .map-panel { display: block; }
.map-panel.collapsed #map-body { display: none; }
.map-host { width: 100%; min-height: 240px; }
.map-svg { width: 100%; height: auto; display: block; }
.map-svg .grid line { stroke: var(--border); stroke-width: 1; opacity: .45; }
.map-svg .route { fill: none; stroke: var(--blue); stroke-width: 1.2; opacity: .45; transition: opacity .15s, stroke-width .15s; }
.map-svg .particle { fill: var(--blue); opacity: .9; transition: opacity .15s; }
.map-svg.has-hot .route:not(.hot), .map-svg.has-hot .particle:not(.hot) { opacity: .1; }
.map-svg.has-hot .pt:not(.hot) { opacity: .55; }
.map-svg .route.hot { opacity: 1; stroke-width: 2; }
.map-svg .pt { cursor: pointer; outline: none; transition: opacity .15s; }
.map-svg .pt .dot { fill: var(--green); }
.map-svg .pt .halo { fill: var(--green); opacity: .16; }
.map-svg .pt.warn .dot, .map-svg .pt.warn .halo { fill: var(--yellow); }
.map-svg .pt.bad .dot, .map-svg .pt.bad .halo { fill: var(--red); }
.map-svg .pt:focus-visible .halo { opacity: .45; }
.map-svg .lbl-bg { fill: var(--bg); stroke: var(--border); opacity: .94; }
.map-svg .lbl-flag { pointer-events: none; }
.map-svg .lbl { fill: var(--text); font: 600 11px var(--mono); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12px; }
.legend[hidden] { display: none; }
.legend-group { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.legend-title { color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.legend-item.warn .dot { background: var(--yellow); }
.legend-item.bad .dot { background: var(--red); }
.legend-item.none .dot { background: var(--muted); }
.node.related { background: var(--surface); }
.cnode { display: inline-flex; gap: 12px; align-items: baseline; }
.st-ok { color: var(--green); } .st-warn { color: var(--yellow); } .st-bad { color: var(--red); }
.num.tick { animation: tick .35s ease-out; }
@keyframes tick { from { opacity: .35; } to { opacity: 1; } }
.node.flash.f-g { animation: flash-g .9s ease-out; }
.node.flash.f-y { animation: flash-y .9s ease-out; }
.node.flash.f-r { animation: flash-r .9s ease-out; }
@keyframes flash-g { from { background: rgba(67, 209, 141, .25); } to { background: transparent; } }
@keyframes flash-y { from { background: rgba(239, 198, 109, .25); } to { background: transparent; } }
@keyframes flash-r { from { background: rgba(255, 102, 129, .28); } to { background: transparent; } }

.extra { display: grid; gap: 10px; padding: 8px 0 2px; }
.rings { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.ring { display: flex; align-items: center; gap: 7px; }
.ring svg { flex: none; }
.ring-track { fill: none; stroke: var(--border); stroke-width: 3.5; }
.ring-arc { fill: none; stroke: var(--blue); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dasharray .35s ease, stroke .2s; }
.ring[data-level="warn"] .ring-arc { stroke: var(--yellow); }
.ring[data-level="crit"] .ring-arc { stroke: var(--red); }
.ring[data-level="none"] .ring-track { stroke-dasharray: 2 4; }
.ring[data-level="none"] .ring-arc { stroke: transparent; }
.ring .rl { font-size: 11px; color: var(--muted); }
.ring .rv { font-size: 14px; min-width: 3ch; }
.ring[data-level="none"] .rv { color: var(--muted); }
.cats2 { display: flex; align-items: center; gap: 10px; }
.cats2[hidden] { display: none; }
.stack { display: flex; flex: 1; height: 6px; border-radius: 3px; overflow: hidden; gap: 1px; background: var(--border); }
.sg { display: block; height: 100%; transition: width .35s ease; }
.sg.ok { background: var(--green); } .sg.sig { background: var(--red); } .sg.unk { background: var(--yellow); } .sg.none { background: var(--muted); }
.cnt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cnt span[hidden] { display: none; }
.cnt span + span::before { content: " · "; color: var(--muted); }
.cnt .c-ok { color: var(--green); } .cnt .c-sig { color: var(--red); } .cnt .c-unk { color: var(--yellow); } .cnt .c-none { color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips .chip[hidden] { display: none; }
.chips .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); }
.chip.ssh-ok { color: var(--green); } .chip.ssh-warn { color: var(--yellow); } .chip.ssh-bad { color: var(--red); } .chip.stale { opacity: .55; }
.bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 0 6px; font-size: 11px; color: var(--muted); }
.bar .bv { color: var(--text); }
.track { grid-column: 1 / -1; display: block; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.track i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .35s ease; }
.bar[data-level="warn"] .track i { background: var(--yellow); }
.bar[data-level="crit"] .track i { background: var(--red); }
.netline { font-family: var(--mono); font-size: 11px; }
.cats { display: grid; gap: 3px; }
.cat { display: grid; grid-template-columns: 84px auto 1fr; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.cat[hidden] { display: none; }
.cat .track { margin: 0; grid-column: auto; }
.cat.ok .track i { background: var(--green); }
.cat.sig .track i { background: var(--red); }
.cat.unk .track i { background: var(--yellow); }
.cat.none .track i { background: var(--muted); }
.strip.mini { margin: 2px 0 0; }
.strip.mini i { height: 10px; }

.feed li { transition: transform .12s ease, background .12s ease; }
.feed li:not(.day):hover { transform: scale(1.008); }
ul.plain { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.plain .sub { display: block; color: var(--muted); font-size: 12px; }
ul.plain .v-ok { color: var(--green); } ul.plain .v-bad { color: var(--red); }
.acts { display: flex; align-items: center; gap: 8px; }
button.link { background: none; border: 0; color: var(--blue); padding: 2px 4px; font-size: 12px; text-decoration: underline; }
button.link.danger { color: var(--red); }
input.days { width: 64px; padding: 4px 6px !important; }
.userform { display: grid; gap: 8px; }
select { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; color: var(--text); padding: 9px 10px; font: inherit; }
dialog.wide { width: min(640px, calc(100vw - 32px)); }
#settings-tabs { margin: 0 0 12px; }
#settings-body h3 { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.panel h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 5px; font-size: 13px; }
.feed li:hover { background: rgba(255, 255, 255, .03); }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); align-self: center; }
.feed .red .dot { background: var(--red); }
.feed .green .dot { background: var(--green); }
.feed .yellow .dot { background: var(--yellow); }
.feed .blue .dot { background: var(--blue); }
.feed .when { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.feed .sub { display: block; color: var(--muted); font-size: 12px; }
.feed li.day { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 8px 2px; }
.feed li.day:hover { background: none; }
.feed li.fresh { animation: fresh 2s ease-out; }
@keyframes fresh { from { background: rgba(112, 184, 239, .22); } to { background: transparent; } }
button.primary { background: var(--blue); color: #06121b; border: 0; border-radius: 5px; padding: 8px 12px; font-weight: 600; margin-top: 8px; }
button.primary:disabled { opacity: .5; cursor: default; }
#tg-result.ok { color: var(--green); }
#tg-result.err { color: var(--red); }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog .close { position: absolute; top: 8px; right: 8px; }
dl { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
dt { color: var(--muted); }
dd { margin: 0; font-family: var(--mono); word-break: break-all; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--border); }
  .nodes { max-height: none; overflow: visible; }
  .main { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Дизайн-проход: обзор сети, график, карта, компоновка ---- */
.overview { background: linear-gradient(180deg, rgba(112, 184, 239, .07), rgba(112, 184, 239, 0) 70%), var(--surface); padding: 18px 20px; gap: 14px; }
.ov-top { grid-template-columns: minmax(170px, 250px) minmax(0, 1fr); gap: 28px; }
.ov-value { gap: 10px; margin-top: 6px; }
.ov-value .big { font-size: 48px; line-height: 1; font-weight: 500; letter-spacing: -.02em; }
.ov-value .ic { width: 30px; height: 30px; color: var(--blue); }
.delta { display: inline-flex; align-items: center; margin-top: 10px; padding: 2px 10px; border-radius: 12px; font: 12px var(--mono); border: 1px solid var(--border); color: var(--muted); }
.delta[hidden] { display: none; }
.delta.up { color: var(--green); border-color: rgba(67, 209, 141, .35); background: rgba(67, 209, 141, .08); }
.delta.down { color: var(--red); border-color: rgba(255, 102, 129, .35); background: rgba(255, 102, 129, .08); }
.cg-top { stop-color: var(--blue); stop-opacity: .4; }
.cg-bottom { stop-color: var(--blue); stop-opacity: 0; }
.chart-area { fill: url(#chart-grad); opacity: 1; }
.chart-line { stroke-width: 2.2; }
.chart-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 2 5; }
.chart-plot { height: 100px; }
.chart-peak { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; border: 1.5px solid var(--yellow); background: var(--surface); pointer-events: none; }
.chip-mini { border: 1px solid var(--border); border-radius: 10px; padding: 1px 9px; }
.cost-row { align-items: center; justify-content: space-between; gap: 6px 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, .02); }
.cost-total { font-size: 24px; font-weight: 500; letter-spacing: -.01em; }
.cost-row #cost-note { flex-basis: 100%; }

.duo { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); align-items: start; }
.duo > .hidden { display: none; }
@media (min-width: 1300px) { .main { padding: 24px 32px; } }

.map-svg .dotp { fill: var(--border); opacity: .9; }
.map-svg .hub-glow { pointer-events: none; }
.map-svg .route { stroke-width: 1.4; opacity: .5; }
.map-svg .pt .halo { transform-box: fill-box; transform-origin: center; }
.map-svg .pt.bad .halo { animation: pulse 2.2s ease-out infinite; }
.map-svg .pt.hub .halo { animation: pulse 3.4s ease-out infinite; }
.map-svg.paused .halo { animation-play-state: paused; }
@keyframes pulse { 0% { transform: scale(.8); opacity: .45; } 100% { transform: scale(1.9); opacity: 0; } }
.map-svg .lbl-bg { fill: rgba(11, 14, 17, .92); }
.map-panel { background: radial-gradient(120% 90% at 85% 20%, rgba(112, 184, 239, .06), rgba(112, 184, 239, 0) 60%), var(--surface); }
.hg-a { stop-color: var(--blue); stop-opacity: .24; }
.hg-b { stop-color: var(--blue); stop-opacity: 0; }

@media (max-width: 800px) {
  .ov-top { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ov-value .big { font-size: 38px; }
  .overview { padding: 14px 14px; }
  .cost-total { font-size: 20px; }
}

/* Форма добавления серверов */
.srvform .fld { display: grid; gap: 3px; min-width: 0; }
.srvform .fld > span, .srvform .chk span { font-size: 12px; color: var(--muted); }
.srvform .fld input, .srvform .fld select { width: 100%; min-width: 0; }
.srv-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; align-items: end; }
.srv-ssh, .srv-proxy { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 6px; }
.srv-ssh[hidden], .srv-proxy[hidden] { display: none; }
.srvform .chk { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.srvform .acts { display: flex; gap: 12px; align-items: center; }
.infra-flag:empty { display: none; }
.infra-flag { display: inline-flex; margin-right: 6px; }
.infra-head { justify-content: flex-start; }
.infra-head .name { margin-right: auto; }

/* Карточка инфраструктуры: флаг, название, иконка состояния; шкалы ровными плитками */
.infra { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 8px; }
.infra-item { min-width: 0; }
.infra-item { padding: 10px 12px; border-radius: 10px; background: var(--bg-elev, var(--bg)); }
.infra-head { gap: 8px; min-height: 24px; justify-content: flex-start; }
.infra-head .name { flex: 1; min-width: 0; margin-right: 0; font-weight: 600; font-size: 13px; }
.infra-flag { margin-right: 0; flex: none; }
.ist { flex: none; display: inline-flex; width: 20px; height: 20px; color: var(--muted); }
.ist .ic { width: 20px; height: 20px; }
.infra-item.ok .ist { color: var(--green); }
.infra-item.warn .ist { color: var(--yellow); }
.infra-item.bad .ist { color: var(--red); }
.infra-full { gap: 8px; padding-top: 10px; }
.infra-full .bars { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.infra-full .bars[hidden] { display: none; }
.infra-full .bar { grid-template-columns: 1fr auto; row-gap: 4px; }
.infra-full .bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.infra-full .bar .bv { text-align: right; white-space: nowrap; }
.infra-full .bar .track { grid-column: 1 / -1; }
.infra-full .clients { font-size: 12px; }
@media (max-width: 600px) { .infra { grid-template-columns: minmax(0, 1fr); } }

/* Фильтр по провайдеру: одна прокручиваемая строка чипов над списком нод */
.prov-bar { padding: 4px 12px 6px; }
.prov-bar.hidden { display: none; }
.prov-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.pchip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 14px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.pchip:hover { color: var(--text); border-color: var(--muted); }
.pchip[aria-pressed="true"] { color: var(--text); border-color: var(--blue); background: color-mix(in srgb, var(--blue) 16%, transparent); }
.pchip .pc { font-size: 11px; opacity: .75; }
.pchip.has-bad .pc { color: var(--red); opacity: 1; }
.pchip.has-bad .pc::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--red); vertical-align: 1px; }
.prov-bar p { margin: 0; }
.nodes li[hidden], .infra-item[hidden] { display: none; }

/* Фильтр по провайдерам: «Все» и выпадающий список с отметками */
.prov-bar { position: relative; }
.prov-ctl { display: flex; gap: 6px; padding: 2px 0 6px; }
.pmenu-btn { gap: 6px; }
.pmenu-btn .pc { color: var(--blue); opacity: 1; font-weight: 600; }
.pmenu-btn .caret { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.pmenu-btn[aria-expanded="true"] .caret { transform: translateY(1px) rotate(225deg); }
.prov-menu { position: absolute; z-index: 20; left: 12px; right: 12px; top: calc(100% - 4px); max-height: min(60vh, 420px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); overflow: hidden; }
.prov-menu[hidden] { display: none; }
.pmenu-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.pmenu-list { overflow-y: auto; padding: 4px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.popt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.popt:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.popt input { accent-color: var(--blue); margin: 0; }
.popt .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popt .pc { font-size: 12px; color: var(--muted); }
.popt.has-bad .pc { color: var(--red); }
.popt.has-bad .pc::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--red); vertical-align: 1px; }
.prov-bar .prov-note, #prov-note { padding-top: 2px; }

/* Окно ноды: шапка, плитки показателей, стоимость, проверка блокировок */
dialog.ndlg { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 20px 22px 18px; border-radius: 14px; }
.nd-head { display: flex; align-items: center; gap: 12px; padding-right: 32px; margin-bottom: 14px; }
.nd-flag { flex: none; display: inline-flex; }
.nd-flag .flag-img { width: 32px; height: 24px; border-radius: 3px; }
.nd-flag:empty { display: none; }
.nd-ttl { min-width: 0; }
.nd-ttl h3 { margin: 0; font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.nd-ttl p { margin: 2px 0 0; }
.nd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 14px; }
.ndt { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); min-width: 0; }
.ndt-l { font-size: 11px; color: var(--muted); }
.ndt-v { display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 600; min-width: 0; }
.ndt-v .ic { width: 18px; height: 18px; margin: 0; flex: none; color: var(--muted); }
.ndt-v .num { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ndt.ok .ic { color: var(--green); } .ndt.warn .ic { color: var(--yellow); } .ndt.bad .ic { color: var(--red); }
.ndt.ok { border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.ndt.warn { border-color: color-mix(in srgb, var(--yellow) 40%, var(--border)); }
.ndt.bad { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.ndt.neutral .ic { color: var(--blue); }
.nd-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0 0 4px; padding: 12px 0 0; border-top: 1px solid var(--border); font-size: 13px; }
.nd-kv dt { color: var(--muted); }
.nd-kv dd { margin: 0; overflow-wrap: anywhere; }
dialog.ndlg .costform { margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.costrow { gap: 10px; }
.moneyin { position: relative; display: flex; align-items: center; }
.moneyin input { width: 150px; padding-right: 30px; -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums; }
.moneyin input::-webkit-inner-spin-button, .moneyin input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.moneyin .cur { position: absolute; right: 10px; pointer-events: none; }
.ndx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ndx-head h4, .ndx-h2 { margin: 0; font-size: 14px; }
.ndx-h2 { margin-top: 14px; }
.ndx-sub { font-size: 12px; color: var(--muted); }
.ndx-stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 2px; font-size: 12px; color: var(--muted); }
.ndx-stats b { color: var(--text); font-weight: 600; }
.strip-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.ndx-net { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border: 1px solid var(--border); border-radius: 12px; font-size: 12px; background: var(--bg); }
.pill.v-ok { color: var(--green); } .pill.v-bad { color: var(--red); } .pill.v-unk { color: var(--muted); }
.ndx-sum { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
dialog.ndlg .scanners { max-height: 220px; margin-top: 4px; border: 1px solid var(--border); border-radius: 10px; border-top-width: 1px; padding: 2px 10px; background: var(--bg); }
dialog.ndlg .scanners li { align-items: center; justify-content: flex-start; gap: 8px; padding: 6px 0; font-size: 12px; }
dialog.ndlg .scanners li:last-child { border-bottom: 0; }
.scanners .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.scanners .sc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scanners .sc-v { flex: none; font-weight: 600; }
.nd-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.nd-foot p { margin: 0; min-width: 0; }
.nd-foot .primary { margin-left: auto; }

.sshtoggle { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; }
.sshtoggle input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--blue); flex: none; }
.sshtoggle > span { display: grid; gap: 2px; font-size: 13px; }
#nd-ssh:empty { display: none; }

/* Расходы: ноды Remnawave, инфраструктура, итог */
.cost-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; align-items: stretch; }
.cost-cell { display: grid; gap: 3px; align-content: start; min-width: 0; }
.cost-cell + .cost-cell { padding-left: 18px; border-left: 1px solid var(--border); }
.cost-val { font-size: 18px; font-weight: 500; letter-spacing: -.01em; }
.cost-cell.total .cost-total { font-size: 24px; }
.cost-cell.empty .cost-val { color: var(--muted); }
.cost-row #cost-note { flex-basis: auto; }
@media (max-width: 700px) {
  .cost-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-cell.total { grid-column: 1 / -1; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .cost-cell:nth-child(2) { padding-left: 14px; }
}

.srv-acts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.srv-acts p { flex-basis: 100%; margin: 0; }
#infra-body .srvform { margin-top: 8px; }

/* Проверки на серверах инфраструктуры */
.infra-head .scan, .infra-head .sshc { flex: none; }
.infra-head .sshc { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.infra-head .sshc[hidden], .infra-head .scan[hidden] { display: none; }
.infra-head .sshc.ssh-ok { color: var(--green); } .infra-head .sshc.ssh-warn { color: var(--yellow); } .infra-head .sshc.ssh-bad { color: var(--red); }
.infra-head .sshc.stale { opacity: .55; }
.infra-full .strip.mini { margin: 2px 0 0; }
.infra-full .strip[hidden] { display: none; }
.chk-list { display: grid; gap: 8px; margin-top: 12px; }
.chk-list .sshtoggle { margin-top: 0; }
.sshtoggle.off { opacity: .6; cursor: default; }

.qchecks { display: inline-flex; gap: 10px; margin-left: auto; padding: 0 10px; flex: none; }
.qchk { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.qchk input { margin: 0; accent-color: var(--blue); }
.qchk input:disabled + span { opacity: .45; }

.srv-checks { display: grid; gap: 2px; }
.srv-checks .chk { padding-bottom: 4px; }

/* Счётчики-фильтры */
button.counter { font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
button.counter:hover { border-color: var(--muted); }
button.counter[aria-pressed="true"] { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, var(--surface)); }
button.counter.bad[aria-pressed="true"] { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--surface)); }
button.counter.ok[aria-pressed="true"] { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.sf-note { margin: 6px 16px 0; }
.sf-note[hidden] { display: none; }

/* Вкладка «Финансы» */
/* Вкладка «Финансы» лежит рядом с #app, поэтому на время работы с ней мониторинг скрывается целиком (иначе пустой #app занимает 100vh). */
body.fin #app { display: none; }
.finance { max-width: 880px; margin: 0 auto; padding: 18px 16px 40px; }
.finance.hidden { display: none; }
.fin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.fin-top h2 { margin: 0; font-size: 22px; }
.fin-nav { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.fin-nav b { font-size: 17px; font-weight: 600; min-width: 150px; text-align: center; }
.fin-nav button:disabled { opacity: .35; cursor: default; }
.fin-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.fin-k { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.fin-k small { color: var(--muted); font-size: 12px; }
.fin-k b { font-size: 22px; font-weight: 500; }
.fin-k b.good { color: var(--green); } .fin-k b.bad { color: var(--red); }
.fin-k i { font-style: normal; font-size: 12px; color: var(--muted); }
.fin-bar { display: flex; height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; margin-bottom: 14px; }
.fin-bar span { display: block; height: 100%; }
.fin-bar .got { background: var(--blue); } .fin-bar .wait { background: var(--border-strong, #5a646b); } .fin-bar .late { background: var(--red); }
.finance h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 18px 0 6px; }
.fin-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.fin-h h3 { margin: 0; }
.fin-list { list-style: none; margin: 0; padding: 0; }
.fin-list > li { border-bottom: 1px solid var(--border); }
.fin-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(90px, auto) auto auto; gap: 10px; align-items: center; padding: 10px 0; }
.fin-row .n { min-width: 0; } .fin-row .n b { font-weight: 500; } .fin-row .n small { display: block; font-size: 12px; color: var(--muted); }
.fin-row .amt { text-align: right; } .fin-row .amt small { display: block; font-size: 11px; color: var(--muted); }
.fin-row .acts { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.fin-chip { font-size: 12px; padding: 2px 9px; border-radius: 12px; white-space: nowrap; border: 1px solid var(--border); color: var(--muted); }
.fin-chip.paid { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.fin-chip.late { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.fin-chip.partial { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 45%, var(--border)); }
.fin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.fin-grid .acts { display: flex; gap: 10px; align-items: center; }
.fin-grid .fld { display: grid; gap: 3px; } .fin-grid .fld > span, .fin-part .fld > span { font-size: 12px; color: var(--muted); }
.fin-grid .chk, .fin-edit .chk { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.fin-add { padding: 12px; margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.fin-edit { padding: 4px 0 14px; display: grid; gap: 12px; }
.fin-part { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.fin-part .fld { display: grid; gap: 3px; flex: 1; min-width: 200px; }
.fin-legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); margin: 6px 0; flex-wrap: wrap; }
.fin-legend span { display: inline-flex; align-items: center; gap: 5px; }
.fin-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.fin-legend .seg { margin-left: auto; }
i.got { background: var(--blue); } i.unpaid { background: #eb6834; }
.fin-chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 6px; }
.fin-col { flex: 1; min-width: 0; display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; }
.fin-col .stack { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.fin-col .stack i { display: block; border-radius: 3px; min-height: 0; }
.fin-col .lbl { text-align: center; font-size: 11px; color: var(--muted); }
.fin-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border); }
.fin-foot p { margin: 0; }
@media (max-width: 640px) {
  .fin-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fin-row .fin-chip { justify-self: start; }
  .fin-row .acts { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Абсолютно позиционированные скрытые подписи (.stt) иначе вылезают за прокручиваемый список и растягивают всю страницу вниз. */
.nodes, .main { position: relative; }

/* Финансы: спокойные кнопки, годы и раскрывающиеся месяцы */
.finance button { font: inherit; }
.fin-btn { background: transparent; color: var(--text); border: 1px solid var(--border-strong, var(--border)); border-radius: 999px; padding: 5px 14px; font-size: 13px; line-height: 1.3; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.fin-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.fin-btn.accent { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: color-mix(in srgb, var(--blue) 10%, transparent); }
.fin-btn.accent:hover { background: color-mix(in srgb, var(--blue) 20%, transparent); }
.fin-btn.pay { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); background: color-mix(in srgb, var(--green) 9%, transparent); }
.fin-btn.pay:hover { background: color-mix(in srgb, var(--green) 20%, transparent); }
.fin-btn.ghost { border-color: transparent; color: var(--muted); }
.fin-btn.ghost:hover { color: var(--text); }
.fin-btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.fin-btn.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }
.fin-arrow, .fin-more { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fin-arrow:hover:not(:disabled), .fin-more:hover { color: var(--text); border-color: var(--border-strong, var(--muted)); }
.fin-arrow:disabled { opacity: .3; cursor: default; }
.finance .caret { display: inline-block; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.finance .caret.left { transform: translateX(1px) rotate(135deg); }
.finance .caret.right { transform: translateX(-1px) rotate(-45deg); }
.fin-more[aria-expanded="true"] .caret, .fin-acc-head[aria-expanded="true"] .caret { transform: translateY(1px) rotate(225deg); }
.fin-years { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.fin-year { padding: 6px 18px; border-radius: 999px; border: 0; background: var(--surface); color: var(--muted); font-size: 14px; cursor: pointer; }
.fin-year:hover { color: var(--text); }
.fin-year[aria-pressed="true"] { background: color-mix(in srgb, var(--blue) 22%, var(--surface)); color: var(--text); font-weight: 600; }
.fin-accs { display: grid; gap: 8px; margin-top: 10px; }
.fin-acc { background: var(--surface); border-radius: 12px; overflow: hidden; }
.fin-acc-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.fin-acc-head .ttl { flex: 1; font-size: 16px; font-weight: 600; }
.fin-acc-head .sum { display: inline-flex; align-items: baseline; gap: 10px; font-size: 14px; }
.fin-acc-head .sum b { font-weight: 500; }
.fin-acc-head .sum em { font-style: normal; font-size: 12px; color: var(--red); }
.fin-acc-head .caret { color: var(--muted); }
.fin-acc-body { padding: 0 16px 14px; display: grid; gap: 4px; }
.fin-mini { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.fin-mini .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-acc-body .fin-btn { justify-self: start; margin-top: 6px; }
.fin-legend { margin: 8px 0 0; }

/* Финансы на телефоне: платёж в две строки (название и сумма, ниже статус и кнопки) */
@media (max-width: 640px) {
  .fin-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n amt" "chip acts"; gap: 6px 10px; padding: 10px 0; align-items: center; }
  .fin-row .n { grid-area: n; }
  .fin-row .amt { grid-area: amt; align-self: start; font-size: 14px; }
  .fin-row .fin-chip { grid-area: chip; justify-self: start; }
  .fin-row .acts { grid-area: acts; grid-column: auto; justify-content: flex-end; gap: 6px; }
  .fin-btn { padding: 4px 11px; font-size: 13px; }
  .fin-arrow, .fin-more { width: 28px; height: 28px; }
  .fin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fin-k { padding: 10px 12px; }
  .fin-k b { font-size: 18px; }
  .fin-top h2 { font-size: 20px; }
  .fin-nav b { font-size: 16px; min-width: 0; flex: 1; text-align: center; }
  .fin-acc-head { padding: 12px 14px; }
  .fin-acc-head .sum em { display: none; }
  .fin-mini { grid-template-columns: minmax(0, 1fr) auto; }
  .fin-mini .fin-chip { grid-column: 1 / -1; justify-self: start; }
}

/* Организация с несколькими платежами */
.fin-group { border-bottom: 1px solid var(--border); padding: 4px 0 8px; }
.fin-ghead { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(90px, auto) auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border-radius: 10px; }
.fin-ghead .n b { font-size: 15px; font-weight: 600; } .fin-ghead .n small { display: block; font-size: 12px; color: var(--muted); }
.fin-ghead .amt { text-align: right; font-size: 15px; } .fin-ghead .amt small { display: block; font-size: 11px; color: var(--muted); }
.fin-sub { list-style: none; margin: 4px 0 0 14px; padding: 0 0 0 12px; border-left: 2px solid var(--border); }
.fin-sub > li { border-bottom: 1px solid var(--border); } .fin-sub > li:last-child { border-bottom: 0; }
.fin-sub .fin-row { padding: 8px 0; }
.fin-sub .n b { font-weight: 500; text-transform: none; }
.fin-mini.head { border-top: 1px solid var(--border); font-weight: 600; }
.fin-mini.sub { padding-left: 14px; font-size: 12px; color: var(--muted); border-top: 0; }
@media (max-width: 640px) {
  .fin-ghead { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n amt" "chip chip"; gap: 6px 10px; padding: 10px; }
  .fin-ghead .n { grid-area: n; } .fin-ghead .amt { grid-area: amt; } .fin-ghead .fin-chip { grid-area: chip; justify-self: start; }
  .fin-sub { margin-left: 6px; padding-left: 8px; }
}

/* Доп. заработок и премии */
.fin-hbtns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fin-chip.bonus { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.plus { color: var(--green); }
.fin-row.bonus .amt { font-weight: 500; }
i.bonus { background: #1baf7a; }
.fin-bonus { border-bottom: 1px solid var(--border); }
.fin-row.bonus .n b { font-weight: 500; }
/* Вкладка «Серверы»: таблица хостов Remnawave. На узком экране строки превращаются в карточки. */
.hosts { max-width: 1800px; }
.hs-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 12px; }
.hs-search { flex: 1 1 220px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font: inherit; }
.hs-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.hs-chip { background: transparent; border: 1px solid var(--border); border-radius: 16px; padding: 5px 12px; font-size: 12px; color: var(--muted); cursor: pointer; }
.hs-chip.on { color: var(--text); background: var(--border); }
.hs-wrap { border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; background: var(--surface); }
.hs-table { width: 100%; min-width: 1655px; border-collapse: collapse; table-layout: fixed; }
.hs-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.hs-table th:nth-child(5), .hs-table th:nth-child(8), .hs-table td.hs-on, .hs-table td.hs-sum { text-align: right; }
.hs-table td.hs-day, .hs-table th:nth-child(7) { text-align: center; }
.hs-table td { line-height: 22px; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.hs-table tr:last-child td { border-bottom: 0; }
.hs-table th:nth-child(1) { width: 165px; } .hs-table th:nth-child(2) { width: 310px; } .hs-table th:nth-child(3) { width: 200px; } .hs-table th:nth-child(4) { width: 280px; } .hs-table th:nth-child(5) { width: 62px; } .hs-table th:nth-child(6) { width: 170px; } .hs-table th:nth-child(7) { width: 64px; } .hs-table th:nth-child(8) { width: 112px; } .hs-table th:nth-child(9) { width: 300px; }
.hs-ip, .hs-sni { font-family: var(--mono); font-size: 12px; }
.hs-sni { color: var(--muted); }
.hs-more { color: var(--muted); }
.hs-on { font-weight: 500; }
.hs-table td.hs-on, .hs-table td.hs-day, .hs-table td.hs-sum { white-space: nowrap; }
.hs-table tr.dis td { color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }
.hs-table tr.dis td small, .finance .hs-table tr.dis .hs-uuid, .hs-table tr.dis .hs-more { color: inherit; }
.hs-table tr.dis .hs-dot { background: var(--red); }
.hs-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.hs-dot.ok { background: var(--green); } .hs-dot.bad { background: var(--red); } .hs-dot.warn { background: var(--yellow); }
.finance .hs-uuid { color: var(--muted); font: 11.5px var(--mono); cursor: copy; overflow-wrap: anywhere; }
.finance .hs-uuid:hover { color: var(--text); } .finance .hs-uuid.done { color: var(--green); }
.finance .hs-refresh { background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 3px 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.finance .hs-refresh:hover { color: var(--text); }
.finance .hs-refresh.done { color: var(--green); }
.hs-foot { gap: 8px 12px; }
.hs-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 2px 0; font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .hs-table { min-width: 0; }
  .hs-table thead { display: none; }
  .hs-table, .hs-table tbody, .hs-table tr, .hs-table td { display: block; width: 100%; }
  .hs-table tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .hs-table tr:last-child { border-bottom: 0; }
  .hs-table td { border: 0; padding: 2px 0 2px 96px; position: relative; text-align: left !important; min-height: 22px; }
  .hs-table td::before { content: attr(data-l); position: absolute; left: 0; top: 4px; font-size: 11px; color: var(--muted); font-family: var(--sans); font-weight: 400; }
  .hs-table td[colspan] { padding-left: 0; }
  .hs-table td.hs-uuidcell:empty { display: none; }
  .hs-table td[colspan]::before { content: none; }
  .hs-chips { width: 100%; }
}
/* Схема «хосты клиента -> ноды» на вкладке «Серверы». Нажатие подсвечивает цепочку, остальное затемняется. */
.hs-view { flex: none; }
.hs-hint { flex: 1 1 240px; }
.hs-graph { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 10px; overflow-x: auto; }
.gr { display: block; width: 100%; min-width: 680px; height: auto; user-select: none; }
.gr text { font-family: var(--sans); }
.gc { cursor: pointer; outline: none; transition: opacity .15s; }
.gc-bg { fill: var(--bg); stroke: var(--border); stroke-width: 1; }
.gc-t { font-size: 13px; font-weight: 500; fill: var(--text); }
.gc-s { font-size: 11px; font-family: var(--mono); fill: var(--muted); }
.gc.auto .gc-bg { stroke: color-mix(in srgb, var(--yellow) 55%, var(--border)); }
.gc.auto .gc-s { fill: var(--yellow); }
.gc.dis .gc-bg { stroke: var(--red); fill: color-mix(in srgb, var(--red) 9%, var(--bg)); }
.gc.dis .gc-t, .gc.dis .gc-s { fill: var(--red); }
.gc.orphan .gc-bg { stroke-dasharray: 4 3; }
.gc.orphan { opacity: .75; }
.gc:focus-visible .gc-bg { stroke: var(--blue); stroke-width: 2; }
.gc-dot circle { fill: var(--muted); }
.gc-dot.ok circle { fill: var(--green); } .gc-dot.warn circle { fill: var(--yellow); } .gc-dot.bad circle { fill: var(--red); }
.gc-dot .gc-on { fill: var(--muted); font-size: 11px; }
.ge { stroke: var(--muted); stroke-width: 1; opacity: .3; transition: opacity .15s; }
.ge.auto { stroke-dasharray: 3 4; }
.gr .ge.hid:not(.on) { display: none; }
.gc-tg { cursor: pointer; outline: none; }
.gc-tg rect { fill: var(--surface); stroke: color-mix(in srgb, var(--yellow) 55%, var(--border)); }
.gc-tg text { fill: var(--yellow); font-size: 15px; font-weight: 600; }
.gc-tg:hover rect, .gc-tg:focus-visible rect { fill: var(--border); }
.gr.sel .gc:not(.on) { opacity: .16; }
.gr.sel .ge:not(.on) { opacity: .05; }
.gr.sel .gc.on .gc-bg { stroke: var(--yellow); stroke-width: 1.6; }
.gr .ge.on { stroke: var(--yellow); stroke-width: 1.8; opacity: 1; }
.hs-selbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 13px; }
.hs-selbar[hidden] { display: none; }
.hs-hidden { margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); display: grid; gap: 6px; font-size: 13px; }
.hs-hrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hs-hidden > .hs-refresh { justify-self: start; }
.dayin { display: flex; align-items: center; gap: 6px; }
.dayin input { width: 64px; }
/* Линии значений по нодам: одинаковая высота, поэтому у кластера значения разных столбцов лежат на одном уровне. */
.hs-table .ln { display: block; height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-table .ln small { margin-left: 6px; font: 11px var(--sans); color: var(--muted); }
.hs-table .ln.hs-edit { cursor: pointer; border-radius: 4px; }
.hs-table .ln.hs-edit:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.hs-table .ln.hs-edit:focus-visible { outline: 2px solid var(--blue); outline-offset: -1px; }
.hs-remark.multi::after { content: attr(data-n); margin-left: 8px; padding: 1px 7px; border-radius: 10px; font-size: 11px; white-space: nowrap; color: var(--blue); background: color-mix(in srgb, var(--blue) 16%, transparent); vertical-align: 1px; }
.hs-man { border-bottom: 1px dotted currentColor; }
.hsdlg { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; width: min(440px, 92vw); }
.hsdlg::backdrop { background: rgba(0, 0, 0, .55); }
.hsdlg h3 { margin: 0 0 2px; font-size: 16px; color: var(--text); font-weight: 600; }
.hsdlg p { margin: 4px 0 10px; }
.hsdlg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; }
.hsdlg-name { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.hsdlg-in { display: flex; align-items: center; gap: 6px; flex: none; }
.hsdlg-name small { display: block; color: var(--muted); font-size: 11px; }
.hsdlg input { width: 96px; flex: none; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; color: var(--text); font: inherit; text-align: center; }
.hsdlg-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.hsdlg-btns button { font: inherit; border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 6px; padding: 6px 14px; cursor: pointer; }
.hsdlg-btns .primary { background: var(--blue); border-color: var(--blue); color: #0b0e11; }
.hs-remark .flag-img, .hs-remark .flag-chip, .hsdlg .flag-img, .hsdlg .flag-chip, .hs-selbar .flag-img, .hs-selbar .flag-chip, .hs-hrow .flag-img, .hs-hrow .flag-chip { margin-right: 4px; vertical-align: -2px; }
.gc-chip { fill: var(--surface); stroke: var(--border); }
.gc-chiptx { font-size: 8px; font-weight: 600; fill: var(--muted); }
.hs-provwrap { position: relative; }
.finance .hs-provbtn.on { color: var(--text); background: var(--border); }
.hs-provmenu { position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); width: 280px; max-height: min(60vh, 420px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); overflow: hidden; }
.hs-provhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.hs-provlist { overflow-y: auto; padding: 4px 0; }
.hs-provopt { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.hs-provopt:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.hs-provname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-provcount { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) { .hs-provmenu { width: min(320px, 86vw); } }
.finance .hs-reload:disabled { opacity: .55; cursor: default; }
.hs-stamp { white-space: nowrap; }
.gc-cp { cursor: pointer; outline: none; }
.gc-cp .cp-bg { fill: transparent; }
.gc-cp:hover .cp-bg, .gc-cp:focus-visible .cp-bg { fill: var(--border); }
.gc-cp .ic { stroke: var(--muted); }
.gc-cp:hover .ic, .gc-cp:focus-visible .ic { stroke: var(--text); }
.gc-cp .ck { display: none; stroke: var(--green); }
.gc-cp.done .ck { display: inline; }
.gc-cp.done .cc { display: none; }
.hs-table .ln.hs-ipln { display: flex; align-items: center; gap: 4px; }
.hs-ipln .ipt { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance .hs-cp { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.finance .hs-cp:hover, .finance .hs-cp:focus-visible { background: var(--border); color: var(--text); }
.cp-ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cp-ic .ck { display: none; stroke: var(--green); }
.finance .hs-cp.done .ck { display: inline; }
.finance .hs-cp.done .cc { display: none; }
.gc.target .gc-bg { stroke: color-mix(in srgb, var(--red) 45%, var(--border)); }
.gc.target.inpanel .gc-bg { stroke: var(--border); }
.ge.rt { stroke: var(--red); stroke-width: 1.8; opacity: .65; }
.ge.rt.part { stroke-dasharray: 6 4; stroke-width: 1.5; }
.gr .ge.rt.on { stroke: var(--red); stroke-width: 2.2; opacity: 1; }
.gr.sel .gc.target.on .gc-bg { stroke: var(--red); stroke-width: 1.6; }
.gr-pill { display: none; pointer-events: none; }
.gr-pill.on { display: inline; }
.gr-pill rect { fill: var(--surface); stroke: var(--red); stroke-width: 1; }
.gr-pill text { font-size: 11px; fill: var(--text); }
.gc.profile .gc-bg { stroke: color-mix(in srgb, var(--blue) 50%, var(--border)); }
.gr.sel .gc.profile.on .gc-bg { stroke: var(--yellow); }
.hs-det { position: sticky; bottom: 8px; margin: 10px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 6px 12px 8px; box-shadow: 0 -4px 14px rgba(0, 0, 0, .25); z-index: 2; }
.hs-det[hidden] { display: none; }
.hs-dhead { display: flex; align-items: center; gap: 8px; padding: 4px 0 6px; border-bottom: 1px solid var(--border); }
.hs-dhead .hs-refresh { margin-left: auto; }
.hs-drow { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.hs-drow:last-child { border-bottom: 0; }
.hs-dk { flex: none; width: 96px; font-size: 12px; }
.hs-dv { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; user-select: text; cursor: text; }
.hs-rg { position: relative; }
.finance .hs-rg .hs-det { position: absolute; bottom: auto; margin: 0; padding: 8px 12px 10px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); z-index: 5; }
.hs-rg .hs-det::before { content: ''; position: absolute; top: -6px; left: 18px; width: 10px; height: 10px; background: var(--surface); border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg); }
.hs-dhead { gap: 8px; padding: 0 0 8px; }
.hs-dkind { flex: none; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--yellow); }
.hs-dtitle { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-dx { flex: none; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.hs-dx:hover { background: var(--border); color: var(--text); }
.hs-drow { padding: 5px 0; }
.hs-dtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hs-dk { width: auto; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hs-dhide { margin-top: 8px; width: 100%; }
