/* Piko CRM · 产品 and 导入 (1.3): product images, the catalogue grid and list, the product beside it,
   the gallery and the full view, the product form's images, and the five-step import sheet.
   Tokens only (piko.css, crm.css); every rule under .crm-root. Thumbnails: radius 10 (the standard's
   thumbnail role); cards 16; the image always contained on a neutral backdrop, never cropped. */

/* ---- an image in a frame --------------------------------------------------------------------------- */
.crm-root .crm-media { position: relative; display: grid; place-items: center; overflow: hidden; background: var(--elevated); color: var(--tertiary); isolation: isolate; }
.crm-root .crm-media > .crm-icon { width: 38%; height: 38%; max-width: 44px; max-height: 44px; min-width: 12px; min-height: 12px; }
.crm-root .crm-media-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .22s var(--m-smooth); }
.crm-root .crm-media[data-state="ready"] .crm-media-img { opacity: 1; }
.crm-root .crm-media[data-state="error"] .crm-media-img { display: none; }
.crm-root .crm-media[data-state="loading"]::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--surface) 55%, transparent) 50%, transparent 70%); background-size: 250% 100%; animation: crm-media-wait 1.4s linear infinite; }
@keyframes crm-media-wait { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.crm-root .crm-thumb { flex: none; width: 40px; height: 40px; border-radius: 10px; box-shadow: inset 0 0 0 var(--hair) var(--line); }
.crm-root .crm-thumb[data-px="20"] { width: 20px; height: 20px; border-radius: 5px; }
.crm-root .crm-thumb[data-px="22"] { width: 22px; height: 22px; border-radius: 6px; }
.crm-root .crm-thumb[data-px="32"] { width: 32px; height: 32px; border-radius: 8px; }
.crm-root .crm-thumb[data-px="36"] { width: 36px; height: 36px; border-radius: 9px; }
.crm-root .crm-thumb[data-px="44"] { width: 44px; height: 44px; border-radius: 10px; }
.crm-root .crm-thumb-chip { margin-left: -6px; }
.crm-root .crm-combo-chip:has(.crm-thumb-chip) { padding-left: 10px; }
.crm-root .crm-product-line { display: flex; align-items: center; gap: 10px; }
.crm-root .crm-kcard-chips .crm-thumb-card { align-self: center; }

/* ---- the page: list + the product beside it ------------------------------------------------------------- */
.crm-root .crm-prod { flex: 1; min-width: 0; min-height: 0; display: flex; position: relative; }
.crm-root .crm-prod-side { flex: none; width: clamp(380px, 38%, 480px); min-height: 0; display: flex; flex-direction: column; border-left: var(--rule); background: var(--canvas); container-type: inline-size;
  animation: crm-prod-side-in var(--enter) both; }
@keyframes crm-prod-side-in { from { opacity: 0; transform: translateX(16px); } }
.crm-root .crm-prod[data-side="beside"] .crm-prod-side .crm-back, .crm-root .crm-prod[data-side="over"] .crm-prod-close { display: none; }
.crm-root .crm-prod[data-side="over"] .crm-prod-side { position: absolute; inset: 0; z-index: 2; width: auto; border-left: 0; animation-name: crm-push; }
.crm-root .crm-prod[data-side="over"][data-open="true"] > .crm-pane { visibility: hidden; }
.crm-root .crm-prod-side .crm-head { --pad: 20px; }
.crm-root .crm-prod-side .crm-head-start { margin-left: -8px; }
.crm-root .crm-prod[data-side="over"] .crm-prod-side .crm-head-start { margin-left: calc(var(--toggle-x) - var(--pad)); }

/* toolbar */
.crm-root .crm-prod-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.crm-root .crm-prod-tools .crm-search { flex: 1 1 220px; max-width: 300px; }
.crm-root .crm-prod-chips { flex: 1 1 0; display: flex; align-items: center; gap: 6px; min-width: 120px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.crm-root .crm-prod-chips::-webkit-scrollbar { display: none; }
.crm-root .crm-prod-end { flex: none; display: flex; align-items: center; gap: 10px; margin-left: auto; }
.crm-root .crm-prod-sort { display: flex; align-items: center; gap: 4px; color: var(--secondary); }
.crm-root .crm-prod-sort > .crm-icon { width: 16px; height: 16px; }
.crm-root .crm-prod-sort .crm-trigger { background: none; box-shadow: none; padding-left: 4px; }
.crm-root .crm-prod-switch button { display: grid; place-items: center; min-width: 36px; padding: 0 10px; }
.crm-root .crm-prod-switch .crm-icon { width: 17px; height: 17px; }
.crm-root:not([data-form="desk"]) .crm-prod-switch button { min-height: 40px; min-width: 44px; }
.crm-root:not([data-form="desk"]) .crm-prod-switch .crm-icon { width: 20px; height: 20px; }
.crm-root .crm-prod-select[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
@container col (max-width: 980px) {
  .crm-root .crm-prod-chips { order: 3; flex: 1 1 100%; }
}
@container col (max-width: 640px) {
  .crm-root .crm-prod-tools .crm-search { order: 1; flex: 1 1 0; min-width: 0; max-width: none; }
  .crm-root .crm-prod-end { display: contents; }
  .crm-root .crm-prod-switch { order: 2; }
  .crm-root .crm-prod-chips { order: 3; flex: 1 1 100%; margin: -2px calc(-1 * var(--pad)); padding: 2px var(--pad); }
  .crm-root .crm-prod-select { order: 4; }
  .crm-root .crm-prod-sort { order: 5; flex: 1 1 0; justify-content: flex-end; }
}
/* the bulk bar: what is chosen, and what can be done to all of it */
.crm-root .crm-prod-bulk { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px 8px 14px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line), var(--shadow); }
.crm-root .crm-prod-bulk[hidden] { display: none; }
.crm-root .crm-prod-bulk-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-root .crm-prod-bulk-gap { flex: 1; }
.crm-root .crm-prod-total { padding: 0 4px; font-size: var(--t-foot); color: var(--secondary); font-variant-numeric: tabular-nums; }
.crm-root .crm-prod-host { gap: 10px; }

/* the grid of cards */
.crm-root .crm-prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 16px; }
@container col (max-width: 560px) { .crm-root .crm-prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.crm-root .crm-pcard { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 8px 12px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line);
  color: inherit; text-decoration: none; transition: box-shadow var(--hover), transform .28s var(--m-release); }
.crm-root .crm-pcard:active { transform: scale(var(--press)); transition: transform .1s var(--m-smooth); }
@media (hover: hover) { .crm-root .crm-pcard:hover { box-shadow: 0 0 0 var(--hair) var(--line), var(--shadow); } }
.crm-root .crm-pcard[aria-current="true"] { box-shadow: 0 0 0 1.5px var(--ink); }
.crm-root .crm-pcard:focus-visible, .crm-root .crm-prodrow:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.crm-root .crm-pcard-media { position: relative; display: block; margin-bottom: 7px; border-radius: 10px; overflow: hidden; }
.crm-root .crm-pcard-media > .crm-media { aspect-ratio: 1; width: 100%; }
.crm-root .crm-pcard-state { position: absolute; left: 8px; top: 8px; }
.crm-root .crm-pcard-text { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; min-width: 0; }
.crm-root .crm-pcard-name { font-size: var(--t-body); font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.crm-root .crm-pcard-price { font-size: var(--t-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-root .crm-pcard-meta { padding: 0 4px; font-size: var(--t-foot); color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.crm-root .crm-quiet { color: var(--secondary); font-weight: 400; }
.crm-root .crm-pcard-bone { pointer-events: none; }
.crm-root .crm-pcard-bone .crm-pcard-media { aspect-ratio: 1; height: auto; width: 100%; border-radius: 10px; }
/* chosen while selecting: a round mark in the corner */
.crm-root .crm-pick-mark { position: absolute; right: 8px; top: 8px; z-index: 1; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: transparent;
  box-shadow: inset 0 0 0 1.5px var(--tertiary), 0 1px 3px rgba(0, 0, 0, .12); transition: background-color var(--hover); }
.crm-root .crm-pick-mark .crm-icon { width: 14px; height: 14px; }
.crm-root [aria-checked="true"] > .crm-pcard-media .crm-pick-mark, .crm-root .crm-prodrow[aria-checked="true"] .crm-pick-mark { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.crm-root .crm-pcard[aria-checked="true"] { box-shadow: 0 0 0 1.5px var(--ink); }
.crm-root .crm-prodrow .crm-pick-mark { position: static; flex: none; }

/* status chips */
.crm-root .crm-chip-p-active { background: color-mix(in srgb, var(--good, var(--ink)) 14%, var(--surface)); }
.crm-root .crm-chip-p-draft { background: var(--surface); box-shadow: inset 0 0 0 1px var(--tertiary); }
.crm-root .crm-chip-p-archived { background: var(--surface); color: var(--secondary); box-shadow: inset 0 0 0 1px var(--line); }
.crm-root .crm-pcard-state .crm-chip { box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* the list */
.crm-root .crm-prod-list { display: flex; flex-direction: column; gap: 2px; --cols: minmax(0, 2.6fr) minmax(0, 1fr) 96px 80px 72px 84px; }
.crm-root .crm-prodhead, .crm-root .crm-prodrow { display: grid; grid-template-columns: var(--cols); align-items: center; column-gap: 12px; padding: 0 12px; }
.crm-root .crm-prodhead { min-height: 28px; font-size: var(--t-foot); color: var(--secondary); }
.crm-root .crm-prodrow { min-height: var(--row-h); padding-block: 8px; border-radius: var(--row-r); color: inherit; text-decoration: none; transition: background-color var(--hover), transform .28s var(--m-release); }
.crm-root .crm-prodrow:active { transform: scale(var(--press)); }
@media (hover: hover) { .crm-root .crm-prodrow:hover { background: var(--wash); } }
.crm-root .crm-prodrow[aria-current="true"], .crm-root .crm-prodrow[aria-checked="true"] { background: var(--elevated); box-shadow: inset 0 0 0 1px var(--line); }
.crm-root .crm-pc { min-width: 0; display: flex; align-items: center; gap: 6px; font-size: var(--t-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-prodhead .crm-pc { font-size: inherit; }
.crm-root .crm-pc-main { gap: 12px; }
.crm-root .crm-pc-num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.crm-root .crm-prodrow .crm-pc[data-col="price"] { font-weight: 500; }
.crm-root .crm-pc .crm-chip { padding: 3px 8px; }
@container col (max-width: 860px) { .crm-root .crm-prod-list { --cols: minmax(0, 2fr) minmax(0, 1fr) 96px 72px; } .crm-root .crm-pc[data-col="stock"], .crm-root .crm-pc[data-col="sales"] { display: none; } }
@container col (max-width: 560px) { .crm-root .crm-prod-list { --cols: minmax(0, 1fr) max-content; } .crm-root .crm-prodhead, .crm-root .crm-pc[data-col="category"], .crm-root .crm-pc[data-col="status"] { display: none; } }

/* ---- the product: gallery, numbers, facts ------------------------------------------------------------- */
.crm-root .crm-gallery { display: flex; flex-direction: column; gap: 10px; border-radius: 20px; outline: none; }
.crm-root .crm-gallery:focus-visible { box-shadow: 0 0 0 2px var(--ink); }
.crm-root .crm-gallery-stage { position: relative; }
.crm-root .crm-gallery-main { display: block; width: 100%; aspect-ratio: 1; padding: 0; border-radius: 20px; overflow: hidden; background: var(--elevated); cursor: zoom-in; box-shadow: inset 0 0 0 var(--hair) var(--line); }
.crm-root .crm-gallery-main > .crm-media { width: 100%; height: 100%; }
.crm-root .crm-gallery-empty .crm-gallery-main { display: grid; place-items: center; cursor: default; aspect-ratio: auto; height: 120px; }
.crm-root .crm-gallery-step { position: absolute; top: 50%; margin-top: -18px; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow); opacity: 0; transition: opacity var(--hover); }
.crm-root .crm-gallery-step[data-dir="prev"] { left: 10px; } .crm-root .crm-gallery-step[data-dir="next"] { right: 10px; }
.crm-root .crm-gallery:hover .crm-gallery-step, .crm-root .crm-gallery:focus-within .crm-gallery-step, .crm-root:not([data-form="desk"]) .crm-gallery-step { opacity: 1; }
.crm-root .crm-gallery-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.crm-root .crm-gallery-thumb { flex: none; width: 56px; height: 56px; padding: 0; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 var(--hair) var(--line); opacity: .62; transition: opacity var(--hover), box-shadow var(--hover); }
.crm-root .crm-gallery-thumb > .crm-media { width: 100%; height: 100%; }
.crm-root .crm-gallery-thumb[aria-selected="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--ink); }
@media (hover: hover) { .crm-root .crm-gallery-thumb:hover { opacity: 1; } }
.crm-root .crm-prod-hero { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.crm-root .crm-prod-hero .crm-hero-name { font-size: var(--t-title2); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.crm-root .crm-prod-hero-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crm-root .crm-prod-price { font-size: var(--t-title3); font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-root .crm-prod-desc { padding: 0 4px; }
.crm-root .crm-mono { font-family: var(--mono); font-size: .92em; }
.crm-root .crm-prod-all { font-size: var(--t-foot); }

/* the full view */
.crm-root .crm-lightbox { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: color-mix(in srgb, var(--canvas) 92%, transparent); animation: crm-lightbox-in var(--enter) both; }
@keyframes crm-lightbox-in { from { opacity: 0; } }
.crm-root .crm-lightbox-picture { position: absolute; inset: 56px 64px; display: grid; }
.crm-root .crm-lightbox-picture > .crm-media { width: 100%; height: 100%; background: none; }
.crm-root[data-form="phone"] .crm-lightbox-picture { inset: 56px 0 64px; }
.crm-root .crm-lightbox-close { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); }
.crm-root .crm-lightbox-count { position: absolute; left: 50%; top: max(18px, env(safe-area-inset-top)); transform: translateX(-50%); font-size: var(--t-foot); color: var(--secondary); font-variant-numeric: tabular-nums; }
.crm-root .crm-lightbox-step { position: absolute; top: 50%; margin-top: -22px; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); }
.crm-root .crm-lightbox-step[data-dir="prev"] { left: 12px; } .crm-root .crm-lightbox-step[data-dir="next"] { right: 12px; }
.crm-root[data-form="phone"] .crm-lightbox-step { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); margin-top: 0; }
.crm-root[data-form="phone"] .crm-lightbox-step[data-dir="prev"] { left: calc(50% - 56px); } .crm-root[data-form="phone"] .crm-lightbox-step[data-dir="next"] { right: calc(50% - 56px); }

/* ---- wide sheets (the product form, the import) ------------------------------------------------------- */
.crm-root:not([data-form="phone"]) .crm-sheet-panel.crm-sheet-xl { width: min(720px, calc(100% - 32px)); }

/* the product form's images */
.crm-root .crm-image-editor { display: flex; flex-direction: column; gap: 8px; border-radius: 16px; }
.crm-root .crm-image-editor[data-drop="true"] { box-shadow: 0 0 0 2px var(--ink); }
.crm-root .crm-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.crm-root[data-form="phone"] .crm-image-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.crm-root .crm-image-tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; touch-action: none; cursor: grab; box-shadow: inset 0 0 0 var(--hair) var(--line); }
.crm-root .crm-image-tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.crm-root .crm-image-tile > .crm-media { width: 100%; height: 100%; }
.crm-root .crm-image-tile[data-dragging="true"] { z-index: 2; cursor: grabbing; box-shadow: var(--shadow-float); transition: none; }
.crm-root .crm-image-editor[data-dragging="true"] .crm-image-tile:not([data-dragging]) { transition: transform var(--layout); }
.crm-root .crm-image-tile:first-child { grid-column: span 2; grid-row: span 2; }
.crm-root .crm-image-cover { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: var(--t-cap2); font-weight: 600; }
.crm-root .crm-image-tools { position: absolute; right: 4px; top: 4px; display: flex; gap: 2px; opacity: 0; transition: opacity var(--hover); }
.crm-root .crm-image-tile:hover .crm-image-tools, .crm-root .crm-image-tile:focus-within .crm-image-tools, .crm-root:not([data-form="desk"]) .crm-image-tools, .crm-root .crm-image-tile[data-state="error"] .crm-image-tools { opacity: 1; }
.crm-root .crm-image-tools .pk-iconbtn { width: 28px; height: 28px; min-width: 28px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.crm-root .crm-image-tools .crm-icon { width: 15px; height: 15px; }
.crm-root .crm-image-state { position: absolute; inset: auto 0 0; display: flex; flex-direction: column; gap: 5px; padding: 8px; background: color-mix(in srgb, var(--surface) 92%, transparent); font-size: var(--t-cap); }
.crm-root .crm-image-state-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.crm-root .crm-image-failed { inset: 0; justify-content: center; align-items: center; text-align: center; color: var(--danger); }
.crm-root .crm-image-failed .crm-image-state-text { white-space: normal; }
.crm-root .crm-image-bar { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.crm-root .crm-image-bar > span { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s linear; }
.crm-root .crm-image-add { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 12px; color: var(--secondary); font-size: var(--t-cap);
  background: var(--canvas); box-shadow: inset 0 0 0 1px var(--tertiary); text-align: center; transition: background-color var(--hover), color var(--hover); }
.crm-root .crm-image-add .crm-icon { width: 22px; height: 22px; }
.crm-root .crm-image-add-wide { grid-column: 1 / -1; aspect-ratio: auto; min-height: 132px; font-size: var(--t-sub); }
@media (hover: hover) { .crm-root .crm-image-add:hover { background: var(--elevated); color: var(--ink); } }
.crm-root .crm-image-hint { margin: 0; }

/* the category field's suggestions */
.crm-root .crm-suggest { position: relative; display: flex; flex-direction: column; gap: 6px; }

/* ---- the import sheet ------------------------------------------------------------------------------------ */
/* the sheet keeps its head, steps and buttons in place; only the step's content scrolls */
.crm-root .pk-sheet:has(> .crm-import) { max-height: min(780px, calc(100% - 48px)); overflow: hidden; display: flex; flex-direction: column; }
.crm-root[data-form="phone"] .pk-sheet:has(> .crm-import) { max-height: calc(100% - 24px); }
.crm-root .crm-import { flex: 1; min-height: 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.crm-root:not([data-form="phone"]) .crm-import { min-height: min(460px, calc(100vh - 48px)); }
.crm-root .crm-import > .crm-import-stage { overflow-y: auto; overscroll-behavior: contain; margin: 0 -20px; padding: 2px 20px 8px; }
.crm-root .crm-import > .crm-error:not([hidden]) { flex: none; }
.crm-root .crm-import-steps { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.crm-root .crm-import-step { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 6px 0; font-size: var(--t-foot); color: var(--secondary); border-top: 2px solid var(--line); }
.crm-root .crm-import-step[data-state="now"] { color: var(--ink); font-weight: 600; border-top-color: var(--ink); }
.crm-root .crm-import-step[data-state="done"] { color: var(--ink); border-top-color: var(--ink); }
.crm-root .crm-import-dot { flex: none; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--elevated); font-size: var(--t-cap2); font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-root .crm-import-step[data-state="now"] .crm-import-dot, .crm-root .crm-import-step[data-state="done"] .crm-import-dot { background: var(--ink); color: var(--on-ink); }
.crm-root .crm-import-dot .crm-icon { width: 12px; height: 12px; }
.crm-root .crm-import-step-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root[data-form="phone"] .crm-import-step:not([data-state="now"]) .crm-import-step-name { display: none; }
.crm-root .crm-import-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.crm-root .crm-import-stage > * { flex: none; }
.crm-root .crm-import-h { font-size: var(--t-headline); font-weight: 600; }
.crm-root .crm-import-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.crm-root .crm-import-kind { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px 14px; border-radius: 16px; text-align: left; background: var(--canvas); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--hover), background-color var(--hover); }
.crm-root .crm-import-kind[aria-checked="true"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink); }
@media (hover: hover) { .crm-root .crm-import-kind:not([aria-checked="true"]):hover { background: var(--elevated); } }
.crm-root .crm-import-kind:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.crm-root .crm-import-kind-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--elevated); }
.crm-root .crm-import-kind[aria-checked="true"] .crm-import-kind-icon { background: var(--ink); color: var(--on-ink); }
.crm-root .crm-import-kind-icon .crm-icon { width: 22px; height: 22px; }
.crm-root .crm-import-kind-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.crm-root .crm-import-kind-name { font-size: var(--t-body); font-weight: 600; }
@container (max-width: 420px) { .crm-root .crm-import-kinds { grid-template-columns: minmax(0, 1fr); } .crm-root .crm-import-kind { min-height: 60px; } }
.crm-root .crm-import-template { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--elevated); }
.crm-root .crm-import-template-text { flex: 1 1 240px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.crm-root .crm-import-template-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.crm-root .crm-import-template-buttons .crm-btn { background: var(--surface); }
.crm-root .crm-import-foot { flex: none; display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: var(--rule); margin: 0 -20px; padding-inline: 20px; }
.crm-root .crm-import-gap { flex: 1; }
.crm-root .crm-import-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 220px; padding: 20px; border-radius: 20px; text-align: center; background: var(--canvas);
  box-shadow: inset 0 0 0 1.5px var(--tertiary); transition: background-color var(--hover), box-shadow var(--hover); }
.crm-root .crm-import-drop[data-drop="true"], .crm-root .crm-import-drop:focus-visible { background: var(--elevated); box-shadow: inset 0 0 0 2px var(--ink); outline: none; }
@media (hover: hover) { .crm-root .crm-import-drop:hover { background: var(--elevated); } }
.crm-root .crm-import-drop-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line); }
.crm-root .crm-import-drop-icon .crm-icon { width: 26px; height: 26px; }
.crm-root .crm-import-drop-title { font-size: var(--t-body); font-weight: 600; }
.crm-root .crm-import-status { min-height: 1.4em; text-align: center; }
/* columns */
.crm-root .crm-import-map { display: flex; flex-direction: column; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line); overflow: hidden; }
.crm-root .crm-import-map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.2fr); align-items: center; gap: 12px; min-height: 50px; padding: 5px 10px 5px 16px; }
.crm-root .crm-import-map-row + .crm-import-map-row { border-top: var(--rule); }
.crm-root .crm-import-map-head { min-height: 34px; font-size: var(--t-foot); color: var(--secondary); background: var(--canvas); }
.crm-root .crm-import-map-name { font-weight: 500; overflow-wrap: anywhere; }
.crm-root .crm-import-map-sample { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-import-map-row[data-ignored="true"] .crm-import-map-name { color: var(--secondary); text-decoration: line-through; text-decoration-color: var(--tertiary); }
.crm-root .crm-import-pick { width: 100%; }
@container (max-width: 520px) { .crm-root .crm-import-map-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } .crm-root .crm-import-map-sample { display: none; } }
/* counts */
.crm-root .crm-import-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.crm-root .crm-import-count { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 var(--hair) var(--line); }
.crm-root .crm-import-count-value { font-size: var(--t-title3); font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-root .crm-import-count-label { font-size: var(--t-foot); color: var(--secondary); }
.crm-root .crm-import-count[data-zero="true"] .crm-import-count-value { color: var(--tertiary); }
.crm-root .crm-import-count[data-action="error"][data-zero="false"] .crm-import-count-value { color: var(--danger); }
@container (max-width: 420px) { .crm-root .crm-import-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.crm-root .crm-import-options { display: flex; flex-direction: column; gap: 10px; }
.crm-root .crm-import-option { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.crm-root .crm-import-option-label { font-size: var(--t-body); }
/* the rows */
.crm-root .crm-import-table-wrap { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.crm-root .crm-import-table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.crm-root .crm-import-scroll { max-height: 360px; overflow: auto; border-radius: 14px; box-shadow: 0 0 0 var(--hair) var(--line); background: var(--surface); overscroll-behavior: contain; }
.crm-root .crm-import-scroll:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.crm-root .crm-import-table { display: table; min-width: 100%; border-collapse: collapse; font-size: var(--t-foot); }
.crm-root .crm-import-tr { display: table-row; }
.crm-root .crm-import-td { display: table-cell; padding: 7px 10px; vertical-align: top; border-top: var(--rule); max-width: 220px; }
.crm-root .crm-import-th .crm-import-td { position: sticky; top: 0; z-index: 1; border-top: 0; background: var(--canvas); color: var(--secondary); font-weight: 500; white-space: nowrap; }
.crm-root .crm-import-line { color: var(--secondary); font-variant-numeric: tabular-nums; text-align: right; width: 1%; }
.crm-root .crm-import-act { width: 1%; white-space: nowrap; }
.crm-root .crm-import-cell { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-root .crm-import-td[data-bad="true"] { background: color-mix(in srgb, var(--danger) 10%, transparent); box-shadow: inset 2px 0 0 var(--danger); }
.crm-root .crm-import-td[data-warn="true"] { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.crm-root .crm-import-why { display: block; margin-top: 2px; font-size: var(--t-cap2); color: var(--danger); white-space: normal; }
.crm-root .crm-import-td[data-warn="true"] .crm-import-why { color: var(--secondary); }
.crm-root .crm-chip-i-create { background: var(--elevated); }
.crm-root .crm-chip-i-merge { background: var(--surface); box-shadow: inset 0 0 0 1px var(--tertiary); }
.crm-root .crm-chip-i-skip { background: none; color: var(--secondary); box-shadow: inset 0 0 0 1px var(--line); }
.crm-root .crm-chip-i-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
/* working and done */
.crm-root .crm-import-working { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; text-align: center; }
.crm-root .crm-import-progress { width: min(320px, 80%); height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.crm-root .crm-import-progress > span { display: block; height: 100%; width: 35%; border-radius: 3px; background: var(--ink); animation: crm-import-run 1.2s var(--m-smooth) infinite; }
.crm-root .crm-import-progress[data-fraction="true"] > span { animation: none; transition: width .3s var(--m-smooth); }
@keyframes crm-import-run { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.crm-root .crm-import-done { display: flex; align-items: center; gap: 10px; }
.crm-root .crm-import-done-icon .crm-icon { width: 28px; height: 28px; }
.crm-root .crm-import-fix { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
@media (prefers-reduced-motion: reduce) {
  .crm-root .crm-media-img, .crm-root .crm-pcard, .crm-root .crm-prodrow, .crm-root .crm-image-bar > span { transition: none !important; }
  .crm-root .crm-media[data-state="loading"]::after, .crm-root .crm-prod-side, .crm-root .crm-lightbox, .crm-root .crm-import-progress > span { animation: none !important; }
}
/* phone: the import is an icon beside 新建产品, so the title keeps its room */
.crm-root[data-form="phone"] .crm-prod-import { width: 44px; min-width: 44px; padding: 0; justify-content: center; }
.crm-root[data-form="phone"] .crm-prod-import .crm-btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* the dashboard's product bars: a 20 pt cover before the name */
.crm-root .crm-hbar-label .crm-thumb-hbar .crm-icon { width: 11px; height: 11px; min-width: 0; min-height: 0; }
/* the product picker: a little air around each picture */
.crm-root .crm-combo-option:has(.crm-thumb-option) { min-height: 48px; padding-block: 6px; gap: 10px; }
