:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --bg: #e6f0fa;
  --card: #ffffff;
  --border: #cfe0f2;
  --text: #1e293b;
  --muted: #5b7aa0;
}

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

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

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar .brand { font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar a, .topbar button.link {
  color: var(--primary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
}
.topbar .user { color: var(--muted); }

.container { max-width: 1100px; margin: 20px auto; padding: 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin-bottom: 12px; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row .field { display: flex; flex-direction: column; gap: 4px; }
.row .field label { font-size: 12px; color: var(--muted); }

select, input[type=text], input[type=password], input[type=number], textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

button {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}
button:hover { background: var(--primary-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: #e2e8f0; color: var(--text); }
button.secondary:hover { background: #cbd5e1; }
button.danger { background: var(--danger); }
button.danger:hover { background: #b91c1c; }
button.success { background: var(--success); }
button.success:hover { background: #15803d; }
button.small { padding: 4px 10px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:hover td { background: #f8fafc; }
td input[type=text], td input[type=number] { width: 100%; min-width: 60px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.admin { background: #fef3c7; color: #92400e; }
.badge.user { background: #dbeafe; color: #1e40af; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.fail { background: #fee2e2; color: #991b1b; }

.log {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 10px;
  font-family: Consolas, monospace;
  font-size: 13px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log .ok { color: #4ade80; }
.log .fail { color: #f87171; }
.log .info { color: #7dd3fc; }

.msg { padding: 10px 14px; border-radius: 6px; margin: 10px 0; display: none; }
.msg.show { display: block; }
.msg.error { background: #fee2e2; color: #991b1b; }
.msg.success { background: #dcfce7; color: #166534; }
.msg.info { background: #dbeafe; color: #1e40af; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--border); }
.tabs button {
  background: none; color: var(--muted);
  border-radius: 6px 6px 0 0;
  padding: 10px 18px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-page { display: none; }
.tab-page.active { display: block; }

.empty { color: var(--muted); text-align: center; padding: 24px; }

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px;
  width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; }
.login-box .sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; }
.login-box .field { margin-bottom: 14px; }
.login-box .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-box input { width: 100%; }
.login-box button { width: 100%; margin-top: 8px; padding: 10px; }
.login-box .switch { text-align: center; margin-top: 14px; font-size: 13px; }
.login-box .switch a { color: var(--primary); text-decoration: none; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.pager span { color: var(--muted); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 10px; padding: 24px; width: 460px; max-width: 92vw;
  max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }
.modal .field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.modal .field label { font-size: 12px; color: var(--muted); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.bt-status { font-size: 13px; }
.bt-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; margin-right: 6px; }
.bt-status .dot.on { background: var(--success); }
