:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --line: #e5e5ea;
  --line-strong: #d1d1d6;
  --text: #1d1d1f;
  --sub: #6e6e73;
  --weak: #8e8e93;
  --brand: #1d1d1f;
  --brand-dark: #111113;
  --ok: #1d1d1f;
  --warn: #6e6e73;
  --err: #6e6e73;
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.login-stack {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}

.login-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--sub);
}

.site-record-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.site-record-link {
  color: inherit;
  text-decoration: none;
}

.site-record-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-record-sep {
  color: var(--line-strong);
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 20px 12px;
}

.brand {
  padding: 8px 10px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.brand h2 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 6px 0 0;
  color: var(--sub);
  font-size: 12px;
}

.brand-user {
  margin-top: 8px;
  font-size: 12px;
}

.brand-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.brand-actions .btn {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  font-size: 13px;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu-item,
.submenu-item {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
}

.menu-item:hover,
.submenu-item:hover {
  background: #f2f2f7;
}

.menu-item.active,
.submenu-item.active {
  background: #f2f2f7;
  color: var(--brand-dark);
  font-weight: 600;
}

.menu-group {
  display: grid;
  gap: 4px;
}

.menu-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-caret {
  font-size: 12px;
  color: var(--sub);
}

.submenu {
  display: grid;
  gap: 4px;
  padding-left: 10px;
}

.submenu-item {
  color: #6e6e73;
  font-size: 13px;
  padding: 8px 10px;
}

.content {
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.topbar .actions {
  display: flex;
  gap: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}

.card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.catalog-filter-stack {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}

.catalog-sort-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f7f7f8;
}

.catalog-delete-toolbar {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #f7f7f8;
  color: var(--sub);
  font-size: 13px;
}

.catalog-filter-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: start;
}

.catalog-filter-label {
  font-size: 13px;
  color: var(--sub);
  line-height: 36px;
  white-space: nowrap;
}

.catalog-filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.catalog-filter-track {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sortable-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 10px;
}

