:root {
  --sidebar-bg: #1e293b;
  --sidebar-bg2: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --accent: #3b82f6;
  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --teal: #14b8a6;
  --green: #10b981;
  --orange: #f59e0b;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: var(--main-bg);
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg2));
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}
.brand-icon svg { width: 20px; height: 20px; }

.brand-name {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }

.nav-group-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #64748b;
  padding: 10px 12px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--sidebar-text);
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #e2e8f0; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.06));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.agent-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
}
.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumb { font-size: 14px; color: var(--text-muted); }
.breadcrumb .sep { margin: 0 8px; color: #cbd5e1; }
.breadcrumb #hostname { color: var(--text); font-weight: 600; }

.user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; text-transform: uppercase;
}
.username { font-size: 14px; font-weight: 500; color: var(--text); }

.content { padding: 24px; display: flex; flex-direction: column; gap: 22px; }

/* ---------- 规格卡片 ---------- */
.specs {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
}

.spec {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.spec-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.spec-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.spec-value.status { color: #059669; }

.pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: #10b981;
  position: relative;
  flex-shrink: 0;
}
.pulse::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.4);
  animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping {
  0% { transform: scale(0.6); opacity: 0.9; }
  80%, 100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- 图表卡片 ---------- */
.charts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
}
.col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-blue { background: var(--blue); }
.dot-purple { background: var(--purple); }
.dot-teal { background: var(--teal); }
.dot-green { background: var(--green); }
.dot-orange { background: var(--orange); }

.card-value { font-size: 22px; font-weight: 800; color: var(--text); }

.chart { width: 100%; height: 220px; }

.disk-legend, .net-legend { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.legend-k { color: var(--text-muted); }
.legend-v { margin-left: auto; font-weight: 600; color: var(--text); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.disk-mount { font-size: 12px; color: #94a3b8; font-weight: 400; }
.legend-used { background: var(--teal); }
.legend-free { background: #e2e8f0; }
.legend-in { background: var(--green); }
.legend-out { background: var(--orange); }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .specs { grid-template-columns: repeat(4, 1fr); }
  .col-3, .col-2 { grid-column: span 3; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .specs { grid-template-columns: repeat(2, 1fr); }
  .col-3, .col-2 { grid-column: span 6; }
}
