:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
}

* { 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);
  font-size: 14px;
}
.hidden { display: none !important; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box {
  width: 380px; background: #fff; border-radius: 14px; padding: 36px 32px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, .08);
}
.login-logo { font-size: 22px; font-weight: 700; text-align: center; color: var(--primary); }
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 24px; font-size: 13px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; background: #fff; color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.8; }
.err { color: var(--danger); margin-top: 12px; text-align: center; font-size: 13px; min-height: 18px; }

/* 按钮 */
.btn {
  padding: 8px 16px; border: 1px solid var(--border); background: #fff; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text); transition: .15s; font-family: inherit;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; }

/* 布局 */
#appView { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0;
}
.brand { padding: 20px 18px; font-weight: 700; font-size: 16px; color: var(--primary); border-bottom: 1px solid var(--border); }
#navList { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--text);
  margin-bottom: 2px; display: flex; justify-content: space-between; align-items: center;
}
.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: #eff6ff; color: var(--primary); font-weight: 600; }
.side-foot { padding: 12px; border-top: 1px solid var(--border); }
.side-user { font-size: 12px; color: var(--muted); margin-bottom: 8px; word-break: break-all; }
.main { flex: 1; margin-left: 210px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 5;
}
.page-title { font-size: 16px; font-weight: 600; }
.content { padding: 20px 24px 40px; }

/* 卡片 */
.card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 16px; border: 1px solid var(--border); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.card-title { font-size: 15px; font-weight: 600; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 120px; }

/* 统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--primary); }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; }
tbody tr:hover { background: #f9fafb; }
td .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eef2ff; color: var(--primary); }
.tag-warn { background: #fef3c7; color: var(--warn); }
.tag-gray { background: #f3f4f6; color: var(--muted); }
.tag-green { background: #dcfce7; color: var(--success); }
.tag-red { background: #fee2e2; color: var(--danger); }

.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #e5e7eb; vertical-align: middle; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 560px; max-width: 92vw; background: #fff; border-radius: 12px; overflow: hidden; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px; max-height: 62vh; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-row { display: flex; gap: 12px; margin-bottom: 14px; }
.form-row > div { flex: 1; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 20px; border-radius: 8px; z-index: 99; font-size: 14px;
}

.img-preview { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.qr-box { text-align: center; }
.qr-box img { width: 220px; height: 220px; }
.kv { display: flex; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.kv .k { color: var(--muted); width: 80px; flex-shrink: 0; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 13px; color: var(--muted); }
