.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: #1e1e1c;
  color: #f0efeb;
  border-bottom: 1px solid #3a3a36;
}
.topbar .brand { font-weight: 600; letter-spacing: 2px; }
.topbar nav a { color: #b0b0aa; text-decoration: none; margin-right: 16px; font-size: 14px; }
.topbar nav a:hover { color: #fff; }
.logout-form { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.admin-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.admin-name { color: #8a8a84; font-size: 13px; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei UI", sans-serif;
  background: #ececea;
  color: #1a1a18;
}
.container { max-width: 960px; margin: 0 auto; padding: 24px; }
.container-wide { max-width: 1120px; }

/* —— 控制台 —— */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.dash-header h1 { margin: 0 0 4px; font-size: 26px; }
.dash-sub { margin: 0; }
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .stat-grid-4 { grid-template-columns: 1fr; }
}

.stat-card {
  background: #fafaf8;
  border: 1px solid #d4d3ce;
  border-radius: 8px;
  padding: 18px 20px;
  border-left: 4px solid #1e1e1c;
}
.stat-card--primary { border-left-color: #1e1e1c; }
.stat-card--green { border-left-color: #2d6a4f; }
.stat-card--blue { border-left-color: #1a5fb4; }
.stat-card--amber { border-left-color: #c64600; }
.stat-card__label { font-size: 13px; color: #6e6e6a; margin-bottom: 6px; }
.stat-card__num { font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.stat-card__meta { font-size: 12px; color: #8a8a84; margin-top: 8px; }

.dash-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.dash-row--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) {
  .dash-row { grid-template-columns: 1fr; }
  .dash-row--2 { grid-template-columns: 1fr; }
}

.dash-panel h2 { font-size: 15px; margin-bottom: 14px; }
.metric-list { list-style: none; margin: 0; padding: 0; }
.metric-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #ececea;
  font-size: 13px;
}
.metric-list li:last-child { border-bottom: none; }
.metric-list span { color: #6e6e6a; }
.metric-list strong { font-size: 15px; font-weight: 600; }
.text-danger { color: #9b2c2c; }
.link-more {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: #1a5fb4;
  text-decoration: none;
}
.link-more:hover { text-decoration: underline; }
.panel-hint { font-size: 12px; color: #8a8a84; margin: 12px 0 0; }

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
}
.quick-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: #f5f4f1;
  border: 1px solid #d4d3ce;
  border-radius: 6px;
  font-size: 13px;
  color: #1a1a18;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.quick-link:hover { background: #ececea; border-color: #b0b0aa; }

.table-compact th, .table-compact td { padding: 8px 6px; font-size: 12px; }
.table-compact small { color: #8a8a84; }
.empty-hint { color: #8a8a84; font-size: 13px; margin: 0; }
.empty-hint a { color: #1a5fb4; }

.card {
  background: #fafaf8;
  border: 1px solid #d4d3ce;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: #f5f4f1; border-radius: 4px; padding: 14px; text-align: center; }
.stat .num { font-size: 24px; font-weight: 600; }
.stat .lbl { font-size: 12px; color: #6e6e6a; margin-top: 4px; }
label { display: block; font-size: 13px; color: #6e6e6a; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d4d3ce;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 14px;
  background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 4px;
  border: 1px solid #1e1e1c;
  background: #1e1e1c;
  color: #f5f4f0;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #333330; }
.btn-ghost { background: transparent; color: #1a1a18; border-color: #d4d3ce; }
.btn-danger { background: #9b2c2c; border-color: #9b2c2c; color: #fff; }
.error { color: #9b2c2c; margin-bottom: 12px; font-size: 13px; }
.success { color: #2d6a4f; margin-bottom: 12px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e8e7e3; }
th { color: #6e6e6a; font-weight: 500; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.badge-unused { background: #e8f5e9; color: #2d6a4f; }
.badge-used { background: #eee; color: #6e6e6a; }
.badge-revoked { background: #fdecea; color: #9b2c2c; }
.codes-box {
  background: #f5f4f1;
  border: 1px solid #d4d3ce;
  border-radius: 4px;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
}
.login-wrap { max-width: 360px; margin: 80px auto; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; margin: 0; min-width: 140px; }
.pagination { margin-top: 16px; font-size: 13px; color: #6e6e6a; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagination a { color: #1a5fb4; text-decoration: none; }
.pagination a:hover { text-decoration: underline; }
.muted { color: #6e6e6a; font-size: 13px; margin-top: -8px; margin-bottom: 16px; }
.muted a { color: #1a5fb4; }
.success { color: #2ec27e; font-size: 13px; margin-bottom: 12px; }
.btn-sm { padding: 4px 10px !important; font-size: 12px !important; min-height: auto !important; }
.cell-actions { white-space: nowrap; }
.cell-actions form { margin-right: 4px; }
.table-actions td small { color: #6e6e6a; }
code { font-size: 12px; background: #ececea; padding: 2px 6px; border-radius: 3px; }

.consult-settings { display: grid; gap: 24px; }
.consult-preview {
  text-align: center;
  padding: 20px;
  background: #f5f4f1;
  border-radius: 8px;
  border: 1px dashed #d4d3ce;
}
.consult-qrcode-img {
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid #d4d3ce;
  background: #fff;
}
.consult-empty {
  color: #8a8a84;
  font-size: 14px;
  padding: 48px 16px;
}
.full-width { grid-column: 1 / -1; }
.small { font-size: 12px; margin-top: -8px; }
