.product-dimension-card {
  box-sizing: border-box;
  width: 220px;
  min-width: 220px;
  height: 156px;
  min-height: 156px;
  align-self: start;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 5px;
  border: 1px solid rgb(255 255 255 / 88%);
  border-radius: 18px;
  background: linear-gradient(145deg, rgb(255 255 255 / 78%), rgb(237 246 252 / 55%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 95%), 0 7px 20px rgb(67 105 132 / 7%);
  overflow: hidden;
}
.product-dimension-card > p { margin: 0; overflow: hidden; color: #7c93a2; font-size: 9px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.product-dimension-preview,
.product-dimension-empty {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 13px;
  overflow: hidden;
  background: #eef3f5;
}
.product-dimension-card .product-dimension-preview { display: block; cursor: zoom-in; opacity: 1; }
.product-dimension-card.is-editing .product-dimension-preview:not(:disabled) { cursor: pointer; }
.product-dimension-card.is-editing .product-dimension-preview:not(:disabled):hover { box-shadow: 0 0 0 2px rgb(232 112 50 / 26%); }
.product-dimension-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #7c94a4; font-size: 11px; line-height: 1.45; }
.product-dimension-empty svg { width: 24px; height: 24px; }
.product-dimension-empty.is-loading { background: linear-gradient(145deg, #f6fafc, #eaf2f6); }
.product-dimension-artwork { position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden; background: #fff; }
.product-dimension-artwork > img { position: absolute; object-fit: contain; }
.product-dimension-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.product-dimension-line > line { stroke: #e87032; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 1px rgb(70 43 30 / 30%)); }
.product-dimension-line > rect { fill: rgb(255 255 255 / 94%); stroke: rgb(221 106 48 / 52%); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.product-dimension-line > text { fill: #93451f; font-weight: 650; text-anchor: middle; dominant-baseline: middle; pointer-events: none; paint-order: stroke; stroke: rgb(255 255 255 / 72%); stroke-width: 1px; }
.product-dimension-line > text tspan:last-child { fill: #6f7e87; font-size: .8em; font-weight: 550; }
.product-dimension-line .product-dimension-empty-value { font-weight: 400; }
.product-dimension-line.is-active > rect { stroke: #d8581c; stroke-width: 2.5; }
.product-dimension-line-handle { fill: #fff; stroke: #e87032; stroke-width: 3; vector-effect: non-scaling-stroke; cursor: grab; }
.product-dimension-line > .product-dimension-line-hit { stroke: transparent; stroke-width: 24px; filter: none; pointer-events: stroke; cursor: grab; }
.product-dimension-line-hit:focus { outline: none; }
.product-dimension-line > .product-dimension-line-hit:focus-visible { stroke: rgb(232 112 50 / 15%); }
.product-dimension-handle-hit { fill: transparent; stroke: none; pointer-events: all; cursor: grab; }
.product-dimension-line > rect { cursor: pointer; }
.product-dimension-line > .product-dimension-snap-guide { stroke: #2d99c4; stroke-width: 1; stroke-dasharray: 5 4; filter: none; pointer-events: none; }
.product-dimension-inline-value { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #93451f; line-height: 1.15; touch-action: manipulation; }
.product-dimension-inline-value > div { display: flex; align-items: baseline; justify-content: center; gap: .2em; width: 92%; }
.product-dimension-inline-value input { box-sizing: border-box; max-width: 72%; min-width: 0; height: 1.2em; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font-family: inherit; font-size: inherit; line-height: 1.2; text-align: center; outline: none; box-shadow: none; }
.product-dimension-inline-value input:placeholder-shown { min-width: 2.25em; }
.product-dimension-inline-value > div > span { flex-shrink: 0; }
.product-dimension-inline-value small { color: #6f7e87; font-size: .8em; }
.product-dimension-label-output { pointer-events: none; }
.product-dimension-label-output strong { font-weight: 650; }
.fpa-picker.product-dimension-dialog[data-slot="dialog-content"] { width: min(760px, calc(100vw - 36px)); max-width: 760px; max-height: calc(100dvh - 36px); display: flex; flex-direction: column; gap: 13px; padding: 22px; overflow: auto; }
.product-dimension-dialog > [data-slot="dialog-header"],
.product-dimension-dialog > p { flex-shrink: 0; }
.product-dimension-dialog [data-slot="dialog-title"] { color: #345b72; }
.product-dimension-dialog > p { margin: 0; color: #6e8594; font-size: 12px; line-height: 1.55; }
.product-dimension-dialog > .product-dimension-guidance { display: flex; flex-direction: column; gap: 3px; width: min(94%, 520px, max(120px, calc(100dvh - 310px))); align-self: center; color: #82603e; font-size: 13px; line-height: 1.5; }
.product-dimension-guidance strong { font-size: 14px; color: #715034; }
.product-dimension-editor-stage { width: min(94%, 520px, max(120px, calc(100dvh - 310px))); aspect-ratio: 1; flex-shrink: 0; align-self: center; overflow: hidden; border: 1px solid rgb(255 255 255 / 92%); border-radius: 18px; background: #fff; box-shadow: 0 12px 32px rgb(47 76 95 / 12%); }
.product-dimension-tools { position: sticky; bottom: 0; z-index: 1; display: flex; flex: none; flex-wrap: wrap; justify-content: center; gap: 24px; }
.product-dimension-tools button { min-width: 132px; min-height: 46px; color: #365b73; font-size: 18px; font-weight: 600; border: 1px solid #bad0df; border-radius: 12px; background: #fff; box-shadow: 0 2px 6px rgb(47 76 95 / 8%); }
.product-dimension-tools button svg { width: 22px; height: 22px; }
.product-dimension-tools button:disabled { color: #738796; opacity: .65; box-shadow: none; }
.product-dimension-tools button.is-active { color: #b95120; background: rgb(248 229 219 / 72%); }
.product-dimension-dialog { --dimension-editor-width: min(94%, 520px, max(120px, calc(100dvh - 310px))); }
.product-dimension-dialog > [data-slot="dialog-header"],
.product-dimension-dialog > .product-dimension-guidance,
.product-dimension-dialog > .product-dimension-editor-stage { box-sizing: border-box; width: var(--dimension-editor-width); align-self: center; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; text-align: left; }
.product-dimension-dialog [data-slot="dialog-title"] { padding-left: 0; padding-right: 0; }
.product-dimension-editor-stage { position: relative; }
.product-dimension-photo-actions { position: absolute; right: 12px; top: 12px; z-index: 3; }
.product-dimension-photo-actions > button { min-height: 36px; background: rgb(255 255 255 / 96%); border: 1px solid #bad0df; color: #365b73; border-radius: 9px; }
.product-dimension-photo-upload { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 12px; }
.product-dimension-photo-loading { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgb(255 255 255 / 85%); color: #365b73; }
.is-spinning { animation: product-dimension-spin .9s linear infinite; }
@keyframes product-dimension-spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  .product-dimension-card { width: 188px; min-width: 188px; height: 156px; min-height: 156px; }
}
@media (max-width: 600px) {
  .product-dimension-card { width: 220px; max-width: 100%; min-width: 0; height: 156px; min-height: 156px; }
  .product-dimension-card > .product-dimension-preview,
  .product-dimension-card > .product-dimension-empty { aspect-ratio: auto; }
}
@media (prefers-reduced-motion: reduce) { .is-spinning { animation: none; } }

/* Match the existing decal-price entry, including empty hints and typed values. */
.product-library-detail[data-library-detail][data-library-kind="finished"] .library-stage-fields
  .library-inline-input:is([aria-label="库存数量"], [aria-label="单品单价"]) {
  font-size: 12px;
  font-weight: 550;
  line-height: 18px;
}
.product-library-detail[data-library-detail][data-library-kind="finished"] .library-stage-fields
  .library-inline-input:is([aria-label="库存数量"], [aria-label="单品单价"])::placeholder {
  font-size: inherit;
  font-weight: inherit;
}

@media (max-width: 620px) {
  /* Keep account setup on one scroll surface; preserve the desktop layout. */
  .mg-account.mg-access-dialog {
    display: block;
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .mg-access-dialog .mg-identity-fields { margin-top: 16px; gap: 12px; }
  .mg-access-dialog .mg-page-permissions { margin-top: 16px; }
  .mg-access-dialog .mg-page-picker { overflow: visible; }
  .mg-access-dialog .mg-module-list {
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .mg-access-dialog .mg-module-list > button { flex: 0 0 auto; }
  .mg-access-dialog .mg-module-panel,
  .mg-access-dialog .mg-permission-review-list { max-height: none; overflow: visible; }
  .mg-access-dialog .mg-footer {
    bottom: -16px;
    margin: 16px -14px -16px;
    padding: 12px 14px;
  }
}
