:root {
  --theme: #f60;
  --theme-dark: #e05a00;
  --text-color: #1f1f1f;
  --text-light: #777;
  --border-color: #dcdfe6;
  --bg-color: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  position: relative;
  background-color: var(--bg-color);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  padding: 24px 16px;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 940px;
  margin: 0 auto;
  position: relative;
}

/* 查询页 LOGO（居中小图） */
.page-logo {
  display: flex;
  justify-content: center;
  margin: 50px auto 50px;
}

.page-logo img {
  display: block;
  height: 100px;
  object-fit: contain;
}

/* ---------- 校准检验报告 ---------- */
.report-page {
  padding: 34px 34px 40px;
}

.report-page .report-logo {
  position: absolute;
  top: 26px;
  right: 30px;
  max-width: 150px;
  max-height: 58px;
  object-fit: contain;
}

.report-head {
  position: relative;
  margin-bottom: 18px;
}

.report-head .doc-title {
  font-size: 26px;
  letter-spacing: 2px;
  margin: 6px 0 10px;
}

.report-no {
  text-align: right;
  font-size: 13px;
  color: #333;
  padding-right: 2px;
}

.report-info {
  margin-top: 8px;
}

.report-info th {
  width: 90px;
  background: #fafafa;
  white-space: nowrap;
}

.report-info td {
  text-align: left;
  font-weight: 400;
  padding-left: 10px;
}

.report-basis {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.9;
  color: #222;
}

.report-basis .basis-title {
  font-weight: 700;
}

.report-basis .basis-content {
  padding-left: 2px;
  word-break: break-all;
}

.report-materials {
  margin-top: 14px;
}

.report-materials td {
  min-height: 30px;
}

.report-sign {
  display: flex;
  justify-content: space-between;
  margin-top: 34px;
  font-size: 14px;
  font-weight: 600;
  padding: 0 6px;
}

/* 结果页底部：查询二维码 + 落款（含公章）同一行，左右分布 */
.report-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 40px;
  padding: 0 6px;
}

.report-page .report-qrcode {
  width: 92px;
  text-align: center;
  flex-shrink: 0;
  z-index: 3;
}

.report-page .report-qrcode img {
  display: block;
  width: 100%;
  height: auto;
}

.report-page .report-qrcode span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #666;
}

.report-page .report-company {
  position: relative;
  margin-right: 40px;
  min-width: 240px;
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
  color: #333;
  font-weight: 600;
}

/* 落款公章（覆盖在落款文字上） */
.report-page .report-seal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 130px;
  transform: translate(-50%, -55%);
  object-fit: contain;
  opacity: .92;
  z-index: 3;
  pointer-events: none;
}

/* 打印样式 */
@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    padding: 0;
    background: #fff;
  }

  .page-logo,
  .result-actions {
    display: none !important;
  }

  .container {
    max-width: none;
  }

  .pages {
    gap: 0;
  }

  .page-wrap {
    width: auto !important;
    height: auto !important;
    overflow: visible;
    display: block;
  }

  .pdf-page {
    box-shadow: none !important;
    transform: none !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 210mm;
    height: 297mm;
    page-break-after: always;
  }

  .result {
    margin-top: 0;
  }
}

/* 标题 */
.page-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #f60;
  letter-spacing: 1px;
  margin: 0px 0 50px;
}

/* 表单示意图 */
.sample-card {
  padding: 10px;
  margin-bottom: 22px;
}

.sample-image {
  display: block;
  width: 100%;
  border-radius: 4px;
}

/* 查询表单 */
.verify-form {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  width: 100%;
}

.form-group input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 15px;
  color: #333;
  background: #fff;
  outline: none;
  transition: none;
}

