:root {
  --bg: #f3f4f6;
  --card: #fff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --danger: #ef4444;
  --ok: #16a34a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h1 { font-size: 1.6rem; }

.sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.hint {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.92rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn-primary, .btn-ghost, .btn-danger, .btn-link {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: #e5e7eb; color: #374151; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-link {
  background: #ecfdf5;
  color: #047857;
  text-decoration: none;
  display: inline-block;
}

.list { display: flex; flex-direction: column; gap: 14px; }
.loading, .empty { color: var(--muted); padding: 28px; text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-title { font-size: 1.1rem; font-weight: 700; }
.card-id {
  margin-top: 4px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92rem;
  color: var(--primary);
  word-break: break-all;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.meta-grid b { color: var(--text); font-weight: 600; }

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.pill {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
}

.pill .a { color: var(--ok); font-weight: 700; }
.pill .b { color: var(--primary); font-weight: 700; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.code-box {
  margin-top: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  display: none;
}

.code-box.show { display: block; }

dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(440px, 92vw);
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

dialog::backdrop { background: rgba(15, 23, 42, 0.45); }

.dlg-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dlg-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.dlg-form input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--text);
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

@media (max-width: 640px) {
  .meta-grid { grid-template-columns: 1fr; }
  .top { flex-direction: column; }
}

/* ===== 安全改造新增样式 ===== */
.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}
.badge-on { background: #dcfce7; color: #15803d; }
.badge-off { background: #fee2e2; color: #b91c1c; }

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: #374151;
  margin-bottom: 12px;
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: #2563eb;
}

.meta-grid .span2 { grid-column: 1 / -1; }
.meta-grid code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .8rem;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}
