:root {
  --primary: #2563eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --border: #e5e7eb;
  --bg: #f5f6f8;
  --text: #1f2937;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: #6b7280; font-size: 12px; }
.error { color: var(--danger); font-size: 12px; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  width: 340px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
label { display: block; margin: 12px 0 4px; font-size: 13px; }
input, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 52px;
  position: sticky;
  top: 0;
}
.brand { font-weight: 600; }
.spacer { flex: 1; }
.nav-btn {
  border: none;
  background: none;
  padding: 16px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 14px;
}
.nav-btn.active { border-bottom-color: var(--primary); color: var(--primary); }

/* 布局 */
.tab { padding: 20px; max-width: 1100px; margin: 0 auto; }
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h2 { font-size: 15px; margin: 0; }
.filters { display: flex; gap: 8px; align-items: center; }
.filters select, .filters input { width: auto; }
.stat-cards { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 22px;
  min-width: 120px;
}
.stat-card .num { font-size: 24px; font-weight: 700; }
.stat-card .lbl { color: #6b7280; font-size: 12px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: #6b7280; font-weight: 500; font-size: 12px; }
td .btn { margin-right: 6px; }

/* 按钮 */
.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; margin-top: 16px; padding: 10px; }
.btn.small { padding: 3px 10px; font-size: 12px; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.off { background: #fee2e2; color: var(--danger); }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 420px;
}
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.banner-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  color: #92400e;
  margin-bottom: 8px;
}

/* Toast */
#toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 20;
  font-size: 13px;
}

/* 设备勾选列表（特征下发） */
.check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* 危险操作 */
.btn.danger {
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn.danger:hover {
  background: #fef2f2;
}