.form-group input:focus,
.form-group input:hover {
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.form-group input::placeholder {
  color: #b5b5b5;
}

/* 验证码 */
.captcha-group {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.captcha-group input {
  flex: 1;
  min-width: 0;
}

.captcha-img {
  width: 128px;
  height: 48px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.captcha-img canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.captcha-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 查询按钮 */
.btn-query {
  width: 170px;
  height: 46px;
  margin: 26px auto 0;
  background: var(--theme);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 102, 0, 0.3);
  transition: background-color .2s ease;
}

.btn-query:hover {
  background: var(--theme-dark);
}

.btn-query:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* 状态提示 */
.status {
  display: none;
  margin: 18px auto 0;
  max-width: 460px;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.status.show {
  display: block;
}

.status.error {
  background: #fff1f0;
  color: #e64340;
  border: 1px solid #ffd6d3;
}

.status.loading {
  background: #fff8ed;
  color: var(--theme);
  border: 1px solid #ffe2c2;
}

/* 结果区域 */
.result {
  display: none;
  margin-top: 28px;
}

.result.show {
  display: block;
}

.pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.page-wrap {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.result-actions {
  text-align: center;
  margin: 26px 0 10px;
}

.btn-download {
  min-width: 170px;
  height: 46px;
  padding: 0 28px;
  background: var(--theme);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 102, 0, 0.3);
  transition: background-color .2s ease;
}

.btn-download:hover {
  background: var(--theme-dark);
}

.btn-download:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* 返回按钮 */
.btn-back {
  display: inline-block;
  min-width: 170px;
  height: 46px;
  line-height: 46px;
  padding: 0 28px;
  background: #fff;
  color: var(--theme);
  border: 1px solid var(--theme);
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}

.btn-back:hover {
  background: var(--theme);
  color: #fff;
}

/* ---------- A4 文档页 ---------- */
.pdf-page {
  position: relative;
  width: 794px;
  height: 1123px;
  flex-shrink: 0;
  background: #fff;
  padding: 34px 30px 30px;
  overflow: hidden;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.1);
  font-family: "SimSun", "Songti SC", "Microsoft YaHei", serif;
  color: #111;
}

/* 导出 PDF 时缩小左右页边距 */
.pdf-export .pdf-page {
  padding-left: 26px;
  padding-right: 26px;
}

.pdf-page .verify-line {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 10px;
  line-height: 1.5;
  color: #444;
  padding-bottom: 6px;
  margin-bottom: 18px;
  min-height: 100px;
  padding-left: 29px;
  padding-top: 0;
  letter-spacing: 0;
}

/* 验证说明里的网址不换行，避免被拆成两段出现空隙 */
.pdf-page .verify-line .verify-url {
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0;
}

/* 每页左上角二维码（查询结果页） */
.pdf-page .pdf-qrcode {
  position: absolute;
  top: 6px;
  left: 55px;
  width: 96px;
  height: 96px;
  object-fit: contain;
  z-index: 3;
  pointer-events: none;
}

/* 后台导出 PDF 时，二维码位于验证说明文字下方 */
.pdf-export .pdf-page .pdf-qrcode {
  top: 52px;
  width: 86px;
  height: 86px;
}

.pdf-page .doc-title {
  text-align: center;
  font-size: 22px;
  letter-spacing: 1px;
  margin: 8px 0 50px;
  font-family: "SimHei", "Microsoft YaHei", sans-serif;
}

/* 后台导出 PDF 时：标题与二维码同一水平区域，位于二维码右侧 */
.pdf-export .pdf-page .verify-line {
  min-height: 0;
  margin-bottom: 0;
}

.pdf-page table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.pdf-page table th,
.pdf-page table td {
  border-top: 1px solid #333;
  border-left: 1px solid #333;
  padding: 10px 2px;
  line-height: 1.5;
  vertical-align: middle;
  word-break: break-all;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
}

/* 最右列加右边框 */
.pdf-page table th:last-child,
.pdf-page table td:last-child {
  border-right: 1px solid #333;
}

/* 最后一行加下边框 */
.pdf-page table tr:last-child th,
.pdf-page table tr:last-child td {
  border-bottom: 1px solid #333;
}

.pdf-page table th {
  font-weight: 700;
  text-align: center;
}

.pdf-page table td {
  text-align: center;
  font-weight: 600;
}

/* 12 列等分表格（第2页基本养老）：列宽严格按百分比分配 */
.pdf-page table.grid {
  table-layout: fixed;
}

.pdf-page .table-gap {
  height: 18px;
}

.pdf-page .note-block {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.9;
}

.pdf-page .note-block .note-title {
  font-weight: 700;
}

.pdf-page .doc-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #333;
  font-weight: 600;
}

.pdf-page .signature {
  margin-top: 60px;
  text-align: right;
  font-size: 18px;
  line-height: 2.2;
  padding-right: 80px;
}

.pdf-page .narrative {
  font-size: 18px;
  line-height: 2.6;
  margin-top: 50px;
  padding: 0 40px;
}

.pdf-page .narrative .blank {
  display: inline-block;
  border-bottom: 1px solid #333;
  text-align: center;
  padding: 0 36px;
  line-height: 1.8;
}

/* 公章 —— 每页独立位置（相对页面 794×1123，按内容定位） */
.pdf-seal {
  position: absolute;
  width: 160px;
  height: 160px;
  object-fit: contain;
  opacity: .92;
  z-index: 3;
  pointer-events: none;
}

/* 第 1 页 失业保险：表格"参保机构"行右下 */
.seal-p1 {
  right: 90px;
  top: 183px;
}

/* 第 2 页 基本养老：文档底部"打印日期"右侧 */
.seal-p2 {
  right: 90px;
  bottom: 469px;
}

/* 第 3 页 城乡居民养老："社保经办机构(盖章):" 文字右侧 */
.seal-p3 {
  right: 100px;
  top: 320px;
}

/* 第 4 页 工伤保险："社保经办机构公章:" 文字右侧，日期上方 */
.seal-p4 {
  right: 100px;
  top: 600px;
}

/* 水印 */
.pdf-watermark {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.pdf-watermark p {
  position: absolute;
  width: 326px;
  color: rgba(80, 80, 80, 0.6);
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  /* 首行空两个字 */
  text-indent: 2em;
  transform: rotate(-28deg);
  user-select: none;
}

footer {
  font-size: 12px;
  margin-top: 30px;
  color: var(--text-light);
  display: flex;
  justify-content: center;
}

@media (max-width: 768px) {
  body {
    padding: 16px 12px 24px;
  }

  .page-title {
    margin: 6px 0 16px;
  }

  .sample-card {
    padding: 8px;
    margin-bottom: 18px;
  }

  .verify-form {
    max-width: 100%;
    gap: 14px;
  }

  /* 16px 可避免 iOS 聚焦输入框时自动放大页面 */
  .form-group input {
    height: 46px;
    font-size: 16px;
    padding: 0 14px;
  }

  .captcha-img {
    width: 104px;
    height: 46px;
  }

  .btn-query {
    width: 100%;
    max-width: 300px;
    height: 44px;
    margin-top: 20px;
    font-size: 16px;
  }

  .status {
    max-width: 100%;
    font-size: 13px;
    margin-top: 14px;
  }

  .result {
    margin-top: 20px;
  }

  .pages {
    gap: 16px;
  }

  .result-actions {
    margin: 18px 0 6px;
  }

  .btn-download,
  .btn-back {
    min-width: 150px;
    margin: 0 10px;
  }

  footer {
    margin-top: 22px;
    font-size: 11px;
    padding: 0 8px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .page-title {
    letter-spacing: 0;
  }

  .captcha-group {
    gap: 8px;
  }

  .captcha-img {
    width: 92px;
  }

  .btn-query,
  .btn-download,
  .btn-back {
    max-width: none;
  }
}

/* ---------------- 提示弹窗 ---------------- */
.alert-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 0 24px;
}

.alert-mask.show {
  display: flex;
}

.alert-box {
  width: 100%;
  max-width: 300px;
  background: #fff;
  border-radius: 10px;
  padding: 26px 0 20px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  animation: alertIn .18s ease-out;
}

@keyframes alertIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.alert-msg {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 22px;
  word-break: break-all;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.alert-btn {
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  border: 0;
  background: transparent;
  outline: none;
}

.alert-btn:active {
  opacity: .85;
}

@media (max-width: 768px) {

  .report-page {
    padding: 22px 18px 28px;
  }
}