:root {
  --bg: #04070e;
  --bg2: #070c18;
  --panel: rgba(13, 21, 40, 0.78);
  --panel2: rgba(18, 29, 54, 0.85);
  --line: rgba(96, 156, 255, 0.13);
  --line2: rgba(96, 156, 255, 0.26);
  --text: #e8eefb;
  --muted: #93a3c4;
  --dim: #5f6f90;
  --accent: #0a84ff;
  --accent2: #5ac8fa;
  --glow: 0 0 0 1px rgba(10, 132, 255, .35), 0 8px 40px -8px rgba(10, 132, 255, .45);
  --ok: #30d158;
  --warn: #ff9f0a;
  --crit: #ff453a;
  --info: #64d2ff;
  --s1: #3987e5;
  --s2: #d95926;
  --r: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(10, 132, 255, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(90, 200, 250, .08), transparent 60%),
    linear-gradient(rgba(96, 156, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 156, 255, .035) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(10, 132, 255, .4); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  border-right: 1px solid var(--line); background: rgba(5, 9, 18, .65); backdrop-filter: blur(18px);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #0a84ff, #5ac8fa); box-shadow: var(--glow); font-weight: 800; color: #fff;
}
.brand b { font-size: 15px; letter-spacing: .2px; display: block; }
.brand small { color: var(--dim); font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted);
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; opacity: .9; }
.nav a:hover { background: rgba(96, 156, 255, .07); color: var(--text); }
.nav a.on { background: linear-gradient(90deg, rgba(10, 132, 255, .22), rgba(10, 132, 255, .04)); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav .count { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 69, 58, .18); color: #ff8a82; }
.side .foot { margin-top: auto; padding: 10px 12px; color: var(--dim); font-size: 12px; display: flex; justify-content: space-between; align-items: center; }
.main { padding: 26px 32px 120px; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.top .sub { color: var(--muted); }
.top .grow { flex: 1; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }

/* ---------- primitives ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(14px); padding: 18px;
}
.panel h3 { margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1.1px; display: flex; align-items: center; gap: 10px; }
.panel h3 .grow { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line2); background: rgba(96, 156, 255, .06); color: var(--text); white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: rgba(96, 156, 255, .14); border-color: rgba(96, 156, 255, .45); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #2a94ff, #0a74e8); border-color: transparent; color: #fff; box-shadow: 0 6px 24px -8px rgba(10, 132, 255, .8); }
.btn.primary:hover { background: linear-gradient(180deg, #47a3ff, #1683f5); }
.btn.danger { border-color: rgba(255, 69, 58, .45); color: #ff8a82; background: rgba(255, 69, 58, .07); }
.btn.danger:hover { background: rgba(255, 69, 58, .16); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(96, 156, 255, .08); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }
.input, select.input, textarea.input {
  background: rgba(3, 7, 15, .6); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 11px; outline: none; min-width: 0;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 132, 255, .22); }
label.f { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px;
  border: 1px solid var(--line2); color: var(--muted); background: rgba(96, 156, 255, .05); cursor: pointer; user-select: none;
}
.chip.on { background: rgba(10, 132, 255, .2); color: #fff; border-color: rgba(10, 132, 255, .6); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; background: rgba(90, 200, 250, .1); color: var(--accent2); border: 1px solid rgba(90, 200, 250, .2); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .2px; }
.badge.eol { background: rgba(255, 69, 58, .14); color: #ff8a82; }
.badge.os { background: rgba(96, 156, 255, .1); color: var(--muted); font-weight: 500; }

/* status: always icon + label, never color alone */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 99px; }
.st i { width: 14px; height: 14px; display: inline-grid; place-items: center; border-radius: 50%; font-style: normal; font-size: 10px; color: #000; font-weight: 800; }
.st.ok { background: rgba(48, 209, 88, .12); color: #6ee68f; } .st.ok i { background: var(--ok); }
.st.warn { background: rgba(255, 159, 10, .13); color: #ffbf5c; } .st.warn i { background: var(--warn); }
.st.crit { background: rgba(255, 69, 58, .14); color: #ff8a82; } .st.crit i { background: var(--crit); }
.st.info { background: rgba(100, 210, 255, .12); color: var(--info); } .st.info i { background: var(--info); }
.st.crit.pulse i { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, .7); } 70% { box-shadow: 0 0 0 8px rgba(255, 69, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0); } }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(48, 209, 88, .6); }
.dot.crit { background: var(--crit); box-shadow: 0 0 8px rgba(255, 69, 58, .7); }
.dot.off { background: var(--dim); }

/* ---------- stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }

/* ---------- fleet ---------- */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters .input { width: 260px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px 13px;
  cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; overflow: hidden;
}
.card:hover { border-color: rgba(96, 156, 255, .4); transform: translateY(-2px); box-shadow: 0 14px 40px -18px rgba(10, 132, 255, .55); }
.card.sel { border-color: var(--accent); box-shadow: var(--glow); }
.card.lv-crit::before, .card.lv-warn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.card.lv-crit::before { background: var(--crit); }
.card.lv-warn::before { background: var(--warn); }
.card.off { opacity: .72; }
.card .hd { display: flex; align-items: flex-start; gap: 10px; }
.card .nm { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .hn { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meters { display: grid; gap: 7px; margin: 13px 0 10px; }
.cb { appearance: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line2); background: rgba(3, 7, 15, .6); cursor: pointer; flex: none; margin-top: 2px; display: grid; place-items: center; }
.cb:checked { background: var(--accent); border-color: var(--accent); }
.cb:checked::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 800; }
.meter { display: grid; grid-template-columns: 44px 1fr 46px; gap: 9px; align-items: center; font-size: 12px; }
.meter .k { color: var(--muted); }
.meter .v { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: rgba(96, 156, 255, .1); border-radius: 99px; overflow: hidden; }
.bar > b { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #0a84ff, #5ac8fa); }
.bar.warn > b { background: linear-gradient(90deg, #ff9f0a, #ffc861); }
.bar.crit > b { background: linear-gradient(90deg, #ff453a, #ff7b6f); }
.card .ft { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.svc { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: rgba(96, 156, 255, .06); border: 1px solid var(--line); color: var(--muted); }
.svc.down { border-color: rgba(255, 69, 58, .5); color: #ff8a82; background: rgba(255, 69, 58, .08); }
.spark { width: 100%; height: 30px; display: block; }
.alerts-mini { font-size: 12px; color: #ffb3ad; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alerts-mini.warn { color: #ffcf85; }

/* ---------- bulk bar ---------- */
.bulk {
  position: fixed; left: calc(232px + 32px); right: 32px; bottom: 22px; z-index: 30;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 16px;
  background: rgba(10, 18, 36, .92); border: 1px solid rgba(10, 132, 255, .45); box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .7), var(--glow);
  backdrop-filter: blur(20px); animation: up .2s ease-out;
}
.bulk .n { font-weight: 700; margin-right: 6px; }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }

/* ---------- menus ---------- */
.menu { position: relative; display: inline-block; }
.menu .pop {
  position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 240px; z-index: 40; padding: 6px; border-radius: 12px;
  background: #0c1529; border: 1px solid var(--line2); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8); display: none;
}
.menu.down .pop { bottom: auto; top: calc(100% + 6px); }
.menu.open .pop { display: block; }
.pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); }
.pop button:hover { background: rgba(10, 132, 255, .18); }
.pop button small { display: block; color: var(--dim); font-size: 11.5px; }

/* ---------- tables ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-weight: 600; color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 9px 10px; border-bottom: 1px solid rgba(96, 156, 255, .07); vertical-align: middle; }
.t tr:hover td { background: rgba(96, 156, 255, .035); }
.t td.r, .t th.r { text-align: right; }
.t .acts { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: nowrap; }
.tbl-wrap { overflow-x: auto; }
.clickrow { cursor: pointer; }

/* ---------- machine view ---------- */
.mhead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.mhead h1 { margin: 0; font-size: 26px; letter-spacing: -.4px; }
.facts { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.facts b { color: var(--text); font-weight: 550; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: #fff; border-color: var(--accent); }
.tabs a:hover { color: var(--text); }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; margin-bottom: 16px; }
.chart { position: relative; }
.chart .ch-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.chart .ch-t { font-weight: 600; font-size: 13px; }
.chart .ch-v { margin-left: auto; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.chart svg { width: 100%; height: 150px; display: block; overflow: visible; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart .legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; background: #0c1529; border: 1px solid var(--line2); border-radius: 8px;
  padding: 6px 9px; font-size: 12px; white-space: nowrap; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8);
}
.tip .tt { color: var(--dim); font-size: 11px; }
.alertlist { display: grid; gap: 6px; }
.alertlist div { display: flex; gap: 10px; align-items: center; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 10px; }
.code {
  position: relative; background: rgba(2, 5, 12, .8); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 12.5px;
  overflow-x: auto; white-space: pre; color: #cfe1ff;
}
.code .cp { position: absolute; right: 8px; top: 8px; }
.pkgs { columns: 3 240px; font-family: var(--mono); font-size: 12px; color: var(--muted); max-height: 360px; overflow: auto; }
.pkgs div { break-inside: avoid; padding: 1px 0; }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(860px, 100vw); z-index: 60; background: #060b17; border-left: 1px solid var(--line2);
  box-shadow: -30px 0 80px rgba(0, 0, 0, .6); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease;
}
.drawer.open { transform: none; }
.drawer .dh { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.drawer .dh h2 { margin: 0; font-size: 16px; }
.drawer .tasks-mini { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--line); max-height: 140px; overflow: auto; }
.term { flex: 1; overflow: auto; margin: 0; padding: 16px 20px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; color: #d3e3ff; white-space: pre-wrap; word-break: break-all; background: #02050c; }
.term .cmd { color: var(--accent2); }
.drawer .df { padding: 10px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.loglist { padding: 10px 20px; border-top: 1px solid var(--line); max-height: 240px; overflow: auto; }
.loglist div { display: flex; gap: 10px; align-items: center; padding: 3px 0; font-family: var(--mono); font-size: 12px; }
.loglist span.p { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(1, 3, 8, .66); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); background: #0a1224; border: 1px solid var(--line2); border-radius: 16px; padding: 22px; box-shadow: 0 30px 80px -10px rgba(0, 0, 0, .8), var(--glow); }
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p { color: var(--muted); margin: 0 0 16px; }
.modal .fields { display: grid; gap: 12px; margin-bottom: 18px; }
.modal .tgts { max-height: 120px; overflow: auto; display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: grid; gap: 8px; }
.toast { padding: 11px 15px; border-radius: 11px; background: #0c1529; border: 1px solid var(--line2); box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .8); animation: fade .2s; max-width: 380px; }
.toast.err { border-color: rgba(255, 69, 58, .6); }
.toast.ok { border-color: rgba(48, 209, 88, .5); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .box { width: min(400px, 100%); padding: 34px 30px; border-radius: 20px; background: rgba(10, 18, 36, .8); border: 1px solid var(--line2); box-shadow: var(--glow); backdrop-filter: blur(20px); }
.login .brand { justify-content: center; padding-bottom: 26px; }
.login .brand .logo { width: 46px; height: 46px; font-size: 20px; border-radius: 14px; }
.login form { display: grid; gap: 14px; }
.login .err { color: #ff8a82; font-size: 13px; min-height: 18px; }
.scan { height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); margin: -34px -30px 30px; border-radius: 20px 20px 0 0; animation: scan 3s linear infinite; background-size: 50% 100%; background-repeat: no-repeat; }
@keyframes scan { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px 16px; align-items: center; }
  .brand { padding: 0 10px 0 0; }
  .nav { display: flex; gap: 2px; flex-wrap: wrap; }
  .side .foot { margin: 0 0 0 auto; }
  .main { padding: 18px 16px 140px; }
  .bulk { left: 16px; right: 16px; bottom: 12px; }
  .g2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
  .filters .input { width: 100%; }
  .kv { grid-template-columns: 1fr; }
}

.card .ren { border: 0; background: none; color: var(--dim); cursor: pointer; padding: 0 4px; font-size: 13px; opacity: 0; transition: opacity .15s; }
.card:hover .ren { opacity: 1; }
.card .ren:hover { color: var(--accent2); }
@media (hover: none) { .card .ren { opacity: 1; } }