.sortable-chip.is-sortable {
  cursor: grab;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sortable-chip.is-sortable:hover {
  background: #f7f7f8;
}

.sortable-chip.is-sortable:active {
  cursor: grabbing;
}

.dragging {
  opacity: 0.45;
}

.sortable-chip.drag-over {
  background: #f2f2f7;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

tr.drag-over td {
  background: #f7f7f8;
}

.js-sort-gem-item.sort-enabled {
  cursor: grab;
}

.js-sort-gem-item.sort-enabled:active {
  cursor: grabbing;
}

.form-section-title {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text);
}

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

.col-1 {
  grid-column: span 1;
}

.col-2 {
  grid-column: span 2;
}

.col-3 {
  grid-column: span 3;
}

.col-4 {
  grid-column: span 4;
}

.col-5 {
  grid-column: span 5;
}

.col-6 {
  grid-column: span 6;
}

.col-7 {
  grid-column: span 7;
}

.col-8 {
  grid-column: span 8;
}

.col-12 {
  grid-column: span 12;
}

label {
  display: block;
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

select[multiple] {
  height: auto;
  min-height: 160px;
  padding: 8px 10px;
  line-height: 1.6;
}

select[multiple] option {
  padding: 4px 6px;
}

.multi-checklist {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  display: grid;
  gap: 6px;
}

.multi-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.multi-checklist-item input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  flex: 0 0 16px;
  accent-color: var(--brand);
}

.multi-checklist-item span {
  line-height: 1.4;
}

input::placeholder,
textarea::placeholder {
  color: var(--weak);
}

textarea {
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

.btn {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  padding: 0 14px;
  color: var(--text);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.danger {
  background: #fff;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn:hover {
  background: #f7f7f8;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.menu-item:focus-visible,
.submenu-item:focus-visible {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(142, 142, 147, 0.18);
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.media-action-group .btn,
.media-action-group .media-action-state {
  min-width: 88px;
  justify-content: center;
  box-sizing: border-box;
}

.media-action-btn,
.media-action-state {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.media-action-state {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f7f7f8;
  color: var(--sub);
  cursor: default;
}

.upload-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-inline input[type='file'] {
  flex: 1;
  min-width: 0;
}

.upload-inline .btn {
  white-space: nowrap;
}

.banner-upload-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.banner-upload-inline input[type='file'] {
  flex: 1;
  min-width: 220px;
}

.banner-crop-wrap {
  display: grid;
  gap: 12px;
}

.banner-crop-stage {
  width: 100%;
  aspect-ratio: 4 / 3;
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, rgba(29, 29, 31, 0.04) 25%, transparent 25%, transparent 75%, rgba(29, 29, 31, 0.04) 75%, rgba(29, 29, 31, 0.04) 100%),
    linear-gradient(45deg, rgba(29, 29, 31, 0.04) 25%, transparent 25%, transparent 75%, rgba(29, 29, 31, 0.04) 75%, rgba(29, 29, 31, 0.04) 100%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.banner-crop-stage.dragging {
  cursor: grabbing;
}

.banner-crop-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.banner-crop-controls {
  display: grid;
  gap: 8px;
}

.banner-crop-control-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  gap: 8px;
  align-items: center;
}

.banner-crop-control-row label {
  margin: 0;
}

.banner-crop-control-row input[type='range'] {
  height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

.banner-crop-actions {
  display: flex;
  justify-content: flex-end;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.stat .name {
  color: var(--sub);
  font-size: 12px;
}

.stat .value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--sub);
  font-weight: 600;
  background: #f7f7f8;
}

.tag {
  display: inline-block;
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.tag.ok {
  color: var(--text);
  border-color: var(--line);
  background: #f7f7f8;
}

.tag.warn {
  color: var(--sub);
  border-color: var(--line);
  background: #f7f7f8;
}

.tag.err {
  color: var(--sub);
  border-color: var(--line-strong);
  background: #f7f7f8;
}

.message {
  margin-bottom: 12px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.message.ok {
  background: #f7f7f8;
  border: 1px solid var(--line);
  color: var(--ok);
}

.message.err {
  background: #f7f7f8;
  border: 1px solid var(--line-strong);
  color: var(--err);
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.muted {
  color: var(--sub);
}

.muted.err {
  color: var(--err);
}

.audit-table {
  table-layout: fixed;
}

.audit-table th:nth-child(1) {
  width: 64px;
}

.audit-table th:nth-child(2) {
  width: 160px;
}

.audit-table th:nth-child(3) {
  width: 120px;
}

.audit-table th:nth-child(4) {
  width: 130px;
}

.audit-table th:nth-child(5) {
  width: 120px;
}

.audit-table th:nth-child(6) {
  width: 260px;
}

.audit-table th:nth-child(7) {
  width: 320px;
}

.audit-table th:nth-child(8) {
  width: 80px;
}

.audit-operator {
  white-space: nowrap;
}

.audit-module {
  display: grid;
  gap: 2px;
}

.audit-subcode {
  font-size: 12px;
  color: var(--sub);
}

.audit-summary {
  display: grid;
  gap: 4px;
}

.audit-summary-text {
  color: var(--sub);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-target {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.audit-meta-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.audit-meta-key {
  color: var(--sub);
  font-size: 12px;
  margin-bottom: 4px;
}

.audit-json-grid {
  display: grid;
  gap: 10px;
}

.audit-json-title {
  margin: 0 0 6px;
  color: var(--sub);
  font-size: 12px;
}

.audit-json {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f7f7f8;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.list-pager {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-pager-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.list-pager-actions select {
  width: auto;
  min-width: 96px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 29, 31, 0.22);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 24px;
}

.modal-panel {
  width: min(680px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-modal);
  padding: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #8e8e93;
}

.modal-body {
  margin-bottom: 10px;
}

.goods-editor-modal .modal-panel {
  width: min(1160px, 96vw);
}

.goods-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.goods-editor-form {
  min-width: 0;
}

.goods-editor-preview {
  min-width: 0;
}

.goods-preview-wrap {
  position: sticky;
  top: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, #f7f7f8 0%, #f1f2f4 100%);
}

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

.goods-preview-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.goods-preview-subtitle {
  font-size: 12px;
  color: var(--sub);
}

.goods-phone-preview {
  width: min(100%, 380px);
  margin: 0 auto;
  border-radius: 28px;
  border: 1px solid #d9dbe1;
  background: #111214;
  padding: 10px;
  box-shadow: 0 14px 36px rgba(17, 18, 20, 0.16);
}

.goods-phone-screen {
  overflow: hidden;
  border-radius: 22px;
  background: rgb(245, 245, 247);
}

.goods-phone-navbar {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(245, 245, 247);
  color: rgb(29, 29, 31);
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid rgba(229, 229, 234, 0.9);
}

.goods-phone-scroll {
  max-height: 620px;
  overflow: auto;
  padding: 12px;
}

.goods-preview-gallery {
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(229, 229, 234, 0.95);
}

.goods-preview-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.goods-preview-gallery-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgb(142, 142, 147);
  font-size: 13px;
  background: #fff;
}

.goods-preview-gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow: auto;
  margin-top: 10px;
  padding-bottom: 2px;
}

.goods-preview-thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(229, 229, 234, 0.95);
  background: #fff;
}

.goods-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.goods-preview-thumb-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgb(174, 174, 178);
  font-size: 11px;
}

.goods-preview-card {
  margin-top: 12px;
  border-radius: 18px;
  background: #fff;
  padding: 14px;
  border: 1px solid rgba(229, 229, 234, 0.95);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.goods-preview-product-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: rgb(29, 29, 31);
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
}

.goods-preview-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.goods-preview-price-stack {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.goods-preview-product-subtitle {
  margin-top: 8px;
  color: rgb(110, 110, 115);
  font-size: 13px;
  line-height: 1.5;
}

.goods-preview-price-now {
  color: rgb(29, 29, 31);
  font-size: 24px;
  font-weight: 700;
  text-align: right;
}

.goods-preview-price-old {
  margin-top: 4px;
  color: rgb(142, 142, 147);
  font-size: 13px;
  text-decoration: line-through;
  text-align: right;
}

.goods-preview-meta {
  margin-top: 12px;
  color: rgb(110, 110, 115);
  font-size: 12px;
}

.goods-preview-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.goods-preview-tag {
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgb(245, 245, 247);
  color: rgb(110, 110, 115);
  font-size: 12px;
  white-space: nowrap;
}

.goods-preview-section-title {
  margin: 0 0 8px;
  color: rgb(29, 29, 31);
  font-size: 16px;
  font-weight: 600;
}

.goods-preview-detail-image {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: rgb(245, 245, 247);
  border: 1px solid rgba(229, 229, 234, 0.95);
  margin-top: 10px;
}

.goods-preview-detail-image img {
  width: 100%;
  display: block;
}

.goods-preview-detail-text {
  margin-top: 10px;
  color: rgb(110, 110, 115);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.goods-preview-empty {
  color: rgb(142, 142, 147);
}

.goods-preview-actionbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(229, 229, 234, 0.9);
  background: #fff;
}

.goods-preview-action {
  height: 42px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.goods-preview-action-secondary {
  border: 1px solid rgb(229, 229, 234);
  background: #fff;
  color: rgb(29, 29, 31);
}

.goods-preview-action-primary {
  border: 1px solid rgb(29, 29, 31);
  background: rgb(29, 29, 31);
  color: #fff;
}

@media (max-width: 1100px) {
  .goods-editor-layout {
    grid-template-columns: 1fr;
  }

  .goods-preview-wrap {
    position: static;
  }
}

.autofill-trap {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.gem-preview-panel {
  border: 1px dashed #e5e5ea;
  border-radius: 12px;
  padding: 12px;
  background: #f7f7f8;
}

.gem-preview-editor {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.gem-preview-stage-wrap {
  min-width: 0;
}

.gem-preview-stage {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, rgba(29, 29, 31, 0.04) 25%, transparent 25%, transparent 75%, rgba(29, 29, 31, 0.04) 75%, rgba(29, 29, 31, 0.04) 100%),
    linear-gradient(45deg, rgba(29, 29, 31, 0.04) 25%, transparent 25%, transparent 75%, rgba(29, 29, 31, 0.04) 75%, rgba(29, 29, 31, 0.04) 100%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.gem-preview-stage.dragging {
  cursor: grabbing;
}

.gem-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.gem-preview-target-ring {
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--gem-target-fill, 95%);
  height: var(--gem-target-fill, 95%);
  transform: translate(-50%, -50%);
  border: 1px dashed var(--weak);
  border-radius: 50%;
  display: none;
}

.gem-preview-stage[data-shape='bead'] .gem-preview-target-ring {
  display: block;
}

.gem-preview-hole-baseline {
  pointer-events: none;
  position: absolute;
  left: calc(var(--gem-hole-x, 0.5) * 100%);
  top: calc(var(--gem-hole-y, 0.5) * 100%);
  width: calc(var(--gem-target-fill, 95%) - 12%);
  height: 0;
  transform: translate(-50%, -50%) rotate(var(--gem-hole-angle, 0deg));
  transform-origin: center;
  border-top: 1px dashed rgba(142, 142, 147, 0.95);
  display: block;
}

.gem-preview-hole-anchor {
  pointer-events: none;
  position: absolute;
  left: calc(var(--gem-hole-x, 0.5) * 100%);
  top: calc(var(--gem-hole-y, 0.5) * 100%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(142, 142, 147, 0.95);
  background: rgba(142, 142, 147, 0.2);
  transform: translate(-50%, -50%);
}

.gem-preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--sub);
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 8px;
}

.gem-preview-stage-tip {
  margin-top: 8px;
  font-size: 12px;
}

.gem-preview-controls {
  display: grid;
  gap: 10px;
}

.gem-hole-orientation-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.gem-hole-orientation-row label {
  margin: 0;
}

.gem-control-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 56px;
  gap: 8px;
  align-items: center;
}

.gem-control-row label {
  margin: 0;
}

.gem-control-row input[type='range'] {
  height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

.gem-control-row .mono {
  font-size: 12px;
  color: var(--sub);
  text-align: right;
}

.gem-row-thumb {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}

.design-library-table td {
  vertical-align: middle;
}

.design-row-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
}

.design-preview-board {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f7f7f8 100%);
  overflow: hidden;
}

.design-preview-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(142, 142, 147, 0.55);
}

.design-preview-node {
  position: absolute;
  box-sizing: border-box;
}

.design-preview-node .item-fill {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: none;
}

.design-preview-node.bead.shape-round .item-fill {
  border-radius: 50%;
}

.design-preview-node.bead.shape-free .item-fill,
.design-preview-node.spacer.shape-free .item-fill,
.design-preview-node.charm.shape-free .item-fill {
  border-radius: 0;
  border: none;
  box-shadow: none;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

.design-preview-node.spacer.shape-round .item-fill {
  border-radius: 999px;
}

.design-preview-node.charm.shape-round .item-fill {
  border-radius: 10px;
}

.design-preview-node .bead-core-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 7%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.2));
}

.design-preview-node .bead-highlight {
  position: absolute;
  width: 22%;
  height: 22%;
  right: 16%;
  top: 14%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
}

.goods-filter-form {
  margin: 12px 0 14px;
}

.goods-filter-actions {
  display: flex;
  align-items: flex-end;
}

.goods-product-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.goods-product-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
}

.goods-product-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sub);
  font-size: 12px;
}

.goods-product-title {
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

.goods-product-subtitle {
  margin-top: 4px;
  font-size: 12px;
  line-height: 18px;
  color: var(--sub);
  word-break: break-all;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-error {
  margin: 0 0 10px;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .menu {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .col-3,
  .col-2,
  .col-1,
  .col-4,
  .col-6,
  .col-8 {
    grid-column: span 12;
  }

  .list-pager {
    flex-direction: column;
    align-items: flex-start;
  }

  .catalog-sort-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .gem-preview-editor {
    grid-template-columns: 1fr;
  }

  .audit-detail-meta {
    grid-template-columns: 1fr;
  }
}
