/* ============================================================
   人员信息查询系统 —— 样式
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1f5fa8;
  --primary-dark: #174c86;
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #222f3e;
  --muted: #6b7a8d;
  --line: #e3e9f0;
  --ok: #1e9e63;
  --warn: #d9822b;
  --danger: #c0392b;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

.page { display: flex; flex-direction: column; min-height: 100vh; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* 顶栏 */
.topbar {
  background: linear-gradient(135deg, #2a74c4 0%, var(--primary) 45%, var(--primary-dark) 100%);
  color: #fff;
  padding: 12px 0;
  box-shadow: 0 3px 10px rgba(23, 76, 134, .22);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { height: 36px; width: auto; flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,.18)); }
.topbar h1 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.topbar-right { display: flex; gap: 16px; }
.topbar .link { color: #eaf1fa; text-decoration: none; font-size: 14px; }
.topbar .link:hover { color: #fff; text-decoration: underline; }

/* 主区 */
main { flex: 1; padding: 24px 16px 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(31, 95, 168, .06);
}
.card h2 { font-size: 17px; margin-bottom: 8px; color: var(--primary-dark); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 13px; word-break: break-all; }
.empty { color: #b6c2cf; }
.card-sub { margin: 18px 0 10px; font-size: 16px; color: var(--primary-dark); }

/* 表单 */
.query-form { margin-top: 14px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 45%; min-width: 220px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 500; }
.field input[type="text"],
.field input[type="password"],
.field input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  font-size: 15px;
  background: #fbfcfe;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,95,168,.12); background: #fff; }

.btn {
  display: inline-block;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease;
}
.btn-primary { background: linear-gradient(135deg, #2a74c4, var(--primary)); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: 0 3px 8px rgba(31, 95, 168, .25); }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: #178656; box-shadow: 0 3px 8px rgba(30, 158, 99, .22); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid #c3d2e4; }
.btn-ghost:hover { background: #f0f5fb; }
.btn:active { transform: translateY(1px); }

/* 提示 */
.alert { border-radius: 8px; padding: 12px 14px; margin-top: 16px; font-size: 14px; }
.alert ul { margin-left: 18px; }
.alert-error { background: #fdecea; color: #a13b2e; border: 1px solid #f5c6c0; }
.alert-warn { background: #fff6e8; color: #8a5a1a; border: 1px solid #f2d9ac; }
.alert-success { background: #e9f7ef; color: #157a4c; border: 1px solid #bfe6d2; }
.alert code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 4px; }

/* 结果表 */
.result-block { margin-top: 20px; }
.result-title { font-size: 15px; margin-bottom: 8px; color: var(--primary-dark); }
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}
.result-table th,
.result-table td {
  border: 1px solid var(--line);
  padding: 9px 12px;
  vertical-align: top;
  text-align: left;
  word-break: break-all;
}
.result-table th {
  background: #f4f7fb;
  width: 34%;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.result-table td { background: #fff; }
.result-table.small td { padding: 6px 10px; font-size: 13px; }
.table-scroll { overflow-x: auto; margin-top: 10px; }

.preview td { word-break: break-all; }
.cell-bad { background: #fdecea !important; color: #a13b2e; }

/* 标签 */
.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  vertical-align: middle;
}
.badge-ok { background: #e0f4e9; color: #157a4c; }
.badge-warn { background: #fff0da; color: #a35c0d; }
.badge-danger { background: #fbe3e0; color: #a13b2e; }

.tag {
  display: inline-block;
  background: #eef3fa;
  color: #33506f;
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 12px;
  margin: 2px 2px;
}

/* 页脚 */
.footer {
  border-top: 1px solid var(--line);
  padding: 16px 0;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
}

/* 登录 */
.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login-card { max-width: 380px; width: 100%; }
.login-card .link { color: var(--primary); }
.login-logo { display: block; width: 84px; height: auto; margin: 0 auto 14px; }

/* 移动端 */
@media (max-width: 520px) {
  .card { padding: 18px 14px; }
  .result-table th { width: 40%; white-space: normal; }
  .topbar h1 { font-size: 16px; }
}

/* ============================================================
   照片显示
   ============================================================ */
.person-head { text-align: center; margin-bottom: 14px; }
.person-photo {
  width: 110px;
  height: 138px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  background: #fff;
}
.person-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  background: #f6f8fb;
  box-shadow: none;
}
.person-photo-caption { margin-top: 6px; font-size: 12px; color: var(--muted); }

.cert-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* 后台缩略图 */
.thumb { width: 44px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }
.thumb-lg { width: 76px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.photo-item {
  width: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  background: #fbfcfe;
}
.photo-name {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 8px;
  word-break: break-all;
  line-height: 1.4;
  max-height: 30px;
  overflow: hidden;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a32c20; }
.btn-mini { padding: 4px 12px; font-size: 12px; border-radius: 6px; }

/* ============================================================
   电子证书页
   ============================================================ */
.cert-wrap { max-width: 860px; }
.cert-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.cert-page {
  background: #fff;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,.08);
  padding: 26px;
}
.cert-inner {
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 34px 40px 26px;
}
.cert-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.cert-logo { height: 56px; width: auto; }
.cert-org { font-size: 24px; font-weight: 700; color: var(--primary); letter-spacing: 2px; }
.cert-sys { font-size: 13px; color: var(--muted); margin-top: 2px; }

.cert-title {
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 4px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-all;
  margin-top: 22px;
}
.cert-line {
  width: 300px;
  height: 3px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.cert-proof {
  margin: 26px 0 18px;
  font-size: 15px;
  line-height: 2;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 24px;
}
.cert-proof-text { flex: 1; }
.cert-proof-text p { margin: 0 0 6px; text-indent: 2em; }
.cert-proof-text p:last-child { margin-bottom: 0; }
.cert-proof-photo { flex-shrink: 0; }
.cert-photo {
  width: 96px;
  height: 128px;
  object-fit: cover;
  border: 2px solid #e3e9f0;
  border-radius: 8px;
  background: #fff;
}
.cert-proof b { color: var(--primary-dark); }

.cert-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.cert-table th,
.cert-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  word-break: break-all;
}
.cert-table th { background: #f4f7fb; color: var(--muted); font-weight: 600; white-space: nowrap; }

.cert-foot {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  margin-top: 26px;
}
.cert-qr { text-align: center; flex-shrink: 0; }
.cert-qr #qrcode {
  display: inline-block;
  padding: 8px;
  border: 1px solid #c3d2e4;
  border-radius: 8px;
  background: #fff;
}
.cert-qr-tip { font-size: 12px; color: var(--muted); margin-top: 6px; }
.cert-meta { flex: 1; font-size: 13px; line-height: 2; }
.cert-url { margin-top: 4px; }

.cert-copy {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 26px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

/* 打印：仅输出证书本体 */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .cert-wrap { max-width: 100%; }
  .cert-page {
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }
  .cert-inner {
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 30px 34px 22px;
  }
}
@page { size: A4 portrait; margin: 10mm; }

/* ============================================================
   二维码核验页
   ============================================================ */
.verify-wrap { max-width: 720px; }
.verify-status {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border-radius: 10px;
  padding: 18px 20px;
  margin-top: 6px;
}
.verify-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.verify-msg { font-size: 16px; line-height: 1.7; }
.verify-ok { background: #e9f7ef; border: 1px solid #bfe6d2; color: #157a4c; }
.verify-ok .verify-icon { background: var(--ok); }
.verify-fail { background: #fdecea; border: 1px solid #f5c6c0; color: #a13b2e; }
.verify-fail .verify-icon { background: var(--danger); }

.verify-person {
  margin: 16px 0 4px;
  padding: 10px 14px;
  background: #f4f7fb;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: baseline;
}

/* 后台侧边栏布局 */
.admin-layout { display: flex; gap: 22px; align-items: flex-start; margin-top: 22px; }
.sidebar { width: 208px; flex-shrink: 0; background: #fff; border: 1px solid #e3ebf4; border-radius: 12px; box-shadow: 0 2px 10px rgba(23,76,134,.06); padding: 10px; position: sticky; top: 20px; }
.side-link { display: block; padding: 11px 14px; border-radius: 8px; color: #34506e; font-size: 15px; text-decoration: none; margin-bottom: 2px; transition: background .15s ease, color .15s ease; }
.side-link:hover { background: #eef4fb; color: var(--primary); }
.side-link.active { background: linear-gradient(135deg, #2a74c4, var(--primary)); color: #fff; }
.admin-main { flex: 1; min-width: 0; }
.pager { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
@media (max-width: 860px) {
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .side-link { margin-bottom: 0; padding: 8px 12px; font-size: 14px; }
}

/* 人员照片列 */
.person-photo-cell { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.person-photo-cell .thumb { width: 46px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid #dce5ef; }
.photo-upload-form { display: flex; gap: 6px; align-items: center; }
.photo-upload-form input[type=file] { font-size: 12px; max-width: 110px; }
.photo-name-mini { display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   首页大气化 —— Hero 主视觉 + 悬浮查询卡片（蓝色政务风）
   ============================================================ */
.hero {
  position: relative;
  background:
    radial-gradient(1200px 460px at 88% -12%, rgba(64, 156, 255, .38), transparent 60%),
    radial-gradient(760px 320px at -6% 46%, rgba(96, 170, 255, .16), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .015) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .015) 0 1px, transparent 1px 9px),
    linear-gradient(165deg, #06235a 0%, #0d3d7d 40%, #11539e 68%, #0d5aa8 100%);
  color: #fff;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; right: -140px; top: -180px;
  width: 480px; height: 480px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 0 0 46px rgba(255, 255, 255, .04), 0 0 0 92px rgba(255, 255, 255, .03), 0 0 0 138px rgba(255, 255, 255, .02);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 46px;
  background: linear-gradient(180deg, transparent, rgba(242, 245, 249, 1));
  pointer-events: none;
}
.hero-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 18px 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}
.hero-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hero-logo {
  height: 58px; width: auto;
  filter: drop-shadow(0 2px 2px rgba(4, 20, 55, .55)) drop-shadow(0 6px 10px rgba(4, 20, 55, .4)) drop-shadow(0 14px 26px rgba(4, 20, 55, .3));
}
.hero-brand-name { font-size: 21px; font-weight: 600; letter-spacing: 1px; color: #fff; }
.hero-nav-right { display: flex; gap: 10px; }
.hero-link {
  color: #dce9fa; text-decoration: none; font-size: 14px;
  padding: 7px 20px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .28);
  transition: all .18s ease;
}
.hero-link:hover { color: #fff; border-color: rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .10); }
.hero-link-active { background: #fff; color: #0d3d7d; font-weight: 600; border-color: #fff; }
.hero-link-active:hover { color: #0d3d7d; background: #fff; }
.hero-title { text-align: center; padding: 52px 0 132px; }
.hero-title h1 {
  font-size: 38px; font-weight: 700; letter-spacing: 4px; color: #fff;
  text-shadow: 0 2px 18px rgba(0, 20, 60, .35);
  line-height: 1.3;
}
.hero-rule { display: flex; justify-content: center; margin: 18px 0 16px; }
.hero-rule span {
  display: block; width: 96px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #ffd98a 30%, #ffd98a 70%, rgba(255, 255, 255, 0));
  box-shadow: 0 0 12px rgba(255, 217, 138, .55);
}
.hero-title p { font-size: 16px; color: #cfe2f7; letter-spacing: 2px; }

.home-main { padding-top: 0; }
.home-card {
  max-width: 660px; margin: -104px auto 0;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 24px 60px rgba(8, 42, 99, .28), 0 4px 16px rgba(8, 42, 99, .10);
  padding: 40px 44px 36px;
  background: #ffffff;
  position: relative; z-index: 2;
}
.home-card-head { text-align: center; margin-bottom: 6px; }
.home-card-title {
  font-size: 26px; color: #0d3d7d; font-weight: 700; letter-spacing: 3px;
  margin-bottom: 6px;
}
.home-card-head .muted { font-size: 14px; }
.home-form { margin-top: 22px; }
.home-form .field label {
  font-size: 14px; font-weight: 600; color: #33455c; margin-bottom: 8px;
  letter-spacing: 1px;
}
.home-input { position: relative; }
.home-input svg {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: #8ba1bb; pointer-events: none;
}
.home-input input[type="text"] {
  width: 100%; height: 52px;
  padding: 0 16px 0 40px;
  border: 1.5px solid #d6e0ec; border-radius: 14px;
  font-size: 16px; color: #22334a;
  background: #f7fafd;
  transition: all .18s ease;
}
.home-input input[type="text"]::placeholder { color: #a5b4c6; }
.home-input input[type="text"]:focus {
  outline: none; background: #fff;
  border-color: #1f5fa8;
  box-shadow: 0 0 0 4px rgba(31, 95, 168, .14);
}
.home-input-captcha { display: flex; align-items: center; }
.captcha-question {
  margin-left: 44px;
  font-size: 17px; font-weight: 700; color: #1f5fa8; letter-spacing: 1px;
  white-space: nowrap;
}
.home-input-captcha input[type="text"] {
  width: 116px; flex: 0 0 auto; margin-left: auto;
  padding: 0 12px; text-align: center;
}
.home-submit {
  width: 100%; height: 54px; margin-top: 8px;
  font-size: 18px; letter-spacing: 10px; font-weight: 600;
  border-radius: 14px;
  background: linear-gradient(135deg, #2a74c4 0%, #1f5fa8 50%, #174c86 100%);
  border: none; color: #fff; cursor: pointer;
  box-shadow: 0 10px 24px rgba(31, 95, 168, .32);
  transition: all .18s ease;
}
.home-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(31, 95, 168, .42); filter: brightness(1.05); }
.home-submit:active { transform: translateY(0); box-shadow: 0 6px 16px rgba(31, 95, 168, .3); }

/* 查询结果区在大卡片内的表现 */
.home-card .result-block { margin-top: 26px; }
.home-card .result-title { font-size: 18px; color: #0d3d7d; }

@media (max-width: 640px) {
  .hero-title h1 { font-size: 26px; letter-spacing: 2px; }
  .hero-title { padding: 36px 0 108px; }
  .home-card { margin-top: -86px; padding: 30px 22px 28px; }
  .hero-logo { height: 44px; }
  .hero-brand-name { font-size: 17px; }
}
/* 前台子页（核验/证书）Hero 变体 */
.hero-title-sm { padding: 40px 0 116px; }
.hero-title-sm h1 { font-size: 30px; letter-spacing: 3px; }
.hero-slim .hero-nav { padding-top: 14px; }
.hero-title-xs { padding: 26px 0 88px; }
.hero-title-xs h1 { font-size: 26px; letter-spacing: 3px; }
.hero-title-xs p { font-size: 14px; }

/* 核验页 */
.verify-wrap { padding-top: 0; }
.verify-card { max-width: 720px; }
.verify-card .verify-status { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.verify-card .verify-icon {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #fff;
}
.verify-card .verify-ok .verify-icon { background: linear-gradient(135deg, #23b06f, #16894f); box-shadow: 0 8px 20px rgba(30, 158, 99, .3); }
.verify-card .verify-fail .verify-icon { background: linear-gradient(135deg, #e2574b, #b93a2e); box-shadow: 0 8px 20px rgba(192, 57, 43, .28); }
.verify-card .verify-msg b { font-size: 19px; color: #22334a; }
.verify-card .verify-person { margin: 16px 0; padding: 14px 18px; background: #f4f8fd; border-radius: 12px; border: 1px solid #e3ebf4; font-size: 15px; }
.verify-card .verify-person b { color: #0d3d7d; font-size: 17px; }

/* 证书页 */
.cert-toolbar { margin-top: 26px; }
@media print {
  .hero-slim { display: none !important; }
  .cert-toolbar { display: none !important; }
}
/* 人员与照片管理：横向滚动时固定姓名列，滚动到最右仍可见 */
.admin-sec[data-sec="allpersons"] .result-table th:nth-child(2),
.admin-sec[data-sec="allpersons"] .result-table td:nth-child(2) {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  box-shadow: 1px 0 0 rgba(0,0,0,.05);
}
.admin-sec[data-sec="allpersons"] .result-table th:nth-child(2) {
  background: #f4f7fb;
  z-index: 3;
}
