

/* === 表格布局修复 - 关键！=== */
table.t {
  width: 100%;
  border: 2px solid #4a5568;
  border-collapse: collapse;
  margin: 16px 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  table-layout: auto; /* 自动列宽 */
}

/* 列宽设置 - 自动适应内容 */
table.t th, table.t td {
  word-break: break-word;
  white-space: normal;
  overflow: visible;
}
table.t th:nth-child(1), table.t td:nth-child(1) { min-width: 80px; }  /* 子分部名称 */
table.t th:nth-child(2), table.t td:nth-child(2) { min-width: 80px; }  /* 子项名称 */
table.t th:nth-child(3), table.t td:nth-child(3) { min-width: 120px; } /* 内容和方法 */
table.t th:nth-child(4), table.t td:nth-child(4) { min-width: 100px; } /* 要求 */
table.t th:nth-child(5), table.t td:nth-child(5) { min-width: 70px; }  /* 检查部位 */
table.t th:nth-child(6), table.t td:nth-child(6) { min-width: 60px; }  /* 查验数量 */
table.t th:nth-child(7), table.t td:nth-child(7) { min-width: 60px; }  /* 查验情况 */
table.t th:nth-child(8), table.t td:nth-child(8) { min-width: 50px; }  /* A */
table.t th:nth-child(9), table.t td:nth-child(9) { min-width: 50px; }  /* B */

