:root {
  --bg: #070a12;
  --bg2: #0c1120;
  --card: rgba(22, 29, 48, 0.62);
  --card-border: rgba(148, 163, 255, 0.10);
  --text: #e6e9f5;
  --muted: #8b93b0;
  --dim: #5b6382;
  --accent: hsl(252, 92%, 70%);
  --accent2: hsl(190, 90%, 58%);
  --ok: hsl(152, 68%, 52%);
  --warn: hsl(38, 96%, 60%);
  --crit: hsl(350, 88%, 64%);
  --cpu: hsl(252, 92%, 70%);
  --mem: hsl(190, 90%, 58%);
  --disk: hsl(38, 96%, 60%);
  --net: hsl(152, 68%, 52%);
  --radius: 18px;
  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* nền gradient động */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span {
  position: absolute; border-radius: 50%; filter: blur(110px); opacity: .35;
  animation: float 26s ease-in-out infinite;
}
.bg-orbs span:nth-child(1) { width: 560px; height: 560px; background: hsl(252, 90%, 55%); top: -180px; left: -140px; }
.bg-orbs span:nth-child(2) { width: 480px; height: 480px; background: hsl(190, 90%, 45%); bottom: -200px; right: -120px; animation-delay: -9s; }
.bg-orbs span:nth-child(3) { width: 360px; height: 360px; background: hsl(320, 80%, 50%); top: 40%; left: 55%; opacity: .16; animation-delay: -17s; }
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, 40px) scale(1.08); }
  66% { transform: translate(-40px, 30px) scale(.95); }
}

/* ---------- layout ---------- */
.container { max-width: 1440px; margin: 0 auto; padding: 28px 28px 60px; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 26px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 30px -6px hsla(252, 92%, 60%, .6);
}
.brand-logo svg { width: 24px; height: 24px; }
.brand h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand p { font-size: 13px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }

.top-actions { display: flex; align-items: center; gap: 10px; }
.live {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--card-border);
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
.live.offline i { background: var(--crit); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 hsla(152, 68%, 52%, .6); }
  70% { box-shadow: 0 0 0 9px hsla(152, 68%, 52%, 0); }
  100% { box-shadow: 0 0 0 0 hsla(152, 68%, 52%, 0); }
}

.btn {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer;
  padding: 8px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--card-border);
  transition: all .2s ease;
}
.btn:hover { border-color: hsla(252, 92%, 70%, .5); background: hsla(252, 92%, 70%, .1); }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  position: relative;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  animation: rise .6s cubic-bezier(.2,.8,.2,1) both;
}
.card:hover { border-color: rgba(148, 163, 255, .22); box-shadow: 0 20px 50px -24px rgba(0,0,0,.7); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 16px;
}
.card-title small { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--dim); font-weight: 500; font-family: var(--mono); }

.grid { display: grid; gap: 18px; }
.grid-hero { grid-template-columns: 1.15fr 2fr; margin-bottom: 18px; }
.grid-gauges { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.grid-3 { grid-template-columns: 1.3fr 1fr 1fr; margin-bottom: 18px; }

/* ---------- health hero ---------- */
.health { display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.health::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: .18; pointer-events: none;
  background: radial-gradient(circle at 85% 0%, var(--state, var(--ok)), transparent 60%);
  transition: background .6s;
}
.health-head { display: flex; align-items: center; gap: 18px; }
.score-ring { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 800; letter-spacing: -.03em;
}
.health-state { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--state, var(--ok)); }
.health-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.issues { list-style: none; margin-top: 18px; display: flex; flex-direction: column; gap: 8px; max-height: 120px; overflow: auto; }
.issues li {
  font-size: 13px; padding: 9px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.05);
}
.issues li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--c); box-shadow: 0 0 10px var(--c); }
.issues li.warn { --c: var(--warn); }
.issues li.crit { --c: var(--crit); }
.issues li.ok { --c: var(--ok); }

