:root {
  --bg: #05070b;
  --panel: rgba(7, 18, 31, .74);
  --panel2: rgba(10, 28, 47, .58);
  --line: rgba(69, 190, 255, .34);
  --line2: rgba(138, 92, 246, .24);
  --cyan: #31d8ff;
  --blue: #4da3ff;
  --purple: #8b5cf6;
  --orange: #ffb454;
  --red: #ff5c7a;
  --green: #39e7c5;
  --text: #eaf7ff;
  --muted: #8ba8bc;
  --shadow: 0 0 42px rgba(21, 151, 255, .16);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.space-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% -20%, rgba(27, 111, 190, .42), transparent 38%),
    radial-gradient(circle at 88% 12%, rgba(139, 92, 246, .16), transparent 30%),
    radial-gradient(circle at 12% 80%, rgba(49, 216, 255, .10), transparent 32%),
    linear-gradient(135deg, #03050a 0%, #07111d 52%, #020409 100%);
}
.space-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .28;
  background-image:
    linear-gradient(rgba(73, 176, 255, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 176, 255, .10) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(460px, 100%);
  padding: 30px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid rgba(49, 216, 255, .18);
  background: linear-gradient(180deg, rgba(5, 12, 22, .86), rgba(8, 18, 31, .48));
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin-bottom: 18px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(49, 216, 255, .26), rgba(139, 92, 246, .20));
  border: 1px solid rgba(49, 216, 255, .55);
  box-shadow: 0 0 24px rgba(49, 216, 255, .25);
}
.brand-title { font-size: 20px; font-weight: 900; letter-spacing: .5px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.nav { display: grid; gap: 8px; }
.nav button {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  color: #ccecff;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 15px;
}
.nav button.active,
.nav button:hover {
  border-color: rgba(49, 216, 255, .42);
  background: linear-gradient(90deg, rgba(0, 136, 255, .22), rgba(139, 92, 246, .08));
  box-shadow: inset 3px 0 0 var(--cyan), 0 0 18px rgba(49, 216, 255, .12);
}

.main {
  padding: 18px 24px 34px;
  min-width: 0;
}

.statusbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 13px 16px;
}

.status-items { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid rgba(49, 216, 255, .25);
  border-radius: 999px;
  color: #bfeeff;
  background: rgba(5, 14, 26, .62);
}

.glass {
  background: linear-gradient(145deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 32px rgba(49, 216, 255, .045);
  backdrop-filter: blur(16px);
  border-radius: 22px;
}

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 18px;
}
.page-title h1 { margin: 0; font-size: clamp(26px, 3vw, 42px); letter-spacing: .5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric {
  padding: 18px;
  min-height: 124px;
  position: relative;
  overflow: hidden;
}
.metric::after {
  content: "";
  position: absolute;
  inset: auto -20% -50% 35%;
  height: 100px;
  background: radial-gradient(circle, rgba(49,216,255,.24), transparent 62%);
}
.metric-label { color: #9cc8dc; font-size: 14px; }
.metric-value { margin-top: 10px; font-size: 34px; font-weight: 900; color: var(--cyan); }
.metric-sub { margin-top: 8px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}
.two-col { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.card { padding: 18px; }
.card h3 { margin: 0 0 12px; }

.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}
.table th, .table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, .13);
  color: #d9edf7;
  vertical-align: top;
}
.table th { color: #86cdea; font-size: 13px; font-weight: 700; }

.node-card, .app-card, .deploy-card {
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.node-card:hover, .app-card:hover, .deploy-card:hover {
  transform: translateY(-3px);
  border-color: rgba(49, 216, 255, .62);
  box-shadow: 0 0 36px rgba(49, 216, 255, .18);
}

.kv {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(148,163,184,.12);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .22);
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}
.ok { color: var(--green); }
.warn { color: var(--orange); }
.bad { color: var(--red); }
.info { color: var(--cyan); }

button, .btn {
  border: 1px solid rgba(49,216,255,.42);
  background: linear-gradient(135deg, rgba(14,116,144,.34), rgba(37,99,235,.18));
  color: #eaf9ff;
  border-radius: 13px;
  padding: 10px 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .15s ease;
}
button:hover, .btn:hover { box-shadow: 0 0 22px rgba(49,216,255,.22); transform: translateY(-1px); }
button.ghost { background: rgba(255,255,255,.03); border-color: rgba(148, 163, 184, .24); }
button.danger { border-color: rgba(255,92,122,.45); background: rgba(127,29,29,.30); }
button:disabled { opacity: .55; cursor: wait; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
input, select, textarea {
  background: rgba(3, 9, 18, .76);
  border: 1px solid rgba(49,216,255,.26);
  color: var(--text);
  border-radius: 13px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(49,216,255,.7); box-shadow: 0 0 16px rgba(49,216,255,.12); }
.field { display: grid; gap: 6px; margin: 10px 0; }
.field label { color: #9cc8dc; font-size: 13px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .62);
}
.modal-backdrop.show { display: flex; }
.modal {
  width: min(920px, 96vw);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.modal-head h2 { margin: 0; }

.logbox {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #bcd7e6;
  max-height: 520px;
  overflow: auto;
  background: rgba(0,0,0,.28);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(148,163,184,.14);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: none;
  max-width: 520px;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1px solid rgba(49,216,255,.38);
  background: rgba(5, 15, 28, .92);
  box-shadow: var(--shadow);
}
.toast.show { display: block; }

.empty { padding: 26px; text-align: center; color: var(--muted); }
.risk-low { color: var(--green); }
.risk-medium { color: var(--orange); }
.risk-high { color: var(--red); }

@media (max-width: 1040px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .nav { grid-template-columns: repeat(3, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 14px; }
  .metrics { grid-template-columns: 1fr; }
  .nav { grid-template-columns: 1fr 1fr; }
  .statusbar, .page-title { align-items: flex-start; flex-direction: column; }
}