/* 表头样式 */
table.t th {
  /* 已统一字体 */
  /* 已统一字体 */
  background: linear-gradient(180deg, #4299e1 0%, #3182ce 100%);
  color: #fff;
  /* 已统一字体 */
  padding: 8px 6px;
  text-align: center;
  border: 2px solid #2c5282;
  white-space: normal;
}

/* 单元格样式 */
table.t td {
  color: #333;
  border: 1px solid #cbd5e0;
  padding: 6px 8px;
  vertical-align: middle;
  word-break: break-word;
  overflow: visible;
  white-space: normal; /* 允许换行 */
}

/* 偶数行背景 */
table.t tr:nth-child(even) td {
  background: #f7fafc;
}

/* 悬停效果 */
table.t tr:hover td {
  background: #edf2f7;
}

/* 第一列（标签列）样式 */
table.t td:first-child {
  /* 已统一字体 */
  /* 已统一字体 */
  /* 已统一字体 */
  background: #edf2f7;
  text-align: left;
}

/* 单选框居中 */
.radio-group {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.radio-group label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: normal;
}

.radio-group input[type="radio"] {
  margin: 0;
  cursor: pointer;
  width: 14px;
  height: 14px;
}

/* 照片上传区域 - 不破坏表格结构 */
.photo-row td {
  padding: 8px !important;
  border-top: 2px dashed #cbd5e0;
  background: #f8fafc !important;
  text-align: left;
}

.photo-box {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.photo-wrap {
  display: block;
  position: relative;
  margin: 2px;
}

.photo-thumb {
  width: 50px;
  height: 50px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  object-fit: cover;
  cursor: pointer;
}

.photo-input {
  padding: 3px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  margin-right: 8px;
}

.photo-input::-webkit-file-upload-button {
  padding: 2px 8px;
  background: #4299e1;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.photo-del {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e53e3e;
  color: #fff;
  border: 1px solid #fff;
  cursor: pointer;
  width: 14px;
  height: 14px;
  line-height: 12px;
  text-align: center;
  padding: 0;
  border-radius: 50%;
}


/* 输入框无边框样式 - 修复"方框套小框" */
td input[type="text"],
td textarea {
  width: 100%;
  border: none !important; /* 移除边框 */
  padding: 6px 8px;
  background: transparent; /* 透明背景 */
  border-radius: 0;
  outline: none;
}

td input[type="text"]:focus,
td textarea:focus {
  background: #fff; /* 焦点时白色背景 */
  box-shadow: inset 0 0 0 2px #4299e1; /* 内阴影代替边框 */
}

td input[type="text"]:hover,
td textarea:hover {
  background: #f7fafc; /* 悬停时浅灰背景 */
}

/* 照片输入框保持边框 */

/* 照片按钮在单元格内样式 */
.photo-input {
  padding: 2px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  margin-left: 6px;
  display: block;
  width: auto;
}
.photo-input::-webkit-file-upload-button {
  padding: 1px 6px;
  background: #4299e1;
  color: #fff;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}
.photo-box {
  display: inline-flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.photo-wrap {
  display: block;
  position: relative;
  margin: 1px;
}
.photo-thumb {
  width: 40px;
  height: auto;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  object-fit: cover;
}
.photo-del {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #e53e3e;
  color: #fff;
  border: 1px solid #fff;
  cursor: pointer;
  width: 12px;
  height: 12px;
  line-height: 10px;
  text-align: center;
  padding: 0;
  border-radius: 50%;
}

/* 封面样式 */
.cover-page {
  text-align: center;
  padding: 80px 20px 60px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.cover-title {
  /* 已统一字体 */
  /* 已统一字体 */
  margin-bottom: 8px;
  letter-spacing: 6px;
  /* 已统一字体 */
}

.cover-subtitle {
  /* 已统一字体 */
  /* 已统一字体 */
  margin-bottom: 50px;
  letter-spacing: 4px;
  color: #1a56db;
}

.cover-spacer {
  height: auto;
}

.cover-field {
  margin: 20px 0;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.cover-field-label {
  /* 已统一字体 */
  /* 已统一字体 */
}

.cover-field-input {
  border-bottom: 2px solid #4a5568;
  display: block;
  min-width: 350px;
  padding: 0 8px;
  color: #4a5568;
}

/* 打印样式 */
@media print {
  body {
    padding: 0;
    background: #fff;
  }
  .toolbar {
    display: none !important;
  }
  table.t {
    box-shadow: none;
    border: 2px solid #000;
  }
  table.t th {
    background: #e0e0e0 !important;
    color: #000 !important;
    border: 1px solid #000;
  }
  table.t td {
    border: 1px solid #000;
  }
  table.t tr:nth-child(even) td {
    background: #f5f5f5;
  }
  .photo-input,
  .photo-del {
    display: none;
  }
  .photo-row {
    page-break-inside: avoid;
  }
}


/* 打印时输入框无边框 */
@media print {
  td input[type="text"],
  td textarea {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    width: auto !important;
  }
  td textarea {
    resize: none;
    overflow: visible;
  }
}


/* 复选框样式 */
td input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0 4px 0 0;
  vertical-align: middle;
  cursor: pointer;
  accent-color: #4299e1; /* 蓝色勾选 */
}

td input[type="checkbox"]:hover {
  accent-color: #3182ce;
}

/* 打印时复选框显示为实心<input type="checkbox" onclick="this.blur()" style="width:16px;height:16px;cursor:pointer;vertical-align:middle;margin:0 4px 0 0;" />□或✓ */
@media print {
  td input[type="checkbox"] {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


/* placeholder 样式 - 灰色斜体提示 */
td input::placeholder,
td textarea::placeholder {
  color: #999;
  font-style: italic;
  opacity: 0.8;
}

td input:focus::placeholder,
td textarea:focus::placeholder {
  opacity: 0.4;
}


/* === 自动换行修复 === */
table.t td {
  white-space: normal !important; /* 允许换行 */
  word-wrap: break-word; /* 长单词换行 */
  word-break: break-word; /* 中文换行 */
  overflow-wrap: break-word; /* 溢出换行 */
  line-height: 1.5; /* 行距 */
}

/* 输入框也自动换行 */
td input[type="text"] {
  white-space: normal;
  word-wrap: break-word;
  overflow: visible;
  height: auto;
  min-height: 32px; /* 最小高度 */
}

/* 文本框自动调整高度 */
td textarea {
  white-space: pre-wrap; /* 保留换行 */
  word-wrap: break-word;
  word-break: break-word;
  overflow-y: auto; /* 垂直滚动 */
  resize: vertical; /* 可调整高度 */
  min-height: auto;
  line-height: 1.5;
}

/* 表头也换行 */
table.t th {
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
}


/* === 子列宽度修复（已移除固定宽度，使用 auto + min-width）=== */

/* 表头文字换行 */
table.t th {
  white-space: normal !important;
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.3;
  padding: 6px 4px;
}

/* 表头竖排文字改为横排 */
table.t th br {
  display: none;
}


/* === 统一字体大小 === */
body {
  line-height: 1.5;
  color: #333;
}

/* 所有表格单元格统一字体 */
table.t td,
table.t th {
  color: #333;
}

/* 所有输入框统一字体 */
td input[type="text"],
td textarea,
td input[type="number"],
td input[type="date"] {
  color: #333;
}

/* 所有复选框、单选框标签统一字体 */
.radio-group label,
td input[type="checkbox"] + text,
td label {
  color: #333;
}

/* 照片按钮统一字体 */
.photo-input,
.photo-input::-webkit-file-upload-button {
}

/* 工具栏字体 */
.toolbar,
.toolbar button,
.toolbar strong {
}

/* 封面字体保持稍大 */
.cover-title {
}
.cover-subtitle {
}
.cover-field {
}


/* === 参照 Word 模板字体样式 === */
body {
  line-height: 1.75; /* 行距 1.75 倍 */
  color: #333;
}

/* 所有表格单元格 */
table.t td,
table.t th {
  line-height: 1.6; /* 行距 1.6 倍 */
  color: #333;
  vertical-align: middle;
  text-align: left;
}

/* 表头稍大 */
table.t th {
  text-align: center;
}

/* 第一列（标签列）稍粗 */
table.t td:first-child {
}

/* 所有输入框 */
td input[type="text"],
td textarea {
  line-height: 1.6;
  color: #333;
}

/* 复选框、单选框标签 */
td label,
.radio-group label {
  line-height: 1.6;
  color: #333;
}

/* 照片按钮 */
.photo-input,
.photo-input::-webkit-file-upload-button,
.btn-photo {
}

/* 项目标题（1、2、3...） */
  color: #1a237e;
}


/* === 单元格自动高度 === */
table.t td,
table.t th {
  height: auto !important; /* 自动高度 */
  min-height: auto !important; /* 移除最小高度 */
  max-height: none !important; /* 移除最大高度 */
  padding: 8px 10px; /* 合适内边距 */
  vertical-align: top; /* 顶部对齐 */
  line-height: 1.6; /* 行距 */
}

/* 输入框自动高度 */
td input[type="text"] {
  height: auto !important;
  min-height: 32px; /* 最小高度，保证一行可见 */
  padding: 6px 8px;
  line-height: 1.5;
}

/* 文本框自动调整高度 */
td textarea {
  height: auto !important;
  min-height: auto;
  max-height: none !important;
  resize: vertical; /* 可手动调整 */
  overflow-y: auto; /* 内容多时滚动 */
  line-height: 1.6;
  padding: 6px 8px;
}

/* 照片上传框自动高度 */
.photo-upload-box {
  height: auto !important;
  min-height: 120px;
}

.photo-upload-box .media-preview {
  min-height: auto;
  height: auto !important;
}

/* 确保表格行自动高度 */
table.t tr {
  height: auto !important;
}


/* === 彻底修复自动换行 === */
table.t {
  table-layout: fixed !important; /* 固定表格布局 */
  width: 100% !important;
}

table.t td,
table.t th {
  white-space: normal !important; /* 允许换行 */
  word-wrap: break-word !important; /* 长单词换行 */
  word-break: break-all !important; /* 中文换行 */
  overflow-wrap: break-word !important; /* 溢出换行 */
  overflow: visible !important; /* 不隐藏溢出 */
  text-overflow: clip !important; /* 不显示省略号 */
  line-height: 1.6 !important; /* 行距 */
  vertical-align: top !important; /* 顶部对齐 */
}

/* 输入框换行 */
td input[type="text"] {
  white-space: normal !important;
  word-wrap: break-word !important;
  word-break: break-all !important;
  overflow: visible !important;
  height: auto !important;
  min-height: 32px;
  line-height: 1.5;
  display: block; /* 块级显示 */
  width: 100% !important; /* 占满单元格 */
}

/* 文本框换行 */
td textarea {
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  word-break: break-all !important;
  overflow-y: auto !important;
  resize: vertical !important;
  line-height: 1.6;
  width: 100% !important;
}

/* 移除所有 white-space: normal; 设置 */
.white-space: normal;,
[style*="white-space: normal;"],
[style*="white-space: white-space: normal;"] {
  white-space: normal !important;
}


/* === 彻底修复输入框换行 === */

/* 输入框改为块级显示，自动换行 */
td input[type="text"] {
  display: block !important; /* 块级显示 */
  width: 100% !important; /* 占满单元格 */
  white-space: normal !important; /* 允许换行 */
  word-wrap: break-word !important; /* 长单词换行 */
  word-break: break-all !important; /* 中文强制换行 */
  overflow-wrap: break-word !important; /* 溢出换行 */
  overflow: visible !important; /* 不隐藏 */
  text-overflow: clip !important; /* 不显示省略号 */
  height: auto !important; /* 自动高度 */
  min-height: 32px !important; /* 最小高度 */
  line-height: 1.5 !important; /* 行距 */
  padding: 4px 6px !important; /* 内边距 */
  box-sizing: border-box !important; /* 包含 padding */
}

/* 单元格设置 */
table.t td {
  white-space: normal !important;
  word-wrap: break-word !important;
  word-break: break-all !important;
  overflow: visible !important;
  vertical-align: top !important; /* 顶部对齐 */
  padding: 6px 8px !important;
  line-height: 1.6 !important;
}

/* 表格固定布局 */
table.t {
  table-layout: fixed !important;
  width: 100% !important;
}

/* 文本框也换行 */
td textarea {
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  word-break: break-all !important;
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
}


  /* Logo 容器 - 右上角定位 */
  
  .logo-container img {
    width: 60px;
    height: 60px;
    display: block;
    object-fit: contain;
  }
  .logo-container .logo-text {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    font-weight: 500;
    white-space: nowrap;
  }
  /* 调整 header 样式以支持绝对定位 */
  header { background: #fff; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

