:root {
  --bg: #0a0c10;
  --panel: #11141a;
  --panel-2: #161a22;
  --hover: #1a1f29;
  --border: #212733;
  --border-soft: #1a1f28;
  --text: #e7eaf0;
  --text-2: #aab2c0;
  --muted: #6f7888;
  --accent: #7c8cff;
  --accent-2: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --idle: #6b7280;
  --radius: 12px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { display: block; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  border-right: 1px solid var(--border-soft); background: #0c0e13;
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; padding: 4px 10px 18px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 18px -4px rgba(124,140,255,.6); }
.brand-mark svg { width: 18px; height: 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 18px 10px 6px; font-weight: 600; }
.nav .srv { justify-content: space-between; }
.nav .srv .l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav .srv .l span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .srv small { color: var(--muted); font-size: 11.5px; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; font-size: 12px; color: var(--muted); }
.demo-note { border: 1px dashed #3b3f63; background: rgba(124,140,255,.06); border-radius: 10px; padding: 10px 12px; color: var(--text-2); line-height: 1.5; }
.demo-note b { color: var(--accent); }

main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 28px; background: rgba(10,12,16,.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-soft);
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px; width: 300px; }
.search:focus-within { border-color: #3a4256; box-shadow: 0 0 0 3px rgba(124,140,255,.12); }
.search svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; min-width: 0; }
kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.live { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.5); animation: pulse 2s infinite; }
.live.off .pulse { background: var(--bad); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.45); } 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }

.view { padding: 26px 28px 60px; max-width: 1480px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; font-weight: 650; display: flex; align-items: center; gap: 12px; }
h2 { font-size: 14px; margin: 0; font-weight: 600; letter-spacing: -.005em; }
.sub { color: var(--muted); margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.sub .sep::before { content: '·'; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1150px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-main, .g-2, .g-3 { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } .search { width: 180px; } }

.card { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.card-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); gap: 10px; }
.card-h .muted { font-size: 12.5px; }
.card-b { padding: 16px; }
.section { margin-top: 16px; }

.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.kpi .foot { margin-top: 8px; font-size: 12.5px; color: var(--text-2); display: flex; gap: 12px; flex-wrap: wrap; }
.kpi .spark { position: absolute; right: 0; bottom: 0; left: 0; width: 100%; height: 44px; opacity: .9; pointer-events: none; }

