:root {
  --bg: #0b0b0b;
  --panel: #111111;
  --panel-2: #161616;
  --border: #262626;
  --border-2: #2f2f2f;
  --text: #ededed;
  --muted: #9a9a9a;
  --dim: #6b6b6b;
  --brand: #0f3d47;
  --brand-2: #135563;
  --accent: #38bdf8;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, .1);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, .1);
  --amber: #f5b301;
  --amber-bg: rgba(245, 179, 1, .09);
  --blue-bg: rgba(56, 130, 246, .16);
  --radius: 10px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  height: 72px; background: linear-gradient(180deg, #0f3b45, #0c3039); display: flex; align-items: center;
  padding: 0 14%; gap: 24px; border-bottom: 1px solid #0a2a31;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; letter-spacing: .2px; }
.logo svg { width: 38px; height: 22px; }
.search { flex: 1; max-width: 385px; margin: 0 auto; position: relative; }
.search input {
  width: 100%; height: 32px; border-radius: 16px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.25);
  padding: 0 44px 0 14px; outline: none; color: var(--text);
}
.search kbd { position: absolute; right: 8px; top: 7px; font-size: 10px; background: rgba(255,255,255,.12); border-radius: 4px; padding: 1px 6px; color: #ccc; }
.top-actions { display: flex; gap: 14px; align-items: center; }
.top-actions .ibtn { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.08); display: grid; place-items: center; cursor: pointer; border: 0; position: relative; }
.top-actions .ibtn:hover { background: rgba(255,255,255,.16); }
.top-actions .badge { position: absolute; top: -5px; right: -6px; background: #e11d48; color: #fff; border-radius: 9px; font-size: 9px; padding: 0 4px; font-weight: 700; }
.top-actions .link { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.menu { position: absolute; right: 0; top: 38px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; min-width: 200px; padding: 6px; z-index: 50; }
.menu .item { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: block; }
.menu .item:hover { background: #222; }
.menu .who { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ---------- layout ---------- */
.page { padding: 26px 14px 60px; max-width: 2000px; margin: 0 auto; }
.back { color: var(--muted); font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.back:hover { color: var(--text); }
.title-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; }
.title-row h1 { font-size: 20px; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.title-row .edit { color: var(--dim); cursor: pointer; width: 14px; height: 14px; }
.chip { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--blue-bg); color: #60a5fa; border: 1px solid rgba(96,165,250,.25); }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.status-pill { font-size: 10px; font-weight: 700; letter-spacing: .4px; padding: 3px 9px; border-radius: 6px; text-transform: uppercase; border: 1px solid; }
.status-running { color: var(--green); background: var(--green-bg); border-color: rgba(34,197,94,.3); }
.status-stopped, .status-suspended { color: var(--red); background: var(--red-bg); border-color: rgba(239,68,68,.3); }
.status-other { color: var(--amber); background: var(--amber-bg); border-color: rgba(245,179,1,.3); }
.iconbar { display: flex; gap: 2px; margin-left: 12px; }
.iconbar button { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: #cfcfcf; display: grid; place-items: center; }
.iconbar button:hover:not(:disabled) { background: #1d1d1d; color: #fff; }
.iconbar button:disabled { opacity: .3; cursor: not-allowed; }
.iconbar svg, .icon { width: 15px; height: 15px; }

.tabs { display: inline-flex; background: #1a1a1a; border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; margin-bottom: 20px; }
.tabs a { padding: 5px 9px; border-radius: 6px; color: #bdbdbd; font-weight: 500; font-size: 12.5px; }
.tabs a:hover { color: #fff; }
.tabs a.active { background: #0d0d0d; color: #fff; font-weight: 700; border: 1px solid #333; padding: 4px 8px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.card-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 11px; color: var(--muted); }
.card-body { padding: 0 14px 14px; }
.sep { border-top: 1px solid var(--border); }

.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 10px 11px 12px; min-height: 72px; }
.tile .k { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.tile .v { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.tile .v.sans { font-family: var(--sans); font-weight: 600; }
.tile .s { font-size: 10px; color: var(--muted); margin-top: 3px; }
.tile .ok { color: var(--green); display: inline-flex; gap: 4px; align-items: center; font-size: 10.5px; }
.tile .bad { color: var(--red); display: inline-flex; gap: 4px; align-items: center; font-size: 10.5px; }
.mt { margin-top: 14px; }
.mt2 { margin-top: 22px; }

.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.res { border: 1px solid var(--border); border-radius: 6px; padding: 12px 12px 14px; background: #0f0f0f; }
.res .k { display: flex; gap: 6px; align-items: center; color: #cfcfcf; font-size: 12px; }
.res .k .act { margin-left: auto; color: #1e6f80; font-size: 10px; cursor: pointer; }
.res .v { font-family: var(--mono); font-size: 20px; font-weight: 700; margin: 12px 0 8px; }
.res .s { font-size: 10px; color: var(--muted); }
.subhead { display: flex; align-items: center; margin-top: 16px; font-size: 12px; font-weight: 600; color: #cfcfcf; }
.subhead .act { margin-left: auto; color: #1e6f80; font-size: 10px; font-weight: 400; cursor: pointer; }

.nic { background: #161616; border-radius: 6px; padding: 10px 10px 12px; }
.nic .row1 { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.nic .row1 b { color: var(--text); font-weight: 600; }
.tag-green { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,.3); border-radius: 5px; font-size: 9.5px; padding: 1px 6px; }
.tag-blue { background: var(--blue-bg); color: #60a5fa; border: 1px solid rgba(96,165,250,.3); border-radius: 5px; font-size: 9.5px; padding: 1px 6px; }
.tag-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(245,179,1,.3); border-radius: 5px; font-size: 9.5px; padding: 1px 6px; }
.tag-red { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,.3); border-radius: 5px; font-size: 9.5px; padding: 1px 6px; }
.ip { font-family: var(--mono); font-size: 13px; margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.ip .copy { color: var(--dim); cursor: pointer; font-size: 11px; }
.ip .copy:hover { color: var(--text); }
.nic .meta { font-family: var(--mono); font-size: 10.5px; color: #bdbdbd; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 28px; }
.nic .meta span b { font-family: var(--sans); font-weight: 400; color: var(--muted); }

/* ---------- buttons / forms ---------- */
.btn { display: inline-flex; gap: 6px; align-items: center; height: 28px; padding: 0 11px; border-radius: 7px; border: 1px solid var(--border-2); background: #141414; cursor: pointer; font-size: 12px; font-weight: 600; white-space: nowrap; }
.btn:hover:not(:disabled) { background: #1d1d1d; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.green { color: var(--green); border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.06); border-radius: 14px; }
.btn.teal { color: #9fd3de; border-color: #1c4a55; background: #0f2a31; border-radius: 14px; }
.btn.primary { background: #135563; border-color: #1b6b7c; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #186a7b; }
.btn.danger { color: #fca5a5; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.btn.link { border: 0; background: transparent; color: #2a8aa0; padding: 0 4px; }
.btn.sm { height: 24px; font-size: 11px; padding: 0 9px; }
.input, textarea.input, select.input {
  width: 100%; background: #141414; border: 1px solid var(--border-2); border-radius: 7px; padding: 8px 12px; outline: none; color: var(--text);
}
.input:focus { border-color: #3a3a3a; box-shadow: 0 0 0 2px rgba(56,189,248,.12); }
textarea.input { min-height: 52px; resize: vertical; }
label.lbl { display: block; font-size: 12px; font-weight: 600; margin: 0 0 7px; }
.field { margin-bottom: 14px; }
.hint { font-size: 10.5px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; }
.tagchip { display: inline-flex; align-items: center; gap: 6px; background: #1a1a1a; border: 1px solid var(--border-2); border-radius: 12px; padding: 2px 6px 2px 10px; font-size: 11.5px; margin: 0 6px 8px 0; font-family: var(--mono); }
.tagchip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); }

/* ---------- lists ---------- */
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 11.5px; }
.list-row + .list-row { border-top: 1px solid #1c1c1c; }
.list-row .when { margin-left: auto; color: #cfcfcf; font-size: 11px; white-space: nowrap; }
.pill { font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.pill.green { background: rgba(34,197,94,.14); color: var(--green); }
.pill.red { background: rgba(239,68,68,.14); color: var(--red); }
.pill.amber { background: rgba(245,179,1,.14); color: var(--amber); }
.pill.blue { background: rgba(56,130,246,.16); color: #60a5fa; }
.pill.gray { background: #222; color: #bbb; }
.details { color: var(--muted); font-family: var(--mono); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }

.warn { background: #2a1d02; border-top: 1px solid #3a2a05; border-bottom: 1px solid #3a2a05; color: var(--amber); font-size: 10.5px; padding: 10px 14px 10px 34px; position: relative; line-height: 1.6; }
.warn svg { position: absolute; left: 14px; top: 13px; width: 12px; height: 12px; }
.empty { text-align: center; color: #cfcfcf; padding: 28px 10px; font-size: 11.5px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 11px; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #1b1b1b; vertical-align: middle; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:hover td { background: #141414; }

/* ---------- servers list ---------- */
.list-head { display: flex; align-items: center; margin: 4px 0 18px; gap: 12px; }
.list-head h1 { margin: 0; font-size: 20px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.bar { height: 5px; background: #222; border-radius: 3px; overflow: hidden; width: 120px; }
.bar > i { display: block; height: 100%; background: #2a8aa0; }
.bar.warn > i { background: var(--amber); }
.bar.full > i { background: var(--red); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.stat .k { color: var(--muted); font-size: 11px; }
.stat .v { font-family: var(--mono); font-size: 22px; font-weight: 700; margin-top: 6px; }

/* ---------- performance ---------- */
.perf-head { display: flex; align-items: center; gap: 10px; padding: 16px 14px 12px; }
.perf-head h3 { margin: 0; font-size: 15px; }
.perf-head .ctl { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.seg { display: inline-flex; background: #141414; border: 1px solid var(--border-2); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 11px; font-size: 11px; cursor: pointer; color: #cfcfcf; font-weight: 600; }
.seg button.active { background: #0f3b45; color: #9fe1ef; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; color: #cfcfcf; cursor: pointer; user-select: none; }
.toggle i { width: 28px; height: 15px; border-radius: 9px; background: #333; position: relative; display: inline-block; transition: .2s; }
.toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle.on i { background: #38bdf8; }
.toggle.on i::after { left: 15px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 0 14px; }
.kpi { border: 1px solid var(--border); border-radius: 7px; padding: 10px 11px 12px; position: relative; background: #0f0f0f; }
.kpi .k { color: #cfcfcf; font-size: 11px; display: flex; gap: 5px; align-items: center; }
.kpi .v { font-family: var(--mono); font-size: 15px; font-weight: 700; margin-top: 10px; }
.kpi svg.spark { position: absolute; right: 10px; top: 10px; width: 70px; height: 22px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px; }
.chart-card { border: 1px solid var(--border); border-radius: 7px; padding: 12px 12px 8px; background: #0b0b0b; position: relative; }
.chart-card h4 { margin: 0 0 4px; font-size: 12px; font-weight: 700; }
.chart-card .tools { position: absolute; right: 18px; top: 50px; display: flex; gap: 10px; color: #bbb; }
.chart { width: 100%; height: 280px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.legend { display: flex; justify-content: center; gap: 14px; font-size: 10.5px; color: #cfcfcf; margin-top: 2px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 2px; display: inline-block; position: relative; }
.legend i::after { content: ''; position: absolute; left: 4px; top: -2px; width: 6px; height: 6px; border-radius: 50%; background: inherit; }
.tooltip { position: absolute; pointer-events: none; background: rgba(20,20,20,.96); border: 1px solid #333; border-radius: 6px; padding: 6px 9px; font-size: 11px; white-space: nowrap; z-index: 5; }
.tooltip .t { color: var(--muted); margin-bottom: 3px; }
.brush { margin: 6px 0 4px 46px; height: 22px; border: 1px solid #2a2a40; background: #16162a; border-radius: 2px; position: relative; }
.brush .h { position: absolute; top: -3px; width: 5px; height: 26px; background: #fff; border-radius: 2px; cursor: ew-resize; }
.brush .w { position: absolute; top: 0; bottom: 0; background: rgba(120,120,200,.15); cursor: grab; }
.brush svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.traffic-card { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 14px; padding: 0 14px 14px; }
.big-bar { height: 8px; border-radius: 4px; background: #222; overflow: hidden; margin-top: 10px; }
.big-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1b8aa0, #38bdf8); }
.big-bar.full i { background: var(--red); }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: grid; place-items: center; z-index: 100; }
.modal { max-height: 92vh; overflow-y: auto; width: min(520px, 94vw); background: #121212; border: 1px solid #2c2c2c; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h3 { margin: 0; padding: 16px 18px 6px; font-size: 15px; }
.modal .body { padding: 8px 18px 4px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #171717; border: 1px solid #2d2d2d; border-left: 3px solid #38bdf8; padding: 10px 14px; border-radius: 8px; min-width: 260px; max-width: 420px; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
.secret { background: #0b0b0b; border: 1px dashed #333; border-radius: 6px; padding: 10px; font-family: var(--mono); word-break: break-all; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, #0f3b45 0%, #0b0b0b 60%); }
.login { width: 360px; background: #111; border: 1px solid #262626; border-radius: 14px; padding: 28px 26px; }
.login .logo { justify-content: center; margin-bottom: 22px; }
.err-msg { color: #fca5a5; font-size: 12px; min-height: 18px; margin-bottom: 6px; }

.spin { width: 14px; height: 14px; border: 2px solid #444; border-top-color: #38bdf8; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px; text-align: center; color: var(--muted); }

.admin-nav { display: flex; gap: 6px; margin-bottom: 18px; }

@media (max-width: 1100px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .kpis, .stat-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 16px; }
  .traffic-card { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-6, .res-grid { grid-template-columns: 1fr 1fr; }
  .title-row { flex-wrap: wrap; }
  .head-right { margin-left: 0; }
  .search { display: none; }
}
@media print {
  .topbar, .iconbar, .tabs, .perf-head .ctl, .back { display: none !important; }
}
