/* EMQX 审计监控 (v2 server) — Metro 白底灰框直角扁平风格 */
* { margin: 0; padding: 0; box-sizing: border-box; border-radius: 0 !important; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #fff;
  color: #333;
  font-size: 14px;
}
.hidden { display: none !important; }

/* ---- 顶栏 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-bottom: 1px solid #ccc;
  background: #fff;
  flex-wrap: wrap;
}
.topbar-title { font-size: 16px; font-weight: 600; color: #000; white-space: nowrap; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  padding: 5px 14px;
  text-decoration: none;
  color: #333;
  border: 1px solid transparent;
  font-size: 13px;
}
.topbar-nav a:hover { background: #f5f5f5; }
.topbar-nav a.active { border-color: #333; background: #fff; color: #000; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; color: #666; }
.topbar-right a { color: #1565c0; text-decoration: none; cursor: pointer; }
.topbar-right a:hover { text-decoration: underline; }
.status-ok { color: #2e7d32; }
.status-err { color: #c62828; }

/* ---- 筛选栏 ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #ccc;
  background: #fafafa;
  flex-wrap: wrap;
}
.filter-label { font-size: 12px; color: #666; white-space: nowrap; }
.chip {
  border: 1px solid #ccc;
  background: #fff;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #333;
}
.chip:hover { background: #f0f0f0; }
.chip.active { background: #333; color: #fff; border-color: #333; }
input[type="datetime-local"] {
  border: 1px solid #ccc;
  padding: 4px 6px;
  font-size: 12px;
  background: #fff;
  color: #333;
}
input[type="datetime-local"]:focus, .text-input:focus, select:focus { outline: 1px solid #666; }
.text-input {
  border: 1px solid #ccc;
  padding: 6px 8px;
  font-size: 13px;
  background: #fff;
  color: #333;
  width: 100%;
}

/* ---- 按钮 ---- */
.btn {
  border: 1px solid #333;
  background: #fff;
  color: #333;
  padding: 6px 18px;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { background: #f5f5f5; }
.btn:active { background: #e0e0e0; }
.btn-primary { background: #333; color: #fff; }
.btn-primary:hover { background: #555; }
.btn-small { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 表格 ---- */
.table-wrap { padding: 0 16px 24px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; min-width: 768px; }
th {
  background: #f5f5f5;
  border: 1px solid #ccc;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #000;
  font-size: 12px;
  white-space: nowrap;
}
td {
  border: 1px solid #e5e5e5;
  padding: 7px 10px;
  font-size: 13px;
  white-space: nowrap;
}
tbody tr:hover { background: #fafafa; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.name-cell { cursor: pointer; font-weight: 600; color: #1565c0; }
.name-cell:hover { text-decoration: underline; }
.rank-top1 { color: #c62828; font-weight: 700; }
.rank-top2 { color: #e65100; font-weight: 700; }
.rank-top3 { color: #f9a825; font-weight: 700; }

/* ---- 明细展开 ---- */
.detail-row td { background: #fafafa; padding: 0; }
.detail-box { padding: 10px 16px 14px; border-top: 1px dashed #ccc; }
.detail-box h4 { font-size: 13px; color: #000; margin-bottom: 8px; }
.detail-table { margin-top: 4px; min-width: 640px; }
.detail-table th { font-size: 11px; padding: 5px 8px; }
.detail-table td { font-size: 12px; padding: 5px 8px; }
.reconnect-badge { color: #c62828; font-weight: 600; }

/* ---- 状态条 ---- */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 16px;
  border-bottom: 1px solid #ccc;
  background: #fafafa;
  font-size: 12px;
  color: #666;
  flex-wrap: wrap;
}
.stats-bar .stat-spacer { flex: 1; }

/* ---- 图表 ---- */
.chart-box { padding: 12px 16px 20px; }
.chart-card { border: 1px solid #ccc; margin-top: 12px; }
.chart-title { font-size: 13px; font-weight: 600; color: #000; padding: 8px 12px; border-bottom: 1px solid #ccc; background: #fafafa; }
.chart-canvas-wrap { padding: 10px 12px; }
canvas { display: block; width: 100%; height: 180px; }
.legend { display: flex; gap: 16px; padding: 0 12px 10px; font-size: 12px; color: #666; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 10px; height: 10px; display: inline-block; }

/* ---- 表单页（登录/设置/配置）---- */
.auth-wrap { display: flex; justify-content: center; padding: 60px 16px; }
.auth-card { border: 1px solid #ccc; width: 360px; max-width: 100%; }
.auth-title { font-size: 15px; font-weight: 600; color: #000; padding: 12px 16px; border-bottom: 1px solid #ccc; background: #fafafa; }
.auth-body { padding: 16px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.form-msg { font-size: 12px; margin-top: 8px; min-height: 16px; }
.form-msg.err { color: #c62828; }
.form-msg.ok { color: #2e7d32; }
.config-section { border: 1px solid #ccc; margin-top: 16px; }
.config-section-title { font-size: 13px; font-weight: 600; color: #000; padding: 8px 12px; border-bottom: 1px solid #ccc; background: #fafafa; }
.config-section-body { padding: 14px 16px; }
.kv { font-size: 12px; color: #666; margin-bottom: 6px; }
.kv b { color: #333; font-weight: 600; }

/* ---- 通用 ---- */
.page { max-width: 1400px; margin: 0 auto; }
.mono { font-family: Consolas, "Courier New", monospace; }
a { color: #1565c0; }

/* ---- 黑名单 ---- */
.ban-btn { padding: 2px 8px; font-size: 11px; }
.ban-btn:hover { border-color: #c62828; color: #c62828; }
.ban-btn.banned { color: #c62828; border-color: #c62828; }
.ban-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; font-size: 11px; color: #fff; background: #c62828; vertical-align: 1px; }
.ban-note { color: #999; font-size: 11px; }
.ban-reason { color: #666; font-size: 12px; }

/* ---- 弹窗（直角白底灰框，无圆角无阴影） ---- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 10vh 16px 16px; }
.modal { background: #fff; border: 1px solid #333; width: 420px; max-width: 100%; }
.modal-title { font-size: 14px; font-weight: 600; color: #000; padding: 12px 16px; border-bottom: 1px solid #ccc; background: #fafafa; }
.modal-body { padding: 14px 16px; }
.modal-body label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.modal-body textarea { width: 100%; border: 1px solid #ccc; padding: 6px 8px; font-size: 13px; resize: vertical; min-height: 48px; font-family: inherit; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid #ccc; }
.dur-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.dur-row label { display: flex; align-items: center; gap: 4px; margin: 0 !important; cursor: pointer; }
.dur-row input[type="radio"] { accent-color: #333; margin: 0; }
.dur-row input[type="datetime-local"] { margin-left: 4px; }

@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar-title { font-size: 14px; }
  .table-wrap { padding: 0 8px 16px; }
}
