/* ==========================================================================
   防伪查询后台样式
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --ink: #2a2523;
  --muted: #8c857a;
  --line: #eae4d8;
  --bg: #f6f3ec;
  --card: #ffffff;
  --brand: #8d3345;
  --brand-d: #742634;
  --gold: #c8a266;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------------- 布局 ---------------- */
.wrap { display: flex; min-height: 100vh; }

.side {
  width: 218px;
  flex: none;
  background: linear-gradient(180deg, #3b2027 0%, #2d171d 100%);
  color: #d8cbc4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #b3756a, #8d3345);
  color: #fff8f2;
  font-size: 17px;
  font-weight: 600;
  font-family: "Songti SC", "SimSun", serif;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}

.brand-txt { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.brand-txt strong { color: #fdf6f2; font-size: 14.5px; font-weight: 600; letter-spacing: .5px; }
.brand-txt em { font-style: normal; font-size: 11px; color: #a2888a; letter-spacing: .3px; }

.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #c6b6b0;
  text-decoration: none;
  font-size: 13.5px;
  letter-spacing: .3px;
  transition: background .15s, color .15s;
}

.nav-item .ic { opacity: .8; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #f4e9e4; }
.nav-item.on { background: rgba(200, 162, 102, .16); color: #f6e3c8; }
.nav-item.on .ic { opacity: 1; color: var(--gold); }

.side-foot { margin-top: auto; padding: 10px 10px 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.who { padding: 8px 12px 0; font-size: 11px; color: #836d6c; letter-spacing: .4px; }

.main { flex: 1; min-width: 0; padding: 20px 26px 48px; max-width: 1280px; min-height: 100vh; }

.page-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-hd h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .5px; }

/* ---------------- 提示 ---------------- */
.flash {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid;
}
.flash.ok { background: #edf7ec; border-color: #cbe6c8; color: #2f6b34; }
.flash.err { background: #fdeeee; border-color: #f0cccc; color: #96323b; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(84, 62, 42, .04);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdfa, #fdfaf4);
}

.card-hd h2 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: .4px; }
.card-hd .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.card-bd { padding: 16px 18px; }
.card-bd.tight { padding: 0; }

/* ---------------- 概览 ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(141, 51, 69, .08), rgba(141, 51, 69, 0) 70%);
}

.stat .lbl { font-size: 12.5px; color: var(--muted); letter-spacing: .4px; }
.stat .num { font-size: 26px; font-weight: 600; letter-spacing: .5px; margin-top: 2px; color: #3a2b2b; }
.stat .num small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }

/* ---------------- 表格 ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
table.tb th, table.tb td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #f2ede3; white-space: nowrap; }
table.tb th { background: #faf7f1; color: #7d756a; font-weight: 500; font-size: 12.5px; letter-spacing: .3px; position: sticky; top: 0; }
table.tb tbody tr:hover { background: #fdfaf5; }
table.tb td.num { font-variant-numeric: tabular-nums; }
table.tb .empty { text-align: center; color: var(--muted); padding: 36px 0; }
table.tb td.addr { white-space: normal; min-width: 128px; }

.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 12.5px; letter-spacing: .2px; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 18px;
  background: #f3efe6;
  color: #7d756a;
}
.tag.hot { background: #fbeceb; color: #a33b3b; }
.tag.ok { background: #eaf5ea; color: #347a3c; }
.tag.on { background: #f2eee2; color: #8a6a2c; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #4a423c;
  font-size: 13px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn:hover { border-color: #d8cdb9; background: #fdfbf6; }
.btn .ic { opacity: .75; }
.btn-primary {
  background: linear-gradient(180deg, #9b3d50, var(--brand));
  border-color: var(--brand-d);
  color: #fff;
  box-shadow: 0 2px 6px rgba(141, 51, 69, .22);
}
.btn-primary:hover { background: linear-gradient(180deg, #a44357, var(--brand-d)); border-color: var(--brand-d); }
.btn-primary .ic { opacity: .9; }
.btn-danger { color: #a33b3b; border-color: #f0dddd; }
.btn-danger:hover { background: #fdf3f3; border-color: #e6c9c9; }
.btn-sm { height: 27px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 14px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
table.tb .actions { flex-wrap: nowrap; }
table.tb .actions form { display: flex; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; color: #6f675e; margin-bottom: 5px; letter-spacing: .3px; }
.field .hint { font-size: 11.5px; color: #a49c90; margin-top: 4px; line-height: 1.5; }

.input, .select, textarea.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid #e2dbcd;
  border-radius: 8px;
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

textarea.input { height: auto; padding: 8px 11px; line-height: 1.7; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus { border-color: #c197a1; box-shadow: 0 0 0 3px rgba(141, 51, 69, .08); }
.input::placeholder { color: #bcb4a8; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 18px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .input, .inline-form .select { width: auto; min-width: 130px; }

/* 图片上传预览 */
.img-pick { display: flex; align-items: center; gap: 12px; }
.img-pick .thumb {
  width: 108px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #f4f0e8;
}
.img-pick input[type=file] { font-size: 12px; max-width: 220px; }

/* 开关式勾选项 */
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  height: auto;
  padding: 7px 11px;
  border: 1px solid #e2dbcd;
  border-radius: 8px;
  background: #fffdf8;
  font-size: 12.5px;
  line-height: 1.45;
  color: #4a423c;
  cursor: pointer;
  user-select: none;
}
.check-row input[type=checkbox] { flex: none; width: 15px; height: 15px; accent-color: #9c3149; cursor: pointer; }

/* 行内编辑表 */
table.edit-tb { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
table.edit-tb th { text-align: left; font-weight: 500; font-size: 12.5px; color: #7d756a; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.edit-tb td { padding: 5px 8px; border-bottom: 1px solid #f5f1e8; vertical-align: middle; }
table.edit-tb td .input, table.edit-tb td .select { height: 32px; font-size: 13px; }
table.edit-tb td.tc { text-align: center; }

/* 分页 */
.pager { display: flex; gap: 6px; padding: 14px 18px; align-items: center; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 12.5px;
  color: #5b534a;
}
.pager .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .info { border: 0; background: none; color: var(--muted); }

/* 空状态 */
.empty-box { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-box .big { font-size: 15px; color: #6d6459; margin-bottom: 6px; }

/* 生成结果提示 */
.gen-result { display: flex; gap: 18px; flex-wrap: wrap; }
.gen-result .kv { font-size: 13px; color: #6d6459; }
.gen-result .kv b { font-size: 20px; color: #3a2b2b; margin-right: 4px; }

/* 二维码缩略 */
.qr-thumb { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 6px; background: #fff; display: block; }

/* 登录页 */
.login-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(circle at 50% 0%, #4a2530, #2a161b 70%); padding: 20px; }
.login-card {
  width: 100%;
  max-width: 356px;
  background: #fffdf9;
  border-radius: 16px;
  padding: 30px 26px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.login-card .logo { width: 52px; height: 52px; border-radius: 13px; background: linear-gradient(145deg, #b3756a, #8d3345); color: #fff8f2; display: grid; place-items: center; font-size: 24px; font-family: "Songti SC", "SimSun", serif; margin: 0 auto 14px; }
.login-card h1 { margin: 0 0 4px; font-size: 18px; text-align: center; letter-spacing: 1px; }
.login-card .tip { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 20px; }
.login-card .btn-primary { width: 100%; height: 40px; margin-top: 6px; }

/* 响应式 */
@media (max-width: 860px) {
  .wrap { flex-direction: column; }
  .side { width: auto; height: auto; position: static; }
  .brand { padding: 14px 16px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 8px 10px 10px; gap: 6px; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; padding: 7px 11px; font-size: 13px; background: rgba(255, 255, 255, .04); }
  .nav-item span { display: inline; }
  .side-foot { display: none; }
  .main { padding: 14px 14px 40px; }
  .card-bd { padding: 14px; }
  .page-hd h1 { font-size: 18px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stat .num { font-size: 22px; }
}
