:root {
  --green: #83b735;
  --green-soft: #e8f1d2;
  --text: #242424;
  --muted: #666;
  --line: #e8e8e8;
  --page: #f7f7f7;
  --white: #fff;
  --red: #ff3f32;
  --blue: #3b82ff;
  --yellow: #f2b42b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

textarea {
  resize: vertical;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.brand-lockup,
.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #1f1f1f;
  font-weight: 900;
  text-decoration: none;
}

.brand-lockup {
  margin-bottom: 28px;
}

.brand-lockup img,
.admin-brand img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--white);
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.header-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.header-actions,
.modal-actions,
.detail-actions,
.image-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(360px, 1fr) minmax(380px, 520px);
  gap: 18px;
  width: min(1540px, calc(100% - 36px));
  margin: 18px auto;
  align-items: start;
}

.quote-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 14px;
  width: calc(100% - 20px);
  max-width: 2280px;
  margin: 18px auto;
  align-items: start;
}

.series-panel,
.product-panel,
.detail-panel {
  min-height: calc(100vh - 94px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.series-panel,
.detail-panel {
  position: sticky;
  top: 76px;
}

.quote-side-panel,
.quote-save-panel,
.quote-maint-panel {
  min-height: calc(100vh - 94px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.quote-side-panel,
.quote-save-panel {
  position: sticky;
  top: 76px;
  display: grid;
  align-content: start;
  gap: 14px;
  max-height: calc(100vh - 94px);
  overflow: auto;
  padding: 16px;
}

.quote-save-panel {
  min-height: auto;
}

.quote-maint-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  max-height: calc(100vh - 94px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.series-panel {
  padding: 16px;
}

.product-panel {
  padding: 16px;
}

.detail-panel {
  max-height: calc(100vh - 94px);
  overflow: auto;
  padding: 18px;
}

.panel-head,
.product-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.product-head {
  align-items: flex-start;
  flex-wrap: wrap;
}

.product-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.quote-maint-head {
  align-items: flex-start;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 0;
  padding: 12px 0 14px;
  border-bottom: 0;
  background: linear-gradient(180deg, rgba(244, 246, 241, 0.96) 0%, rgba(244, 246, 241, 0.82) 72%, rgba(244, 246, 241, 0) 100%);
  backdrop-filter: blur(6px);
}

.quote-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
}

.quote-toolbar > button {
  align-self: center;
}

.quote-save-state {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: min(340px, 48vw);
  min-height: 48px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.quote-save-panel .quote-save-button,
.quote-save-panel .quote-save-state {
  width: 100%;
  min-width: 0;
}

.quote-save-panel .quote-save-state strong,
.quote-save-panel .quote-save-state span,
.quote-save-panel .quote-save-state small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.quote-save-state strong,
.quote-save-state span,
.quote-save-state small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-save-state strong {
  color: #1f1f1f;
  font-size: 12px;
}

.quote-save-state span {
  color: #3d3d3d;
}

.quote-save-state small {
  color: var(--muted);
  font-size: 11px;
}

.quote-save-state[data-mode="saving"] {
  color: #705000;
  background: #fff8df;
}

.quote-save-state[data-mode="pending"] {
  color: #2d527a;
  background: #eef6ff;
}

.quote-save-state[data-mode="saved"] {
  color: #3f7115;
  background: var(--green-soft);
}

.quote-save-state[data-mode="error"] {
  color: #9b1b14;
  background: #fff1ef;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.sort-control select {
  width: auto;
  min-width: 132px;
  height: 34px;
  padding: 0 28px 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2 {
  font-size: 20px;
  line-height: 1.16;
  letter-spacing: 0;
}

h3 {
  font-size: 14px;
  line-height: 1.3;
}

.field,
.search-box {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: #3b3b3b;
  font-size: 12px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  outline: none;
  text-align: center;
}

input::placeholder,
textarea::placeholder {
  text-align: center;
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(131, 183, 53, 0.65);
  box-shadow: 0 0 0 3px rgba(131, 183, 53, 0.14);
}

.search-box input {
  padding-left: 14px;
  background: #f8f8f8;
}

.primary-button,
.preview-button,
.dark-button,
.ghost-button,
.danger-button,
.icon-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  white-space: nowrap;
}

.primary-button {
  width: 100%;
  padding: 0 18px;
  color: #fff;
  background: var(--green);
}

.preview-button {
  width: auto;
  padding: 0 18px;
  color: #271c03;
  background: var(--yellow);
}

.modal-actions .primary-button,
.detail-actions .primary-button,
.header-actions .primary-button {
  width: auto;
}

.primary-button.compact,
.preview-button.compact,
.dark-button,
.ghost-button,
.danger-button {
  width: auto;
  min-height: 34px;
  padding: 0 14px;
  font-size: 12px;
}

.dark-button {
  color: #fff;
  background: #0d0d0d;
}

.ghost-button {
  border: 1px solid var(--line);
  color: #2c2c2c;
  background: #fff;
}

.ghost-button.is-pinned {
  border-color: rgba(242, 180, 43, 0.75);
  color: #5b3b00;
  background: #fff3d7;
}

.danger-button {
  color: #fff;
  background: var(--red);
}

.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  color: #111;
  background: var(--green-soft);
  font-size: 20px;
  line-height: 1;
}

.mini-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: #2c2c2c;
  background: #fff;
  font-size: 11px;
}

.mini-button.is-danger {
  color: var(--red);
}

.spec-add-split {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  white-space: nowrap;
}

.spec-add-main {
  border-radius: 999px 0 0 999px;
  padding-left: 12px;
  padding-right: 12px;
}

.spec-add-toggle {
  width: 30px;
  min-width: 30px;
  margin-left: -1px;
  padding: 0;
  border-radius: 0 999px 999px 0;
}

.spec-add-toggle span {
  display: block;
  transform: translateY(-1px);
  font-size: 14px;
  line-height: 1;
}

.spec-preset-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 116px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.spec-preset-menu button {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #2c2c2c;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.spec-preset-menu button:hover {
  background: var(--green-soft);
}

.series-list {
  display: grid;
  gap: 8px;
}

.series-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.series-item.is-active {
  border-color: rgba(131, 183, 53, 0.65);
  background: linear-gradient(180deg, #fff 0%, #f7fbef 100%);
}

.series-main {
  min-width: 0;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.series-main strong,
.product-card strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-main span,
.product-card span,
.image-meta,
.form-message,
.muted-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.series-tools {
  display: flex;
  gap: 4px;
}

.tool-dot {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #2c2c2c;
  background: #fff;
  font-weight: 900;
}

.tool-dot.is-danger {
  color: var(--red);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
}

.quote-table-shell {
  max-width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.quote-edit-table {
  min-width: 1280px;
  padding: 4px 0 20px;
}

.quote-edit-grid {
  display: grid;
  grid-template-columns: var(--quote-template);
}

.quote-edit-header {
  position: sticky;
  top: var(--quote-sticky-offset, 0px);
  z-index: 8;
  overflow: hidden;
  margin-bottom: 12px;
  border: 0;
  border-radius: var(--radius);
  background: #202020;
}

.quote-edit-head-cell {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 7px 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.quote-edit-head-cell:last-child {
  border-right: 0;
}

.quote-edit-list {
  display: grid;
  gap: 12px;
}

.quote-edit-product {
  position: relative;
  overflow: hidden;
  border: 1px solid #dedede;
  border-radius: var(--radius);
  background: #fff;
}

.quote-edit-product.is-focused {
  z-index: 2;
  border-color: rgba(131, 183, 53, 0.7);
  box-shadow: 0 0 0 2px rgba(131, 183, 53, 0.2) inset;
}

.quote-edit-cell {
  min-width: 0;
  min-height: 46px;
  border-right: 1px solid #e1e1e1;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
}

.quote-span-cell {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 9px;
}

.quote-image-cell {
  place-items: center;
  background: #f6f6f6;
}

.quote-image-cell img {
  width: 100%;
  height: 116px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.quote-cover-drop {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: 100%;
  min-height: 116px;
  padding: 10px;
  border: 1px dashed #bfc8b2;
  border-radius: 6px;
  background: #fbfdf7;
  color: #44651f;
  cursor: pointer;
}

.quote-cover-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.quote-cover-drop strong,
.quote-cover-drop span {
  pointer-events: none;
}

.quote-cover-drop strong {
  color: #2f5510;
  font-size: 13px;
  font-weight: 900;
}

.quote-image-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.quote-model-cell span,
.quote-model-cell strong {
  display: block;
}

.quote-model-cell span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.quote-model-cell strong {
  color: #111;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  word-break: break-word;
}

.quote-field-cell,
.quote-action-cell {
  display: grid;
  align-items: stretch;
}

.quote-field-cell {
  place-items: stretch;
}

.quote-field-cell.is-merged-cell {
  z-index: 1;
  border-bottom-color: #d5deda;
  background: #fff;
}

.quote-field-cell.is-cell-selected {
  position: relative;
  z-index: 3;
  box-shadow: inset 0 0 0 2px rgba(59, 130, 255, 0.85);
}

.quote-field-cell.is-repeated-value:not(:focus-within) .quote-cell-input {
  color: transparent;
  caret-color: transparent;
}

.quote-field-cell.is-repeated-value:not(:focus-within) .quote-cell-input::placeholder {
  color: transparent;
}

.quote-model-field-cell .quote-cell-input {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.quote-folder-model-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  color: #7c8a68;
  cursor: pointer;
  user-select: none;
  font-size: 15px;
  font-weight: 900;
}

.quote-folder-model-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quote-folder-model-toggle span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #c9d7bb;
  border-radius: 999px;
  color: transparent;
  background: #fff;
  transition: all 160ms ease;
}

.quote-folder-model-placeholder {
  display: block;
  width: 28px;
  min-width: 28px;
  height: 28px;
}

.quote-folder-model-toggle input:checked + span {
  border-color: #83b735;
  color: #fff;
  background: #83b735;
}

.quote-cell-input {
  width: 100%;
  min-height: 45px;
  height: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 0;
  color: #1e1e1e;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  vertical-align: middle;
}

textarea.quote-cell-input {
  resize: none;
  overflow: hidden;
  padding-block: 13px;
  text-align: center;
}

.quote-cell-input:focus {
  position: relative;
  z-index: 1;
  border-color: transparent;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(131, 183, 53, 0.55) inset;
}

.quote-action-cell {
  place-items: center;
  padding: 4px 6px;
}

.quote-action-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
}

.quote-action-tools .mini-button {
  flex: 0 0 auto;
  min-width: 52px;
}

.quote-folder-model-toggle {
  flex: 0 0 28px;
}

.quote-edit-row.is-alt-row,
.quote-edit-row.is-alt-row .quote-cell-input {
  background: #f7f8f8;
}

.quote-edit-row.is-total-row,
.quote-edit-row.is-total-row .quote-cell-input {
  color: #8b0000;
  background: #fff5f5;
}

.quote-cell-input.is-total-linked {
  color: #8b0000;
  font-weight: 900;
}

.quote-edit-row.is-dirty {
  box-shadow: inset 0 -2px 0 rgba(59, 130, 255, 0.75);
}

.quote-edit-row.is-saving {
  box-shadow: inset 0 -2px 0 rgba(242, 180, 43, 0.9);
}

.quote-edit-row.is-saved {
  box-shadow: inset 0 -2px 0 rgba(131, 183, 53, 0.95);
}

.quote-edit-row.is-save-error {
  box-shadow: inset 0 -2px 0 rgba(255, 63, 50, 0.95);
}

.quote-add-row-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 42px;
  padding: 7px 10px;
  border-right: 0;
  border-bottom: 0;
  background: #fbfcfa;
}

.quote-product-row-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quote-row-add-button {
  min-width: 82px;
  border-color: #c9ddb4;
  color: #3f7115;
  background: var(--green-soft);
}

.quote-product-delete-button {
  min-width: 90px;
}

.quote-cell-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  min-width: 128px;
  overflow: hidden;
  border: 1px solid #d8ded2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.quote-cell-menu button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid #eef0ed;
  color: #1f2a1c;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.quote-cell-menu button:last-child {
  border-bottom: 0;
}

.quote-cell-menu button:hover:not(:disabled) {
  background: #f4f8ee;
}

.quote-cell-menu button:disabled {
  color: #a8aea2;
  cursor: not-allowed;
}

.product-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.product-card.is-active {
  border-color: rgba(131, 183, 53, 0.7);
  box-shadow: 0 10px 24px rgba(131, 183, 53, 0.12);
}

.product-thumb {
  display: grid;
  height: 120px;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f5f5f5;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-thumb.is-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.product-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f2f2;
  color: #505050;
  font-size: 11px;
  font-weight: 900;
}

.pill.is-warn {
  color: #a15b00;
  background: #fff3d7;
}

.pill.is-green {
  color: #3f7115;
  background: var(--green-soft);
}

.pill.is-pin {
  color: #5b3b00;
  background: #fff3d7;
}

.detail-form {
  display: grid;
  gap: 14px;
}

.detail-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-title-row strong {
  display: block;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
}

.detail-title-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: -2px;
  padding-bottom: 2px;
}

.inline-progress {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfb;
}

.inline-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #3b3b3b;
  font-size: 12px;
  font-weight: 900;
}

.inline-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ececec;
}

.inline-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.18s ease;
}

