* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", Tahoma, sans-serif;
  background: #f0f2f5;
  color: #1f2733;
}
.hidden { display: none !important; }
.view { min-height: 100vh; }

/* ---------- 登录 ---------- */
#login-view {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a5f, #2c5282);
}
.login-box {
  background: #fff; padding: 40px; border-radius: 12px;
  width: 320px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
  text-align: center;
}
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box .sub { color: #7a8699; margin: 0 0 24px; font-size: 14px; }
.login-box input { width: 100%; margin-bottom: 16px; }

/* ---------- 主界面 ---------- */
header {
  display: flex; align-items: center; gap: 16px;
  background: #1e3a5f; color: #fff; padding: 14px 24px;
}
.brand { font-size: 18px; font-weight: 600; }
.sysinfo { flex: 1; font-size: 13px; color: #b8c7dc; }
main { max-width: 960px; margin: 24px auto; padding: 0 16px; }

.card {
  background: #fff; border-radius: 10px; padding: 20px 24px;
  margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.card h2 { font-size: 16px; margin: 0 0 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.danger-card { border-left: 4px solid #e05353; }

.row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hint { color: #8a94a6; font-size: 12px; margin: 12px 0 0; }

/* ---------- 表单元素 ---------- */
input, textarea, button { font-family: inherit; font-size: 14px; }
input[type=text], input[type=password], input[type=number], textarea {
  padding: 9px 11px; border: 1px solid #cdd5e0; border-radius: 6px; outline: none;
}
input:focus, textarea:focus { border-color: #3b82f6; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: #4a5568; }
label input[type=text], label input[type=password], label textarea { width: 100%; margin-top: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 18px; border: none; border-radius: 6px; cursor: pointer;
  font-weight: 500; transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.primary { background: #3b82f6; color: #fff; }
.btn.danger { background: #e05353; color: #fff; }
.btn.ghost { background: #eef1f6; color: #3d4657; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef0f4; font-size: 14px; }
th { color: #8a94a6; font-weight: 500; font-size: 12px; }
td .path { color: #6b7688; font-size: 12px; word-break: break-all; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.on { background: #dcfce7; color: #16794a; }
.badge.off { background: #f1f2f5; color: #98a0af; }
.empty { text-align: center; color: #98a0af; padding: 30px; }
.op-btns { display: flex; gap: 6px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(20,28,40,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-box {
  background: #fff; border-radius: 10px; padding: 24px; width: 460px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-box h3 { margin: 0 0 18px; }
.modal-box input[type=password] { width: 100%; margin: 8px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.error { color: #e05353; font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ---------- 资源监控 ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px;
}
.stat-loading { color: #98a0af; padding: 10px; }
.stat-tile {
  border: 1px solid #eef0f4; border-radius: 8px; padding: 14px 16px; background: #fafbfc;
}
.stat-tile .stat-label { font-size: 13px; color: #6b7688; display: flex; justify-content: space-between; }
.stat-tile .stat-value { font-size: 22px; font-weight: 600; margin: 6px 0 2px; }
.stat-tile .stat-sub { font-size: 12px; color: #8a94a6; }
.bar { height: 8px; border-radius: 4px; background: #e8ebf0; overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.lv-ok > span { background: #22a06b; }
.lv-warn > span { background: #e8a33d; }
.lv-crit > span { background: #e05353; }
.stat-tile.lv-crit { border-color: #f3b7b7; background: #fdf3f3; }
.stat-value.crit { color: #e05353; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 12px 22px; border-radius: 8px;
  font-size: 14px; z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.toast.err { background: #c23b3b; }