/* server cards */
.srv-card { padding: 18px; display: flex; flex-direction: column; gap: 16px; transition: border-color .15s, transform .15s; }
.srv-card:hover { border-color: var(--border); transform: translateY(-1px); }
.srv-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.srv-name { font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 10px; }
.srv-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.provider { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: rgba(167,139,250,.12); color: #c4b5fd; border: 1px solid rgba(167,139,250,.25); }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gauge .g-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.gauge .g-top b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: #1c212b; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .6s ease; }
.bar > i.warn { background: var(--warn); } .bar > i.bad { background: var(--bad); } .bar > i.ok { background: var(--ok); }
.gauge .g-sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; font-variant-numeric: tabular-nums; }
.status-strip { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.status-strip span { display: flex; align-items: center; gap: 6px; }

/* status */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--idle); }
.dot.running, .dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.14); }
.dot.paused { background: var(--warn); box-shadow: 0 0 0 3px rgba(251,191,36,.14); }
.dot.errored, .dot.offline { background: var(--bad); box-shadow: 0 0 0 3px rgba(248,113,113,.16); }
.dot.restarting, .dot.pending { background: var(--info); box-shadow: 0 0 0 3px rgba(96,165,250,.14); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 550; border: 1px solid; white-space: nowrap; text-transform: capitalize; }
.pill.running, .pill.online { color: #6ee7b7; background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.25); }
.pill.paused { color: #fcd34d; background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.28); }
.pill.stopped { color: #a1a8b5; background: rgba(107,114,128,.1); border-color: rgba(107,114,128,.3); }
.pill.errored, .pill.offline { color: #fca5a5; background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.3); }
.pill.restarting, .pill.pending { color: #93c5fd; background: rgba(96,165,250,.08); border-color: rgba(96,165,250,.28); }
.pill .dot { box-shadow: none; width: 6px; height: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); }
.tag.docker { color: #7dd3fc; border-color: rgba(125,211,252,.22); background: rgba(125,211,252,.06); }
.tag.pm2 { color: #86efac; border-color: rgba(134,239,172,.22); background: rgba(134,239,172,.06); }
.tag.systemd { color: #fdba74; border-color: rgba(253,186,116,.22); background: rgba(253,186,116,.06); }

/* lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border-soft); }
.li:last-child { border-bottom: 0; }
a.li:hover { background: var(--hover); }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .r { text-align: right; font-size: 12.5px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #0b0d12; flex: none; text-transform: uppercase; }
.avatar.sm { width: 20px; height: 20px; font-size: 9.5px; }
.who { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.alert-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 13px; }
.alert-ico.bad { background: rgba(248,113,113,.12); color: var(--bad); }
.alert-ico.warn { background: rgba(251,191,36,.12); color: var(--warn); }
.all-good { display: flex; gap: 12px; align-items: center; padding: 18px 16px; color: var(--text-2); }

/* table */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.chips { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 9px; border: 1px solid var(--border-soft); }
.chip { border: 0; background: none; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 550; display: flex; gap: 6px; align-items: center; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
select.sel, input.inp { background: var(--bg); border: 1px solid var(--border-soft); color: var(--text); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 12.5px; outline: 0; }
select.sel:focus, input.inp:focus { border-color: #3a4256; }
.spacer { flex: 1; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; user-select: none; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--text-2); }
th .arr { opacity: .8; margin-left: 4px; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; white-space: nowrap; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
.wname { font-weight: 600; }
.wsub { color: var(--muted); font-size: 12px; margin-top: 2px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.meter { display: flex; align-items: center; gap: 9px; min-width: 120px; }
.meter .bar { width: 56px; height: 5px; flex: none; }
.meter span { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); }

/* detail */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0; }
.fact { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft); min-width: 0; }
.fact .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 5px; }
.fact .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deploy-hero { display: flex; gap: 16px; align-items: flex-start; padding: 18px; }
.deploy-hero .avatar { width: 40px; height: 40px; font-size: 15px; }
.deploy-hero .msg { font-size: 15px; font-weight: 550; margin-bottom: 6px; }
.commit { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; font-weight: 550; font-size: 13px; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: #2c3444; }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b0d12; }
.btn.primary:hover { background: #8d9bff; }
.btn.danger { color: #fca5a5; }
.btn.danger:hover { border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.08); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: wait; }

.chart { position: relative; height: 180px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .tip { position: absolute; top: 4px; pointer-events: none; background: #0b0d12; border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; transform: translateX(-50%); display: none; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; }
.chart-head .big { font-size: 22px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.logs { background: #07080b; border-top: 1px solid var(--border-soft); font-family: var(--mono); font-size: 12px; line-height: 1.65; padding: 12px 16px; height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; color: #c3cad6; border-radius: 0 0 var(--radius) var(--radius); }
.logs .ts { color: #59627a; }
.logs .err { color: #fca5a5; }
.logs .warn { color: #fcd34d; }
.logs mark { background: rgba(124,140,255,.35); color: white; border-radius: 2px; }

.kv-list { font-family: var(--mono); font-size: 12px; }
.kv-list div { display: flex; gap: 10px; padding: 7px 16px; border-bottom: 1px solid var(--border-soft); }
.kv-list div:last-child { border-bottom: 0; }
.kv-list .k { color: var(--muted); flex: 0 0 40%; overflow: hidden; text-overflow: ellipsis; }
.kv-list .v { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }

/* timeline */
.timeline { padding: 6px 0; }
.day { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 14px 18px 6px; }
.ev { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 10px 18px; align-items: flex-start; position: relative; }
.ev:hover { background: var(--hover); }
.ev-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.ev-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ev-ico.deploy { background: rgba(124,140,255,.12); color: var(--accent); }
.ev-ico.crash, .ev-ico.removed { background: rgba(248,113,113,.12); color: var(--bad); }
.ev-ico.status, .ev-ico.restart { background: rgba(251,191,36,.1); color: var(--warn); }
.ev-ico.action { background: rgba(96,165,250,.1); color: var(--info); }
.ev-ico.created, .ev-ico.server { background: rgba(52,211,153,.1); color: var(--ok); }
.ev .line1 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ev .line1 b { font-weight: 600; }
.ev .line2 { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.ev .time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* toast / modal */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: #1a1f29; border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 30; box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(248,113,113,.4); }
.modal { position: fixed; inset: 0; background: rgba(4,5,8,.65); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 40; }
.modal[hidden] { display: none; }
.modal .box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: min(440px, 92vw); padding: 22px; box-shadow: 0 30px 70px rgba(0,0,0,.55); }
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { color: var(--text-2); margin: 0 0 20px; }
.modal .btns { justify-content: flex-end; }

.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
