* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f5f6f8;
  color: #222;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #2c5e4f 0%, #4a8a6f 100%);
  color: #fff;
  padding: 14px 24px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
header .brand { display: flex; align-items: center; gap: 10px; }
header h1 { font-size: 18px; font-weight: 600; }
header .logo { font-size: 22px; }
header .ver { font-size: 11px; opacity: 0.7; margin-left: 6px; }
nav {
  display: flex; gap: 4px; margin-top: 14px;
}
nav button {
  background: rgba(255,255,255,0.1);
  border: none; color: #fff;
  padding: 9px 18px; cursor: pointer;
  border-radius: 6px 6px 0 0;
  font-size: 14px;
  transition: background 0.15s;
}
nav button:hover { background: rgba(255,255,255,0.2); }
nav button.active {
  background: #fff; color: #2c5e4f; font-weight: 600;
  position: relative;
}
nav button.active::after {
  content: ''; position: absolute; bottom: -1px; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 2px; background: #2c5e4f;
  border-radius: 1px;
}

main { padding: 18px 24px; max-width: 1400px; margin: 0 auto; }
section { display: none; }
section.active { display: block; }
h2 { font-size: 18px; margin-bottom: 14px; color: #2c5e4f; }
h3 { font-size: 14px; margin-bottom: 10px; color: #444; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1000px) { .grid { grid-template-columns: 1fr; } }

.form {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.form label {
  display: block;
  font-size: 12px;
  color: #666;
  margin: 8px 0 4px;
  font-weight: 500;
}
.form input, .form select, .form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d5d8;
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  background: #fafbfc;
  transition: border-color 0.15s;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: #4a8a6f; background: #fff;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.req { color: #c0392b; }

.actions {
  margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap;
}
button {
  background: #fff;
  border: 1px solid #d0d5d8;
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
button:hover { background: #f0f2f4; }
button.primary {
  background: #4a8a6f; color: #fff; border-color: #4a8a6f;
}
button.primary:hover { background: #3d7560; }
button.mini {
  padding: 3px 8px; font-size: 11px; margin-left: 6px;
}

.preview {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.preview iframe {
  width: 100%; min-height: 400px;
  border: 1px solid #e5e8ea;
  background: #fafafa;
  border-radius: 4px;
}

.toolbar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 10px;
}
.toolbar input { padding: 8px 12px; border: 1px solid #d0d5d8; border-radius: 5px; }
.upload {
  display: inline-block;
  background: #fff; border: 1px solid #d0d5d8;
  padding: 8px 16px; border-radius: 5px;
  cursor: pointer; font-size: 13px;
}
.upload:hover { background: #f0f2f4; }

/* 页面头部 + 统计卡 */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e8ea;
}
.page-header h2 { margin-bottom: 0; }
.stat-cards { display: flex; gap: 8px; }
.stat {
  background: #fff; padding: 7px 14px; border-radius: 6px;
  display: flex; align-items: baseline; gap: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #eef0f2;
}
.stat .num { font-weight: 700; color: #2c5e4f; font-size: 20px; line-height: 1; }
.stat .label { color: #888; font-size: 12px; }

/* 搜索框加图标 */
.search-box {
  position: relative; flex: 1;
}
.search-box .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: #888; font-size: 13px;
}
.search-box input {
  width: 100%; padding: 8px 12px 8px 30px;
  border: 1px solid #d0d5d8; border-radius: 5px;
  background: #fff;
  transition: border-color 0.15s;
}
.search-box input:focus { outline: none; border-color: #4a8a6f; }

.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.data-table th { background: #f0f2f4; padding: 9px 12px; text-align: left; font-size: 12px; color: #666; font-weight: 600; white-space: nowrap; }
.data-table td { padding: 9px 12px; border-top: 1px solid #eef0f2; font-size: 13px; line-height: 1.5; vertical-align: middle; }
.data-table tr:hover td { background: #f7faf8; }
.data-table th:nth-child(1), .data-table td:nth-child(1) { white-space: nowrap; width: 90px; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { white-space: nowrap; }
.data-table th:nth-child(3), .data-table td:nth-child(3) { max-width: 220px; }
.data-table th:nth-child(7), .data-table td:nth-child(7) { max-width: 120px; }
.data-table th:nth-child(8), .data-table td:nth-child(8) { white-space: nowrap; width: 110px; }
.data-table .pill-code {
  display: inline-block;
  background: linear-gradient(135deg, #2c5e4f 0%, #4a8a6f 100%);
  color: #fff; font-weight: 700;
  padding: 3px 11px; border-radius: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px; letter-spacing: 0.5px;
  cursor: help;
  box-shadow: 0 1px 2px rgba(44,94,79,0.2);
  transition: transform 0.1s;
}
.data-table .pill-code:hover { transform: scale(1.05); }
.data-table .pill-code.missing {
  background: #f0f2f4; color: #aaa; box-shadow: none;
  font-style: italic; font-weight: 400;
}
.data-table .empty { color: #cbd0d3; font-style: italic; }
.data-table .action-btn {
  background: transparent; border: 1px solid #e0e5e8;
  padding: 4px 10px; border-radius: 4px;
  font-size: 11px; cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  vertical-align: middle;
}
.data-table .action-btn:hover { background: #f0f2f4; }
.data-table .action-btn.edit { color: #2c5e4f; border-color: #c4dad1; }
.data-table .action-btn.edit:hover { background: #e8f3ee; }
.data-table .action-btn.del { color: #c0392b; border-color: #e8c4c0; margin-left: 8px; }
.data-table .action-btn.del:hover { background: #fce9e7; border-color: #c0392b; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 8px;
  width: 480px; max-width: 90vw; max-height: 90vh; overflow: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal.wide { width: 680px; }
.modal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 22px;
  background: linear-gradient(135deg, #2c5e4f 0%, #4a8a6f 100%);
  color: #fff;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 2px 8px rgba(44,94,79,0.15);
}
.modal-header h3 { color: #fff; margin: 0; font-size: 16px; font-weight: 600; }
.modal-header .modal-icon { font-size: 18px; }
.modal-header .modal-close {
  margin-left: auto; background: transparent; color: #fff;
  border: none; padding: 4px 10px; font-size: 18px; cursor: pointer;
  border-radius: 4px; line-height: 1;
}
.modal-header .modal-close:hover { background: rgba(255,255,255,0.18); }
.modal-body { padding: 14px 22px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 22px;
  border-top: 1px solid #eef0f2;
  background: #fafbfc;
  border-radius: 0 0 8px 8px;
}
.modal-footer button { padding: 8px 20px; font-weight: 500; }
.form-section {
  border: 1px solid #eef0f2; border-radius: 6px;
  padding: 12px 16px 8px; margin-bottom: 10px;
  background: #fafbfc;
}
.form-section:last-child { margin-bottom: 0; }
.form-section legend {
  padding: 0 8px; color: #2c5e4f; font-weight: 600; font-size: 13px;
  background: #fafbfc;
}
.form-section label {
  display: flex; align-items: baseline; gap: 6px;
  margin: 0 0 3px;
  font-size: 12px;
}
.form-section .hint { color: #888; font-size: 11px; font-weight: 400; }
.form-section .row2 { gap: 10px; }
.form-section .row2 > div label { margin-top: 0; }
.form-section input, .form-section textarea {
  padding: 7px 10px; font-size: 13px;
}
.form-section > div { margin-top: 6px; }
.form-section > div:first-child { margin-top: 0; }

.picklist {
  max-height: 50vh; overflow: auto;
  border: 1px solid #eef0f2; border-radius: 4px; margin-top: 10px;
}
.picklist .item {
  padding: 10px 14px; border-bottom: 1px solid #eef0f2; cursor: pointer;
}
.picklist .item:hover { background: #f0f2f4; }
.picklist .item:last-child { border-bottom: none; }

/* 内嵌产品选择面板 */
.pick-panel {
  margin-top: 16px;
  padding: 14px;
  border: 2px solid #4a8a6f;
  border-radius: 6px;
  background: #f7faf8;
}
.pick-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.pick-panel-head h4 {
  margin: 0; font-size: 14px; color: #2c5e4f;
}
.pick-panel input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d0d8d5;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 8px;
}
.pick-panel .picklist {
  max-height: 240px;
  margin-top: 0;
  background: #fff;
}

.printers {
  border: 1px solid #eef0f2; border-radius: 6px; background: #fafbfc;
  padding: 10px; min-height: 60px;
}
.printer-item {
  padding: 10px; border-bottom: 1px solid #eef0f2;
  display: flex; justify-content: space-between; align-items: center;
}
.printer-item:last-child { border-bottom: none; }
.printer-item .name { font-weight: 600; }
.printer-item .meta { font-size: 11px; color: #888; }
.printer-item button { font-size: 11px; padding: 4px 10px; }

.erp-status {
  background: #fafbfc; padding: 14px; border-radius: 6px;
  border: 1px solid #eef0f2; font-size: 13px; line-height: 1.8;
}

footer {
  text-align: center; padding: 18px; color: #888; font-size: 12px;
}