:root {
  --bg: #111418;
  --panel: #1a1f26;
  --panel-2: #20262e;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --line: #2c343e;
  --head-bg: #0b0e12;
  --head-text: #d5dae2;
  --accent: #5b9cff;
  --accent-soft: #1b2f4d;
  --co-bg: #232a3d;
  --co-border: #4b57a8;
  --co-on: #6366f1;
  --tag-bg: #16302a;
  --tag-border: #2f7d5e;
  --tag-on: #10b981;
  --ok: #34d399;
  --ok-bg: #132b22;
  --warn: #fbbf24;
  --warn-bg: #3a2c0a;
  --crit: #f87171;
  --crit-bg: #3d1a1a;
  --off: #5c6672;
  --brand: #f57c00;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --size: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--size); line-height: 1.4; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; }
.muted { color: var(--muted); font-weight: normal; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

header.top { display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 46px; background: var(--head-bg); color: var(--head-text); }
header.top .brand { color: var(--brand); font-weight: 800; font-size: 22px; letter-spacing: 4px; margin-left: 14px; }
header.top nav { margin-left: 40px; }
header.top nav a { color: var(--head-text); padding: 6px 10px; border-radius: var(--radius); }
header.top nav a.active, header.top nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
header.top .spacer { flex: 1; }
header.top .user { font-weight: 600; }

.btn { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.primary { background: var(--accent); color: #06101f; border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--crit); border-color: var(--crit); }
header.top .btn { background: transparent; color: var(--head-text); border-color: rgba(255,255,255,.3); }

.login { max-width: 320px; margin: 80px auto; background: var(--panel); padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); }
.login h1 { text-align: center; letter-spacing: 3px; margin-bottom: 16px; color: var(--brand); }
.login label { display: block; margin-bottom: 12px; }
.login input { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; background: var(--bg); color: var(--text); }
.login .btn { width: 100%; }
.login .error { color: var(--crit); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; margin: 6px 0 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; }
.chip.co { background: var(--co-bg); border-color: var(--co-border); }
.chip.co.on { background: var(--co-on); border-color: var(--co-on); color: #fff; font-weight: 600; }
.chip.tag { background: var(--tag-bg); border-color: var(--tag-border); border-radius: 4px; }
.chip.tag.on { background: var(--tag-on); border-color: var(--tag-on); color: #05201a; font-weight: 600; }
.chips.tags { padding-left: 18px; border-left: 2px solid var(--line); }
.chip.sm { padding: 1px 7px; font-size: 11px; }
.chip:hover { text-decoration: none; border-color: var(--muted); }
.counts { display: flex; gap: 6px; margin-left: auto; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill.crit { background: var(--crit-bg); color: var(--crit); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--line); color: var(--text); }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 0; }
.tabs a { flex: 1; text-align: center; padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs.small a { flex: 0 0 auto; }
.tabs a.active { color: #fff; background: var(--accent-soft); border-bottom-color: var(--accent); border-radius: var(--radius) var(--radius) 0 0; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs.small a { padding: 4px 10px; font-size: 13px; }

table.data { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-top: none; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
table.data th.num { text-align: right; }
table.data th a { color: var(--muted); }
table.data th.sorted a { color: var(--accent); }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: var(--panel-2); }
table.data tr.crit td:first-child { box-shadow: inset 4px 0 0 var(--crit); }
table.data tr.warn td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
table.data tr.ok td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
table.data tr.off td { color: var(--off); }
table.data td.empty { text-align: center; color: var(--muted); padding: 30px; }
td.crit { color: var(--crit); font-weight: 700; }
td.warn { color: var(--warn); font-weight: 600; }
a.srv { font-weight: 600; color: var(--text); }

.prob { display: inline-block; padding: 2px 8px; margin: 1px 2px 1px 0; border-radius: 4px; font-size: 12.5px; }
.prob.warn { background: var(--warn-bg); color: var(--warn); }
.prob.crit { background: var(--crit-bg); color: var(--crit); }
.prob b { text-transform: uppercase; font-size: 10.5px; letter-spacing: .3px; margin-right: 4px; }

.fw { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 4px; background: var(--crit-bg); color: var(--crit); }
.fw.csf_ok { background: var(--ok-bg); color: var(--ok); }
.fw.iptables_only { background: var(--warn-bg); color: var(--warn); }

.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 12px; flex-wrap: wrap; }
.pagehead .actions { display: flex; gap: 6px; align-items: center; }
.notice { padding: 8px 12px; border-radius: var(--radius); margin: 0 0 12px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.crit { background: var(--crit-bg); color: var(--crit); }
.notice.off { background: var(--line); color: var(--text); }
.problems { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.problems .prob { font-size: 13.5px; padding: 5px 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; }
.card dl { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; margin: 0; }
.card dt { color: var(--muted); }
.card dd { margin: 0; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th { text-align: left; color: var(--muted); font-weight: 600; padding: 3px 6px; border-bottom: 1px solid var(--line); }
table.mini th.num { text-align: right; }
table.mini td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.cols { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.cols table { flex: 1; min-width: 180px; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 12px; margin-bottom: 16px; }
svg.chart { width: 100%; height: 140px; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
svg.chart .lbl { font-size: 10px; fill: var(--muted); text-anchor: end; }

.form .row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; min-width: 160px; }
.form label.wide { flex-basis: 100%; }
.form label.check { flex-direction: row; align-items: center; color: var(--text); min-width: auto; flex: 0 1 auto; margin-right: 10px; }
.form input, .form select, .form textarea { padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; color: var(--text); background: var(--bg); }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; width: 100%; }
.form fieldset legend { color: var(--muted); font-size: 12px; }
.form .row.actions { justify-content: flex-start; }
.form.narrow { max-width: 560px; }
.settings-row { flex-direction: row !important; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.settings-row input { width: 110px; text-align: right; }
input.inline { padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; width: 100%; background: var(--bg); color: var(--text); }
.danger-zone { margin-top: 16px; }

@media (max-width: 700px) {
  header.top { gap: 8px; }
  header.top .user { display: none; }
  main { padding: 8px; }
  table.data th, table.data td { padding: 6px; }
  .charts { grid-template-columns: 1fr; }
}

.card.attached { border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.card.narrow { max-width: 640px; }
.search { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.search input { flex: 1; max-width: 520px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; }
.card table.data { border: none; }

table.data th.c, table.data td.c { text-align: center; }
td.dot { font-size: 18px; line-height: 1; }
td.dot.crit { color: var(--crit); }
td.dot.warn { color: var(--warn); }
td.agentcell { max-width: 420px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
table.data.tab-problems td.num, table.data.tab-problems th.num { white-space: nowrap; }

.passgen { display: flex; gap: 24px; align-items: stretch; flex-wrap: wrap; }
.passgen .fields { flex: 1 1 520px; max-width: 720px; }
.pgrow { margin-bottom: 18px; }
.pgrow label { display: flex; justify-content: space-between; font-weight: 700; letter-spacing: .5px; margin-bottom: 6px; }
.pgrow label .muted { font-weight: normal; letter-spacing: 0; font-size: 12.5px; }
.pgval { display: flex; gap: 8px; }
.pgval input { flex: 1; font-family: var(--mono); font-size: 17px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); letter-spacing: .5px; }
.btn.big { flex: 0 0 220px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; min-height: 180px; border-radius: 10px; background: var(--panel-2); color: var(--text); border: 2px solid #e6e9ee; }
.btn.big:hover { background: #2a323c; text-decoration: none; }

table.data th.fill, table.data td.fill { width: 0; padding: 0; }
table.data.tab-mail th.fill { width: 20%; }
table.data.tab-disk th.fill { width: 30%; }
table.data.tab-cpu th.fill { width: 10%; }
table.data.tab-mysql th.fill { width: 5%; }
table.data.tab-sent th.fill { width: 80%; }
table.data.tab-ram th.fill { width: 50%; }
table.data.tab-backup th.fill { width: 40%; }
table.data.tab-malware th.fill { width: 40%; }
table.data.tab-firewall th.fill { width: 50%; }
table.data td, table.data th { white-space: nowrap; }
table.data td.srvcol { min-width: 160px; }
table.data td.cocol { min-width: 90px; }
table.data td.num, table.data th.num { padding-left: 18px; padding-right: 18px; }
table.data td.wrap { white-space: normal; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; }
.split h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; }
.split h2 .muted { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pane-status { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 6px; }
.pane-status table.data { border: none; background: transparent; }
.pane-status table.data th { background: transparent; }
.pane-status table.data td.num, .pane-status table.data th.num { padding-left: 10px; padding-right: 10px; }
.pane-status table.data tr:last-child td { border-bottom: none; }
table.data th.grp { text-align: center; border-bottom: none; padding-bottom: 0; }
.pane-domain { padding-top: 14px; }
.domform { display: flex; gap: 8px; margin-bottom: 18px; }
.domform input { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); }
.domform input:focus { outline: none; border-color: var(--brand); }
.domform .btn { padding: 10px 20px; font-weight: 600; background: var(--brand); border-color: var(--brand); color: #1a0f00; }
.domname { font-size: 20px; font-weight: 700; margin: 0 0 12px; word-break: break-all; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; border-top: 3px solid var(--off); }
.tile.ok { border-top-color: var(--ok); }
.tile.warn { border-top-color: var(--warn); }
.tile .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tile .v { font-size: 16px; font-weight: 700; margin-top: 2px; }
.tile.ok .v { color: var(--ok); }
.tile.warn .v { color: var(--warn); }
.tile .s { font-size: 13px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.tile .s b { color: var(--text); }
table.detail { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table.detail th { text-align: left; vertical-align: top; width: 96px; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.detail td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.detail tr:last-child th, table.detail tr:last-child td { border-bottom: none; }
table.detail .line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
table.detail .line + .line { margin-top: 7px; }
table.detail .note { color: var(--muted); font-size: 13px; }
.arrow { color: var(--muted); }
.took { color: var(--muted); font-size: 12px; margin-top: 8px; text-align: right; }
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr; }
}
header.top .stamp { color: var(--head-text); font-size: 14px; white-space: nowrap; }
header.top .stamp b { color: var(--brand); font-size: 16px; font-weight: 700; margin-left: 2px; }
.pane-status table.data td.num, .pane-status table.data th.num { padding-left: 14px; padding-right: 14px; }
@media (max-width: 700px) {
  header.top { height: auto; min-height: 46px; flex-wrap: wrap; padding: 6px 10px; }
  header.top .brand { margin-left: 0; }
  header.top .stamp { font-size: 12.5px; }
  header.top .stamp b { font-size: 14px; }
}