.info-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.info-row div { background: rgba(255,255,255,.03); border-radius: 12px; padding: 10px 12px; }
.info-row span { display: block; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.info-row b { display: block; font-size: 14px; font-weight: 600; margin-top: 3px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- gauges ---------- */
.gauge { text-align: center; padding: 22px 16px; }
.gauge .ring { position: relative; width: 132px; height: 132px; margin: 4px auto 12px; }
.gauge .ring svg { transform: rotate(-90deg); overflow: visible; }
.gauge .ring .track { stroke: rgba(255,255,255,.06); }
.gauge .ring .bar { transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1), stroke .4s; filter: drop-shadow(0 0 8px var(--g)); }
.gauge .ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .ring .pct { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.gauge .ring .pct sup { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 1px; }
.gauge .label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.gauge .detail { font-size: 13px; color: var(--text); margin-top: 6px; font-family: var(--mono); }
.gauge .detail2 { font-size: 12px; color: var(--dim); margin-top: 3px; font-family: var(--mono); }

/* ---------- charts ---------- */
.chart-wrap { position: relative; height: 210px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.chart-legend i { width: 10px; height: 3px; border-radius: 2px; background: var(--c); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; font-size: 12px; font-family: var(--mono);
  background: rgba(10, 14, 26, .92); border: 1px solid var(--card-border); border-radius: 10px;
  padding: 8px 10px; white-space: nowrap; opacity: 0; transition: opacity .15s; transform: translate(-50%, -110%);
}
.chart-tip b { color: var(--muted); font-weight: 500; display: block; margin-bottom: 3px; }

.range-tabs { display: inline-flex; background: rgba(255,255,255,.04); border-radius: 10px; padding: 3px; }
.range-tabs button {
  font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 5px 11px; border-radius: 8px; transition: all .2s; font-weight: 500; text-transform: none; letter-spacing: 0;
}
.range-tabs button.active { background: hsla(252, 92%, 70%, .18); color: var(--text); }

/* ---------- cores ---------- */
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.core { background: rgba(255,255,255,.03); border-radius: 10px; padding: 8px; }
.core span { font-size: 10px; color: var(--dim); font-family: var(--mono); }
.core b { display: block; font-size: 13px; font-family: var(--mono); margin: 2px 0 6px; }
.core .mini { height: 4px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; }
.core .mini div { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .8s ease; }

.stat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat-list div { background: rgba(255,255,255,.03); border-radius: 12px; padding: 10px 12px; }
.stat-list span { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.stat-list b { display: block; font-size: 16px; font-family: var(--mono); margin-top: 3px; font-weight: 600; }

/* ---------- disks ---------- */
.disk { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.disk:last-child { border-bottom: 0; }
.disk-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 8px; }
.disk-head b { font-family: var(--mono); font-weight: 600; }
.disk-head small { color: var(--dim); font-family: var(--mono); margin-left: 6px; }
.disk-head span { font-family: var(--mono); color: var(--muted); font-size: 12px; }
.bar-line { height: 8px; border-radius: 8px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar-line div { height: 100%; border-radius: 8px; transition: width .8s ease; background: var(--bc, linear-gradient(90deg, var(--ok), var(--accent2))); }

/* ---------- net ---------- */
.net-now { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.net-now div { background: rgba(255,255,255,.03); border-radius: 12px; padding: 12px; }
.net-now span { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; gap: 6px; }
.net-now b { display: block; font-size: 20px; font-family: var(--mono); margin-top: 4px; font-weight: 700; }
.net-now em { font-style: normal; font-size: 11px; color: var(--dim); font-family: var(--mono); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; padding: 0 8px 10px; }
td { padding: 9px 8px; border-top: 1px solid rgba(255,255,255,.05); font-family: var(--mono); }
td.name { font-family: var(--font); font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.num, th.num { text-align: right; }
tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,.03); }
.pbar { display: inline-block; width: 46px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.06); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.svc-list { display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow: auto; }
.svc {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.04);
}
.svc .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex-shrink: 0; }
.svc.down .dot { background: var(--crit); box-shadow: 0 0 10px var(--crit); }
.svc .n { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc .n small { display: block; font-weight: 400; color: var(--dim); font-size: 11px; font-family: var(--mono); margin-top: 2px; }
.tag { font-size: 10px; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.06); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.tag.docker { background: hsla(200, 90%, 55%, .15); color: hsl(200, 90%, 70%); }
.empty { color: var(--dim); font-size: 13px; padding: 20px 0; text-align: center; line-height: 1.6; }
.empty code { font-family: var(--mono); color: var(--muted); background: rgba(255,255,255,.05); padding: 2px 6px; border-radius: 5px; }

footer { text-align: center; color: var(--dim); font-size: 12px; margin-top: 30px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; padding: 38px 34px; }
.login-card .brand { justify-content: center; flex-direction: column; text-align: center; margin-bottom: 28px; }
.login-card .brand-logo { width: 60px; height: 60px; border-radius: 18px; }
.login-card .brand-logo svg { width: 30px; height: 30px; }
.login-card h1 { font-size: 24px; margin-top: 8px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); outline: none; transition: all .2s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px hsla(252, 92%, 70%, .15); }
.btn-primary {
  width: 100%; font: inherit; font-size: 15px; font-weight: 600; color: #fff; cursor: pointer; margin-top: 8px;
  padding: 13px; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--accent), hsl(220, 90%, 62%));
  box-shadow: 0 10px 30px -10px hsla(252, 92%, 60%, .7); transition: transform .15s, box-shadow .2s, opacity .2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px hsla(252, 92%, 60%, .9); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.login-err { color: var(--crit); font-size: 13px; min-height: 20px; margin-top: 12px; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid-hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .container { padding: 18px 14px 40px; }
  .grid-gauges { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .gauge .ring { width: 112px; height: 112px; }
  .gauge .ring .pct { font-size: 25px; }
  .info-row { grid-template-columns: 1fr 1fr; }
}
