:root {
  color-scheme: light;
  --ink: #17221c;
  --muted: #657069;
  --green: #0c6848;
  --green-dark: #074c35;
  --green-soft: #e8f3ed;
  --cream: #f4f0e5;
  --paper: #fffdf7;
  --line: #d8ddd8;
  --red: #b33a2b;
  --red-soft: #faeae6;
  --amber: #986900;
  --amber-soft: #fff2cc;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(12, 104, 72, .10), transparent 28rem),
    var(--cream);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}
.shell { width: min(1480px, calc(100% - 40px)); margin: 32px auto 64px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 22px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-weight: 700; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 62px); letter-spacing: -.04em; }
.subtitle { margin: 8px 0 0; color: var(--muted); }
.stats { padding: 12px 16px; border: 1px solid #b8c8bf; border-radius: 12px; background: rgba(255,255,255,.6); color: var(--green-dark); }
.panel { margin-top: 18px; padding: 22px; border: 1px solid rgba(23,34,28,.12); border-radius: 18px; background: var(--paper); box-shadow: 0 12px 30px rgba(44,55,48,.06); }
label { display: block; font-weight: 700; }
.search-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; margin-top: 10px; }
input, textarea, select { width: 100%; border: 1px solid #aeb8b2; border-radius: 10px; padding: 12px 14px; background: white; color: var(--ink); font: inherit; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(12,104,72,.15); border-color: var(--green); }
textarea { margin-top: 9px; resize: vertical; font-family: Consolas, "Microsoft YaHei UI", monospace; }
button { border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.button-link { display: inline-block; border-radius: 10px; padding: 11px 18px; font-weight: 700; text-decoration: none; }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.secondary { border: 1px solid #aeb8b2; background: white; color: var(--ink); }
.admin-mode-button.active { border-color: var(--amber); background: var(--amber-soft); color: #6d4b00; }
.admin-edit { border: 1px solid #bd8b16; background: var(--amber-soft); color: #6d4b00; }
.danger { background: var(--red); color: white; }
.danger:hover:not(:disabled) { background: #8f2b20; }
.hint, .section-title p, .message { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.section-title { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
h2 { margin: 0; font-size: 22px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 18px 0 10px; color: var(--muted); font-size: 13px; }
.batch-missing { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 10px 0 14px; padding: 13px 14px; border: 1px solid #e4c56f; border-radius: 10px; background: var(--amber-soft); color: #6d4b00; }
.batch-missing[hidden] { display: none; }
.batch-missing p { margin: 6px 0 0; font-family: Consolas, "Microsoft YaHei UI", monospace; line-height: 1.65; overflow-wrap: anywhere; }
.batch-missing button { flex: 0 0 auto; }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; }
.dot.confirmed { background: var(--green); }
.dot.conflict { background: var(--red); }
.dot.review { background: var(--amber); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.result-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 14px; }
.result-pagination[hidden] { display: none; }
.result-pagination span { color: var(--muted); font-size: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 1450px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #eff2ed; color: #465048; font-size: 13px; }
td.code { font-family: Consolas, "Microsoft YaHei UI", monospace; word-break: break-all; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-confirmed { background: var(--green-soft); color: var(--green-dark); }
.badge-conflict { background: var(--red-soft); color: var(--red); }
.badge-needs_review { background: var(--amber-soft); color: var(--amber); }
.source { color: var(--muted); font-size: 12px; white-space: nowrap; }
.product-image { display: block; width: 76px; height: 76px; border-radius: 9px; object-fit: contain; background: white; border: 1px solid var(--line); }
.image-missing { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 9px; background: #eff2ed; color: var(--muted); font-size: 12px; }
.value-list { min-width: 80px; white-space: nowrap; }
.row-actions { display: flex; gap: 7px; white-space: nowrap; }
.empty { padding: 44px; text-align: center; color: var(--muted); }
details summary { cursor: pointer; font-size: 20px; font-weight: 700; }
.register-content { padding-top: 16px; }
.warning { padding: 12px 14px; border-left: 4px solid var(--amber); background: var(--amber-soft); }
.import-box { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 18px 0 0; padding: 16px; border: 1px dashed #9eaaa3; border-radius: 12px; background: #f8faf7; }
.import-box p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.import-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.import-actions input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-button { display: inline-block; border-radius: 10px; padding: 11px 18px; background: var(--green); color: white; cursor: pointer; }
.import-actions a { color: var(--green-dark); font-weight: 700; }
.import-preview { margin-top: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.import-preview table { min-width: 1050px; }
.import-preview th, .import-preview td { padding: 9px 11px; font-size: 12px; }
.import-preview .product-image, .import-preview .image-missing { width: 48px; height: 48px; }
.preview-note { padding: 10px 12px; color: var(--muted); font-size: 12px; background: #f8faf7; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; margin: 14px 0; }
.form-grid input { margin-top: 7px; }
.metadata-note { margin: 16px 0 8px; color: var(--muted); font-size: 13px; }
.metadata-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metadata-grid input { margin-top: 7px; }
.message.error { color: var(--red); }
.message.success { color: var(--green); }
.modal { width: min(620px, calc(100% - 24px)); border: 0; border-radius: 18px; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(12, 20, 16, .55); backdrop-filter: blur(2px); }
.modal form { padding: 24px; }
.modal-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.modal-title p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.icon-button { padding: 0; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 24px; line-height: 1; }
.modal label input { margin-top: 7px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.edit-modal { width: min(880px, calc(100% - 24px)); }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bulk-modal { width: min(1180px, calc(100% - 24px)); }
.bulk-toolbar { display: flex; align-items: center; gap: 12px; }
.bulk-toolbar input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bulk-modal .import-preview { max-height: 360px; }
.bulk-modal .import-preview table { min-width: 1350px; }
.conflict-modal { width: min(1180px, calc(100% - 24px)); }
.conflict-groups { display: grid; gap: 14px; max-height: 55vh; overflow: auto; margin-top: 16px; }
.conflict-group { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; }
.conflict-group h3 { margin: 0 0 10px; font-size: 15px; overflow-wrap: anywhere; }
.conflict-choice { display: grid; grid-template-columns: 24px minmax(190px, 1fr) minmax(120px, .7fr) minmax(180px, 1fr); gap: 10px; align-items: start; padding: 9px 6px; border-top: 1px solid var(--line); cursor: pointer; }
.conflict-choice:first-of-type { border-top: 0; }
.conflict-choice input { margin-top: 3px; }
.conflict-choice .code { overflow-wrap: anywhere; }
.conflict-choice.reject-all { color: var(--danger); font-weight: 700; }
@media (max-width: 760px) {
  .conflict-choice { grid-template-columns: 24px 1fr; }
  .conflict-choice .conflict-meta { grid-column: 2; }
}
.pricing-table { min-width: 2800px; }
.pricing-table th { white-space: nowrap; }
.pricing-table td { max-width: 260px; }
.pricing-table .long-value { min-width: 160px; white-space: normal; }
.pricing-help p { margin: 10px 0 0; color: var(--muted); line-height: 1.7; }
@media (max-width: 720px) {
  .shell { width: min(100% - 20px, 1480px); margin-top: 18px; }
  .topbar { display: block; }
  .topbar-actions { margin-top: 16px; align-items: stretch; flex-direction: column; }
  .stats { margin-top: 16px; }
  .search-row, .form-grid, .metadata-grid { grid-template-columns: 1fr; }
  .import-box { display: block; }
  .import-actions { margin-top: 14px; }
  .section-title { align-items: flex-start; }
  .batch-missing { display: block; }
  .batch-missing button { margin-top: 10px; }
  .edit-grid { grid-template-columns: 1fr; }
}
