:root {
  --bg: #0e1220;
  --panel: #161c2e;
  --panel-2: #1b2338;
  --border: #232c45;
  --text: #e6eaf2;
  --muted: #8a94ab;
  --accent: #4f8cff;
  --green: #22c55e;
  --red: #f43f5e;
  --amber: #f59e0b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

/* ---------- 登录页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2a52 0%, var(--bg) 60%);
}
.login-card {
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.login-logo { font-size: 34px; text-align: center; }
.login-card h1 { margin: 0; font-size: 20px; text-align: center; }
.login-sub { margin: 0 0 6px; text-align: center; color: var(--muted); }
.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 15px;
  cursor: pointer;
}
.login-card button:disabled { opacity: 0.6; cursor: default; }
.login-err { color: var(--red); min-height: 18px; text-align: center; font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 16px; font-weight: 700; }
.agent-info { display: flex; flex-direction: column; line-height: 1.3; flex: 1; }
.muted { color: var(--muted); font-size: 12px; }
.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
.ghost:hover { color: var(--text); border-color: var(--muted); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }
.section { margin-top: 28px; }
.section h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 14px; }

/* ---------- 卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.card .label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card .value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 图表 ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.chart { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.chart-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chart canvas { width: 100%; height: 160px; display: block; }

/* ---------- 表格 ---------- */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--panel-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.empty { color: var(--muted); text-align: center; padding: 26px; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.tag.qemu { background: rgba(79, 140, 255, 0.15); color: #7aa7ff; }
.tag.lxc { background: rgba(34, 197, 94, 0.15); color: #4ade80; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.run { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.stop { background: var(--muted); }

.actions { white-space: nowrap; }
.vbtn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 7px;
  padding: 5px 10px;
  margin-right: 6px;
  cursor: pointer;
  font-size: 12px;
}
.vbtn:hover:not(:disabled) { border-color: var(--accent); color: #fff; }
.vbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.vbtn.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.vbtn:disabled { opacity: 0.35; cursor: default; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: #1f2a45;
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--red); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal.show { display: flex; }
.modal-card {
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-card h3 { margin: 0 0 4px; font-size: 16px; }
.modal-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.modal-card input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
}
.modal-card input:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal-actions button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
}
.modal-actions #pwd-submit { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal-actions #pwd-submit:disabled { opacity: 0.6; cursor: default; }
.modal-err { color: var(--red); font-size: 13px; min-height: 18px; text-align: center; }

@media (max-width: 600px) {
  .wrap { padding: 14px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
