* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #2c3e50;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  font-size: 14px;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #1F4E79 0%, #2d6a9f 100%);
  color: #fff;
  padding: 24px 32px;
  box-shadow: 0 2px 8px rgba(31, 78, 121, 0.15);
}
header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
header .subtitle {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.85;
  font-weight: 300;
}

main {
  padding: 24px 32px;
  max-width: 1600px;
  margin: 0 auto;
}

/* 上传区 */
.upload-panel {
  background: #fff;
  border: none;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.upload-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.upload-slot {
  border: 2px dashed #d0d7de;
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  transition: all 0.2s ease;
  background: #fafbfc;
}
.upload-slot:hover {
  border-color: #1F4E79;
  background: #f0f6ff;
}
.upload-slot.required .slot-label::after {
  content: " *";
  color: #e53e3e;
  font-weight: 700;
}
.upload-slot.has-file {
  border-style: solid;
  border-color: #48bb78;
  background: #f0fff4;
}
.slot-label {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 14px;
  color: #2d3748;
}
.slot-file {
  font-size: 12px;
  color: #718096;
  word-break: break-all;
  min-height: 18px;
  margin-bottom: 8px;
}
.slot-hint {
  font-size: 11px;
  color: #a0aec0;
  margin-bottom: 10px;
}
.upload-slot input[type=file] {
  display: none;
}
.slot-btn {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: #4a5568;
  transition: all 0.15s;
}
.slot-btn:hover {
  background: #edf2f7;
  border-color: #a0aec0;
}

.template-select {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 7px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: #2d3748;
  cursor: pointer;
  transition: border-color 0.15s;
}
.template-select:focus {
  outline: none;
  border-color: #1F4E79;
  box-shadow: 0 0 0 2px rgba(31, 78, 121, 0.1);
}

.actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}
.actions button {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
#btn-compare {
  background: linear-gradient(135deg, #1F4E79 0%, #2d6a9f 100%);
  color: #fff;
}
#btn-compare:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 78, 121, 0.3);
}
#btn-compare:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  box-shadow: none;
}
#btn-sample {
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
  box-shadow: none;
}
#btn-sample:hover {
  background: #bee3f8;
}
#btn-export {
  background: linear-gradient(135deg, #2f855a 0%, #38a169 100%);
  color: #fff;
}
#btn-export:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(47, 133, 90, 0.3);
}
#btn-export:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  box-shadow: none;
}
#btn-reset {
  background: #fff;
  color: #718096;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}
#btn-reset:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.status-msg {
  margin-left: auto;
  font-size: 13px;
  color: #718096;
}
.status-msg.error { color: #e53e3e; }

/* 标签页 */
.tabs { display: none; }
.tabs.active { display: block; }
.tab-nav {
  list-style: none;
  display: flex;
  margin: 0 0 0;
  padding: 0;
  background: #fff;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}
.tab-nav li {
  padding: 14px 24px;
  cursor: pointer;
  font-size: 14px;
  color: #718096;
  border-right: 1px solid #f7fafc;
  user-select: none;
  transition: all 0.15s;
  font-weight: 500;
}
.tab-nav li:hover {
  background: #f7fafc;
  color: #2d3748;
}
.tab-nav li.active {
  background: #1F4E79;
  color: #fff;
  font-weight: 600;
}
.tab-pane {
  display: none;
  background: #fff;
  border: none;
  border-radius: 0 0 12px 12px;
  padding: 20px;
  overflow: auto;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.tab-pane.active { display: block; }

/* 表格 */
table.result-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  border-radius: 8px;
  overflow: hidden;
}
table.result-table th, table.result-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
}
table.result-table thead th {
  background: linear-gradient(135deg, #1F4E79 0%, #2d6a9f 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12px;
}
table.result-table tbody tr {
  transition: background 0.1s;
}
table.result-table tbody tr:hover {
  filter: brightness(0.97);
}

/* 结论行配色 */
tr.row-same td { background: #E2EFDA; }
tr.row-impdiff td { background: #E57373; color: #fff; }
tr.row-itemdiff td { background: #EF9A9A; }
tr.row-catdiff td { background: #FFCDD2; }
tr.row-bodydiff td { background: #FFEBEE; }
tr.row-new td { background: #DDEBF7; }
tr.miss-star td { background: #FFF2CC; }
tr.miss-tri td { background: #EDEDED; }

/* 两个 * 高亮单元格 */
td.two-star {
  background: #FFE699 !important;
  font-weight: 700;
  position: relative;
}
td.two-star::after {
  content: "**";
  position: absolute;
  top: 0;
  right: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #b8860b;
}

.legend {
  font-size: 12px;
  color: #4a5568;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #f7fafc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.legend .swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  vertical-align: -2px;
  margin: 0 4px 0 12px;
}

/* 总览 */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1F4E79;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 12px;
  color: #718096;
  margin-top: 4px;
  font-weight: 500;
}

.overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-radius: 8px;
  overflow: hidden;
}
.overview-table th, .overview-table td {
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  text-align: left;
}
.overview-table th {
  background: linear-gradient(135deg, #1F4E79 0%, #2d6a9f 100%);
  color: #fff;
  font-weight: 600;
}
.overview-table tbody tr:nth-child(even) {
  background: #f7fafc;
}

.mono { font-family: "SF Mono", Consolas, monospace; }

h3 {
  font-size: 15px;
  font-weight: 600;
  color: #2d3748;
  margin: 24px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.filter-bar {
  margin: 12px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background: #f7fafc;
  border-radius: 8px;
}
.filter-bar > span {
  font-size: 13px;
  color: #4a5568;
  font-weight: 600;
}
.filter-btn {
  padding: 5px 14px;
  border: 1px solid #cbd5e0;
  border-radius: 16px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: #4a5568;
}
.filter-btn.active {
  background: #1F4E79;
  color: #fff;
  border-color: #1F4E79;
  box-shadow: 0 1px 4px rgba(31, 78, 121, 0.2);
}
.filter-btn.inactive {
  background: #f7fafc;
  color: #a0aec0;
  border-color: #e2e8f0;
}
.filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}
