:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.boot-loading { padding: 60px; text-align: center; color: var(--muted); }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; background: #1e293b; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 14px 16px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; flex: none; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.brand small { display: block; font-size: 11px; font-weight: 400; color: #94a3b8; margin-top: 2px; }
.nav-list { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-item {
  display: block; padding: 10px 12px; margin: 2px 0; border-radius: 8px; color: #cbd5e1;
  text-decoration: none; font-size: 14px; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.user-box { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.user-box .uname { color: #fff; font-size: 14px; font-weight: 600; }
.user-box .urole { color: #94a3b8; margin-top: 2px; }
.user-box button { margin-top: 8px; width: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }

.content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

/* ===== 卡片 / 表单 ===== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
label.fld { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }
.btn {
  display: inline-block; padding: 9px 16px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; background: var(--primary); color: #fff; font-family: inherit;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; }

/* ===== 表格 ===== */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px 10px; background: #f8fafc; border-bottom: 1px solid var(--border); color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: #f8fafc; }
.tbl input, .tbl select { padding: 5px 8px; font-size: 13px; }

/* ===== 统计卡 ===== */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat .s-label { color: var(--muted); font-size: 12px; }
.stat .s-value { font-size: 24px; font-weight: 700; margin-top: 4px; color: var(--primary); }
.stat .s-extra { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.tag.green { background: #dcfce7; color: #166534; }
.tag.gray { background: #f1f5f9; color: #475569; }
.tag.red { background: #fee2e2; color: #991b1b; }
.tag.blue { background: #dbeafe; color: #1e40af; }
.tag.orange { background: #ffedd5; color: #9a3412; }

/* ===== 登录页 ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%); }
.auth-card { background: #fff; border-radius: 16px; padding: 32px 28px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-logo { display: block; width: 66px; height: 66px; border-radius: 15px; margin: 0 auto 16px; box-shadow: 0 10px 24px rgba(30,58,138,.30); }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-card .fld + .fld, .auth-card .row-gap { margin-top: 12px; }
.auth-err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .btn { white-space: nowrap; }
.divider { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 10px; }
/* 登录页页脚：备案号 + 版权 */
.auth-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); text-align: center;
  font-size: 12px; color: var(--muted); line-height: 1.9; }
.auth-foot a { color: var(--muted); text-decoration: none; }
.auth-foot a:hover { color: var(--primary); text-decoration: underline; }
.auth-foot .sep { margin: 0 6px; opacity: .5; }

/* ===== 弹窗 / 提示 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; padding: 22px; }
.modal h3 { margin-bottom: 14px; font-size: 16px; }
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: 90vw; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ===== 图片 ===== */
.idimg-row { display: flex; gap: 12px; flex-wrap: wrap; }
.idimg { width: 180px; height: 115px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #f1f5f9; cursor: pointer; }
.thumb { width: 90px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }

/* ===== QR ===== */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
#qr-holder { background: #fff; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.link-box { width: 100%; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 12px; word-break: break-all; color: var(--muted); }

/* ===== 图表 ===== */
.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.bar-name { width: 110px; font-size: 13px; text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #eef2f7; border-radius: 6px; height: 22px; position: relative; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--primary); min-width: 2px; }
.bar-val { width: 110px; font-size: 13px; flex-shrink: 0; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13px; }
.muted { color: var(--muted); font-size: 12px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex1 { flex: 1; }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }

/* ===== 手机端 ===== */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 50; flex-direction: column; }
  .brand { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: none; }
  .brand small { display: none; }
  .user-box { display: none; }
  .nav-list { display: flex; overflow-x: auto; padding: 6px 8px; gap: 4px; -webkit-overflow-scrolling: touch; }
  .nav-item { white-space: nowrap; padding: 8px 12px; }
  .content { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .stat .s-value { font-size: 20px; }
  .bar-name { width: 84px; font-size: 12px; }
  .bar-val { width: 90px; font-size: 12px; }
  .idimg { width: 140px; height: 90px; }
  .modal { padding: 16px; }
}