.spec-list {
  display: grid;
  gap: 8px;
}

.spec-row {
  display: grid;
  grid-template-columns: 34px minmax(90px, 0.78fr) minmax(140px, 1.35fr) auto auto;
  gap: 8px;
  align-items: start;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.spec-row.is-dragging {
  opacity: 0.48;
}

.spec-drag-handle {
  display: grid;
  width: 34px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #7c7c7c;
  background: #fff;
  cursor: grab;
}

.spec-drag-handle:active {
  cursor: grabbing;
}

.spec-drag-handle span {
  width: 14px;
  height: 18px;
  background-image: radial-gradient(currentColor 1.6px, transparent 1.8px);
  background-position: 0 0;
  background-size: 7px 7px;
}

.spec-row textarea {
  min-height: 40px;
  max-height: 180px;
  overflow-y: auto;
  line-height: 1.45;
  white-space: pre-wrap;
}

.upload-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-button {
  position: relative;
  display: grid;
  min-height: 96px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed rgba(131, 183, 53, 0.7);
  border-radius: var(--radius);
  background: #fbfdf7;
  color: #3f7115;
  font-weight: 900;
  text-align: center;
  overflow: hidden;
}

.upload-button strong,
.upload-button span {
  pointer-events: none;
}

.upload-button strong {
  color: #2e5510;
  font-size: 14px;
}

.upload-button span {
  max-width: 12em;
  color: #5b7d35;
  font-size: 11px;
  line-height: 1.35;
}

.upload-zone.is-dragover {
  border-color: var(--green);
  background: #eef8dc;
  box-shadow: inset 0 0 0 2px rgba(131, 183, 53, 0.2);
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-manager-head {
  align-items: start;
}

.image-manager-head > div {
  display: grid;
  gap: 3px;
}

.batch-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid #f0d7d2;
  border-radius: var(--radius);
  background: #fff8f7;
}

.batch-toolbar span {
  margin-right: auto;
  color: #6d332d;
  font-size: 12px;
  font-weight: 900;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.image-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.image-card.is-selecting {
  padding-top: 38px;
}

.image-card.is-selected {
  border-color: rgba(255, 63, 50, 0.52);
  background: #fff9f8;
}

.image-check {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #303030;
  font-size: 11px;
  font-weight: 900;
  z-index: 1;
}

.image-check input {
  width: 14px;
  height: 14px;
  min-width: 14px;
  padding: 0;
  accent-color: var(--red);
}

.image-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 6px;
  background: #f6f6f6;
}

.image-actions {
  justify-content: space-between;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.orphan-box {
  margin-top: 14px;
  padding: 10px;
  border: 1px dashed #d8bd72;
  border-radius: var(--radius);
  color: #705000;
  background: #fff8df;
  font-size: 12px;
  font-weight: 800;
}

.modal {
  width: min(500px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.quote-product-modal {
  width: min(760px, calc(100% - 28px));
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(4px);
}

.modal-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 40;
  display: grid;
  gap: 6px;
  width: max-content;
  max-width: min(520px, calc(100% - 36px));
  padding: 14px 16px;
  border-radius: var(--radius);
  color: #fff;
  background: #111;
  box-shadow: var(--shadow);
  font-weight: 800;
  text-align: left;
  transform: translate(-50%, -50%);
}

.toast-title {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
}

.toast-body,
.toast-advice,
.toast-detail {
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  line-height: 1.45;
}

.toast-code {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #111;
  background: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.toast-detail {
  max-width: 100%;
  color: rgba(255, 255, 255, 0.62);
  word-break: break-word;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .quote-workspace {
    grid-template-columns: 1fr;
  }

  .quote-side-panel,
  .quote-save-panel {
    position: static;
    max-height: none;
  }

  .quote-maint-panel {
    min-height: auto;
    max-height: none;
  }

  .detail-panel {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
    min-height: 360px;
  }
}

@media (max-width: 760px) {
  .admin-header {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px;
  }

  .header-actions {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .workspace {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 620px);
  }

  .quote-workspace {
    width: min(100% - 20px, 760px);
  }

  .quote-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .quote-save-state {
    width: 100%;
    min-width: 100%;
  }

  .quote-table-shell {
    overflow: visible;
  }

  .quote-edit-table {
    min-width: 1120px;
  }

  .series-panel {
    position: static;
    min-height: auto;
  }

  .product-panel,
  .detail-panel {
    min-height: auto;
  }

  .form-grid,
  .upload-row,
  .spec-row {
    grid-template-columns: 1fr;
  }

  .product-head,
  .product-head-actions {
    align-items: stretch;
  }

  .product-head-actions,
  .sort-control,
  .sort-control select {
    width: 100%;
  }

  .spec-add-split {
    width: 100%;
  }

  .spec-add-main {
    flex: 1;
  }

  .spec-preset-menu {
    left: 0;
    right: 0;
  }

  .spec-drag-handle {
    width: 100%;
  }
}

/* ---------- 入口域名 / 同步状态 / 修改历史 ---------- */
.entry-role-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.entry-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(131, 183, 53, 0.5);
  border-radius: 999px;
  background: var(--green-soft);
  color: #3f5b12;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.entry-alert,
.sync-alert {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.entry-alert.is-info {
  background: var(--green-soft);
  color: #3f5b12;
}

.entry-alert.is-warn {
  background: #fff6df;
  color: #7a5200;
}

.entry-alert.is-bad,
.sync-alert {
  background: #ffecea;
  color: #9b1d12;
}

.ghost-button.is-alert {
  border-color: var(--red);
  color: var(--red);
  background: #fff;
}

.sync-card,
.history-card {
  display: grid;
  gap: 12px;
  width: min(760px, calc(100% - 28px));
  max-height: min(80vh, 720px);
  overflow: auto;
}

.sync-summary {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--page);
  font-size: 13px;
}

.sync-summary.is-alert {
  border-color: rgba(255, 63, 50, 0.45);
  background: #ffecea;
  color: #9b1d12;
}

.sync-summary p {
  margin: 0 0 4px;
}

.sync-summary p:last-child {
  margin-bottom: 0;
}

.sync-list,
.history-list {
  display: grid;
  gap: 8px;
}

.sync-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.sync-row-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.sync-row.is-ok .sync-row-dot {
  background: var(--green);
}

.sync-row.is-warn .sync-row-dot {
  background: var(--yellow);
}

.sync-row.is-bad .sync-row-dot {
  background: var(--red);
}

.sync-row.is-warn {
  border-color: rgba(242, 180, 43, 0.55);
  background: #fffaf0;
}

.sync-row.is-bad {
  border-color: rgba(255, 63, 50, 0.45);
  background: #fff5f4;
}

.sync-row-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sync-row-body strong {
  font-size: 13px;
}

.sync-row-body span {
  color: var(--muted);
  font-size: 12px;
}

.sync-row-body code {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.sync-caches {
  color: var(--muted);
  font-size: 12px;
}

.sync-caches-title {
  margin: 0 0 6px;
}

.sync-server {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
}

.sync-server p {
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}

.sync-cache-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

.history-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.history-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.history-item-head strong {
  font-size: 13px;
}

.history-item-head span {
  color: var(--muted);
  font-size: 12px;
}

.history-preview {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.history-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-detail:not([hidden]) {
  display: grid;
  gap: 10px;
}

.history-snapshot h4 {
  margin: 0 0 6px;
  font-size: 12px;
}

.history-snapshot pre {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--page);
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 260px;
  overflow: auto;
}

.history-empty {
  padding: 18px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

