/* 550系列变频器 Web 管理端样式（admin/agent 后台） */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #1f2937;
  min-height: 100vh;
}

/* ---------- 登录页 ---------- */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-card {
  width: 380px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  padding: 28px;
}
.auth-card h1 {
  font-size: 18px;
  text-align: center;
  margin-bottom: 4px;
}
.auth-card .subtitle {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  margin-bottom: 20px;
}
.tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 18px;
}
.tabs button {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: none;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  font-weight: 600;
}

/* ---------- 通用表单/按钮 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 5px; color: #374151; }
.field input, .field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}
.field input:focus, .field select:focus { outline: none; border-color: #2563eb; }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  background: #e5e7eb;
  color: #1f2937;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-danger  { background: #dc2626; color: #fff; }
.btn-block   { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg.error { color: #dc2626; }
.msg.ok    { color: #16a34a; }

.input-mono {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: Consolas, monospace;
  font-size: 14px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 16px; }
.topbar .user { font-size: 13px; color: #6b7280; margin-right: 12px; }

.container { max-width: 960px; margin: 20px auto; padding: 0 16px; }

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin-bottom: 14px; color: #111827; }

.device-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.device-line .imei { font-family: Consolas, monospace; font-size: 15px; font-weight: 600; }
.lamp {
  width: 12px; height: 12px; border-radius: 50%;
  background: #9ca3af; display: inline-block;
}
.lamp.on  { background: #22c55e; }
.lamp.off { background: #ef4444; }
.conn-text { font-size: 13px; color: #6b7280; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.freq-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.freq-row input { width: 80px; padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; }
.freq-row span { font-size: 13px; color: #374151; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table td { padding: 9px 4px; font-size: 14px; border-bottom: 1px solid #f3f4f6; }
.data-table td:last-child { text-align: right; font-weight: 700; font-family: Consolas, monospace; }

.poll-row { margin-top: 10px; font-size: 13px; color: #374151; }

.log-box {
  height: 180px;
  overflow-y: auto;
  background: #0f172a;
  color: #cbd5e1;
  font-family: Consolas, monospace;
  font-size: 12px;
  border-radius: 6px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- 管理表格 ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; padding: 8px 6px;
  border-bottom: 2px solid #e5e7eb; color: #6b7280; font-weight: 600;
}
.admin-table td { padding: 8px 6px; border-bottom: 1px solid #f3f4f6; }
.admin-table .mono { font-family: Consolas, monospace; }

/* ---------- 状态徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-ok   { background: #dcfce7; color: #166534; }
.badge-wait { background: #fef9c3; color: #854d0e; }
.badge-off  { background: #fee2e2; color: #991b1b; }

.hidden { display: none !important; }

/* ---------- 手机端适配（admin/agent 后台） ---------- */
@media (max-width: 700px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; row-gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .container { margin: 14px auto; padding: 0 10px; }
  .card { padding: 14px 12px; overflow-x: auto; }
  .card h2 { font-size: 14px; }
  /* 添加/分配表单改为流式换行 */
  .device-line input, .device-line select { width: auto !important; flex: 1 1 46%; min-width: 0; }
  .device-line .btn { flex: 1 1 100%; }
  /* 宽表格在卡片内横向滚动，不挤压页面 */
  .admin-table { min-width: 640px; }
  .btn-row .btn { flex: 1 1 auto; }
  .log-box { height: 140px; }
}
