.product-management-v2 .product-management-list{width:100%;min-width:0}
.product-management-v2 .product-list-search{max-width:640px}
.product-list-search{flex-wrap:wrap}
.product-search-input{position:relative;flex:1;min-width:180px}
.product-search-input input{width:100%;box-sizing:border-box;padding-right:42px}
.product-list-search .product-search-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:36px;min-width:36px;min-height:36px;padding:0;border:0;background:transparent;color:var(--muted);font-size:24px;line-height:1}
.product-search-clear[hidden]{display:none}
.product-list-search [data-search-status]{flex-basis:100%;min-height:1em}
.product-category-controls{display:flex;flex-wrap:wrap;align-items:end;gap:8px 12px;margin:0 0 12px}
.product-category-controls label{display:grid;min-width:0;gap:4px;font-size:.875rem;color:var(--muted);flex:0 1 180px}
.product-category-controls label[hidden]{display:none}
.product-category-controls select{width:100%;min-height:40px;padding:6px 10px;border:1px solid var(--line);border-radius:var(--radius-button);color:var(--ink);background:var(--card)}
.product-table-scroll{width:100%;max-width:100%;overflow-x:auto;border:1px solid var(--line);border-radius:var(--radius-card)}
.product-management-table{width:100%;min-width:850px;border-collapse:collapse;table-layout:fixed;font-size:.875rem}
.product-management-table th,.product-management-table td{padding:8px;border-bottom:1px solid var(--line);text-align:left;vertical-align:middle}
.product-management-table th{white-space:nowrap;background:var(--color-page);color:var(--ink);font-weight:650}
.product-management-table tbody tr:last-child td{border-bottom:0}
.product-management-table tbody tr:hover{background:var(--color-page)}
.product-management-table .product-image-col{width:60px}
.product-management-table .product-title-col{width:22%}
.product-management-table .product-jan-col{width:124px}
.product-management-table .product-price-col{width:90px}
.product-management-table .product-stock-col,.product-management-table .product-status-col,.product-management-table .product-actions-col{width:78px}
.product-management-table .product-cell-text{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.product-management-table .product-number{font-variant-numeric:tabular-nums;white-space:nowrap}
.product-table-thumb{display:block;width:42px;height:48px;object-fit:contain;border-radius:6px;background:var(--color-page)}
.product-table-thumb.no-image{display:grid;place-items:center;color:var(--muted);font-size:.75rem}
.product-management-table [data-edit-product]{padding:6px 10px;white-space:nowrap}
.product-management-table .status{display:inline-block;white-space:nowrap}
.desktop #app.product-management-v2[aria-busy=true]::before{position:absolute;inset:0 18px auto auto;z-index:2;background:var(--card);border-radius:6px;pointer-events:none}
#app.product-management-v2{position:relative}
html.product-editor-open{overflow:hidden}
.admin-product-editor{padding:0;border:1px solid var(--line);border-radius:14px;width:min(920px,calc(100% - 32px));max-width:none;max-height:calc(100dvh - 32px);overflow:hidden;color:var(--ink);background:var(--card);box-shadow:0 18px 60px #2d241d40}
.admin-product-editor::backdrop{background:#2d241d72}
.product-editor-frame{display:grid;grid-template-rows:auto minmax(0,1fr) auto;max-height:calc(100dvh - 34px)}
.product-editor-header,.product-editor-footer{display:flex;align-items:center;gap:8px;padding:12px 18px;background:var(--card)}
.product-editor-header{justify-content:space-between;border-bottom:1px solid var(--line)}
.product-editor-header h2{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1.15rem}
.product-editor-header button,.product-editor-footer button{flex:none;white-space:nowrap}
.product-editor-body{padding:12px 18px 20px;overflow:auto;min-width:0;overscroll-behavior:contain}
.product-editor-body .field,.product-editor-body .field input,.product-editor-body .field select,.product-editor-body .field textarea{min-width:0}
.product-editor-body .product-category-controls{margin-top:8px}
.product-editor-footer{border-top:1px solid var(--line);justify-content:flex-end}
.product-editor-footer [data-editor-error]{margin-right:auto;font-size:.85rem;color:var(--red);overflow-wrap:anywhere;max-height:3lh;overflow:auto}
@media(max-width:680px){
  .admin-product-editor{width:calc(100% - 16px);max-height:calc(100dvh - 16px)}
  .product-editor-frame{max-height:calc(100dvh - 18px)}
  .product-editor-header,.product-editor-footer,.product-editor-body{padding:10px}
  .product-editor-footer{flex-wrap:wrap}
  .product-editor-footer [data-editor-error]:not(:empty){flex-basis:100%}
  .product-category-controls label{flex:1 1 135px}
}

.admin-sku-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem 1rem;
  margin-block: .5rem;
}
.admin-sku-inline .form-grid { display: contents; }
.admin-sku-inline label:has(> input),
.admin-sku-inline label:has(> select),
.admin-sku-inline .field {
  display: grid;
  grid-template-columns: minmax(7.5rem, auto) minmax(0, 1fr);
  align-items: center;
  gap: .5rem;
  margin: 0;
}
.admin-sku-inline input,
.admin-sku-inline select { width: 100%; min-width: 0; }
.admin-sku-inline .admin-sku-preview { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .admin-sku-inline { grid-template-columns: minmax(0, 1fr); }
}

.product-publish-block { color:#9b241e; }
.product-publish-warning { color:#765300; background:#fff4ce; border-radius:4px; padding:2px 5px; }

.admin-catalog-dialog{width:min(800px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:18px;border:1px solid var(--line);border-radius:12px;background:var(--card);color:var(--ink)}
.admin-catalog-dialog::backdrop{background:#251d19a6}
.admin-catalog-dialog header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.admin-catalog-dialog h2,.admin-catalog-dialog h3{margin:0 0 10px}
.admin-catalog-dialog table{width:100%;font-size:.875rem;border-collapse:collapse}
.admin-catalog-dialog td,.admin-catalog-dialog th{border-bottom:1px solid var(--line);padding:8px;text-align:left;overflow-wrap:anywhere}
.catalog-fields,.admin-action-dialog form{display:grid;gap:10px}
.catalog-fields label,.admin-action-dialog label{display:grid;gap:4px}
.admin-catalog-dialog .catalog-check{display:flex;align-items:center;gap:6px}
.catalog-check input{width:auto}
.admin-action-dialog{width:min(520px,calc(100% - 24px))}
.admin-action-dialog img{max-width:100%;height:min(200px,30dvh);object-fit:contain}
.admin-catalog-dialog [role="alert"]{color:#9a371e}
.catalog-danger-actions{margin-block:16px;padding-top:12px;border-top:1px solid var(--line)}

.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.admin-photo-grid article { padding: 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.admin-photo-thumbnail {
  display: block; width: 100%; padding: 0; overflow: hidden;
  aspect-ratio: 4 / 3; border: 0; border-radius: 6px; background: var(--color-page);
}
.admin-photo-thumbnail img { display: block; width: 100%; height: 100%; object-fit: contain; }
.admin-photo-caption { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.admin-photo-caption strong { color: var(--ink); font-size: .85rem; }
.admin-photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-photo-actions button { min-height: 38px; padding: 6px 9px; }
.admin-photo-file { position: relative; display: inline-flex; align-items: center; min-height: 42px; cursor: pointer; }
.admin-photo-file:focus-within { outline: 2px solid currentColor; outline-offset: 2px; }
.admin-photo-file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: inherit; }
.admin-photo-preview {
  width: min(700px, calc(100% - 20px)); max-width: none; max-height: calc(100dvh - 20px);
  padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--card);
}
.admin-photo-preview::backdrop { background: #24201d85; }
.admin-photo-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.admin-photo-dialog-heading h3 { margin: 0; }
.admin-photo-preview img { width: 100%; max-height: 64dvh; object-fit: contain; background: var(--color-page); }
[data-photo-notice]:empty, [data-photo-preview-status]:empty { display: none; }


.admin-category-tree-dialog{width:min(1080px,calc(100% - 24px))}
.admin-category-tree-dialog header{align-items:flex-start;flex-wrap:wrap}
.category-tree-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-block:16px}
.category-tree-toolbar input{flex:1;min-width:180px;max-width:440px}
.category-tree-branch{border:1px solid var(--line);border-radius:8px;margin-block:10px;overflow:hidden}
.category-tree-branch>summary{display:flex;align-items:center;gap:10px;list-style:none;padding:12px 14px;cursor:pointer;background:var(--card);position:relative}
.category-tree-label{overflow-wrap:anywhere;min-width:0}
.category-tree-branch>summary>.category-tree-label{flex:1;font-weight:600}
.category-tree-branch>summary::before{content:"▶";font-size:.75rem;flex-shrink:0}
.category-tree-branch[open]>summary::before{content:"▼"}
.category-tree-branch>summary::-webkit-details-marker{display:none}
.category-tree-actions{display:inline-flex;gap:8px;flex-wrap:wrap;align-items:center;flex-shrink:0}
.category-tree-branch>summary>.category-tree-actions{margin-left:auto}
.category-tree-actions button{min-height:34px;padding:6px 12px;white-space:nowrap;font-size:.875rem}
.category-tree-branch ul{list-style:none;margin:0 0 0 24px;padding:0 12px 0 16px;border-left:1px solid var(--line)}
.category-tree-row{display:flex;justify-content:space-between;gap:12px;align-items:center;min-height:52px;border-top:1px solid var(--line);padding:8px 2px}
.category-tree-empty{padding:14px 0}
.admin-category-tree-dialog mark{background:#ffedac;color:inherit;padding:1px 3px;border-radius:3px}
.admin-category-tree-dialog [data-feedback]:empty,.admin-category-tree-dialog [data-error]:empty{display:none}
@media(max-width:640px){
 .category-tree-branch>summary{flex-wrap:wrap}
 .category-tree-branch>summary>.category-tree-label{flex-basis:calc(100% - 24px)}
 .category-tree-branch>summary>.category-tree-actions{margin-left:20px}
 .category-tree-row{align-items:flex-start;flex-direction:column;gap:6px}
 .category-tree-branch ul{margin-left:12px;padding-left:10px;padding-right:8px}
 .category-tree-toolbar>.actions{width:100%}
}

.admin-product-editor [aria-invalid="true"],#sku-management [aria-invalid="true"]{border:2px solid #b42318;outline-color:#b42318}

#sku-management [data-jpy-tax][hidden]{display:none}

/* Keep metadata, prices and selects on the same field rhythm in the editor. */
.product-editor-body :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),select){
  width:100%;min-width:0;max-width:100%;height:44px;box-sizing:border-box;
  padding:10px 12px;border:1px solid var(--line);border-radius:var(--radius-button);
  background:var(--card);color:var(--ink);font:inherit;line-height:22px;
}
.product-editor-body #sku-add-form .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:16px;align-items:end}
.product-editor-body #sku-add-form .form-grid>.field,
.product-editor-body #sku-add-form .form-grid>label{
  display:grid;gap:6px;min-width:0;margin:10px 0;align-content:end;
  font-size:var(--text-caption);line-height:1.5;color:var(--muted);
}
.product-editor-body #sku-add-form .form-grid>.meta{grid-column:1/-1;margin:4px 0 0}
.product-editor-body .admin-sku-inline :is(.field,label:has(>input),label:has(>select)){
  grid-template-columns:minmax(0,1fr);align-items:stretch;gap:6px;
  font-size:var(--text-caption);line-height:1.5;color:var(--muted);
}
.product-editor-body #sku-add-form [data-jpy-tax][hidden]{display:none}
.product-editor-body [aria-invalid="true"]{border-color:#b42318}
@media(max-width:799px){
  .product-editor-body #sku-add-form .form-grid{grid-template-columns:minmax(0,1fr)}
}

.product-editor-body .sku-code-entry{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;min-width:0}
.product-editor-body .sku-code-entry button{height:44px;min-width:64px;padding:0 14px;white-space:nowrap}

/* Compact editor: four short fields per row, with a persistent footer. */
.admin-product-editor{width:min(1260px,calc(100% - 32px))}
.product-editor-body{padding-top:8px;padding-bottom:12px}
.product-editor-body h3{font-size:1rem;margin:10px 0 6px}
.product-editor-body h4{font-size:.9rem;margin:4px 0 6px}
.product-editor-body .field{gap:4px;margin:5px 0}
.product-editor-body #product-form>.form-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px 12px;align-items:end}
.product-editor-body .product-title-field,.product-editor-body .product-brand-field{grid-column:span 2}
.product-brand-row{display:flex;gap:6px;align-items:end;min-width:0}
.product-brand-row .admin-brand-picker{flex:1;min-width:0}
.product-brand-row>button{flex:none}
.product-brand-field [data-current-brand]{font-size:.75rem}
.product-category-field{grid-column:span 3;display:flex;align-items:end;gap:8px;min-width:0}
.product-category-field .product-category-controls{flex:1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0}
.product-category-field .product-category-controls label{font-size:.8rem}
.product-category-field>button{flex:none;margin-bottom:5px}
.product-editor-body [name=description]{min-height:38px;max-height:160px;resize:vertical;padding:7px 10px}
.product-editor-body #product-form .field:has([name=otcClass]) small{display:none}
.product-editor-body #product-form .field:has([name=otcClass]){align-self:end}
.product-editor-body :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),select){height:38px;padding:7px 10px;line-height:22px}
.product-editor-body button,.product-editor-body .admin-photo-file{font-size:.82rem;padding:6px 10px;min-height:34px}
.product-editor-body .sku-code-entry button{height:38px;min-width:58px}
.product-editor-body .sku-edit-grid,.product-editor-body #sku-add-form .form-grid{display:grid;grid-template-columns:minmax(0,1.3fr) repeat(3,minmax(0,1fr));gap:6px 12px;align-items:end}
.product-editor-body .sku-edit-grid :is(#sku-edit-fields,.admin-sku-inline,.form-grid){display:contents}
.product-editor-body :is(.sku-edit-grid,#sku-add-form) :is(.field,label:has(>input),label:has(>select)){display:grid;grid-template-columns:minmax(0,1fr);gap:4px;margin:0;font-size:.8rem;line-height:1.4;color:var(--muted);min-width:0;align-content:end}
.product-editor-body [data-sku-field=sku]{order:1}
.product-editor-body [data-sku-field=jan]{order:2}
.product-editor-body [data-sku-field=barcode]{order:3}
.product-editor-body [data-sku-field=internal_code]{order:4}
.product-editor-body [data-sku-field=name]{order:5}
.product-editor-body [data-sku-field=spec]{order:6}
.product-editor-body [data-sku-field=currency]{order:7}
.product-editor-body [data-sku-field=rate]{order:8}
.product-editor-body [data-sku-field=exclusive]{order:9}
.product-editor-body [data-sku-field=inclusive]{order:10}
.product-editor-body [data-sku-field=target]{order:11}
.product-editor-body .admin-sku-preview,.product-editor-body .sku-form-help,.product-editor-body [data-sku-operation-status]{grid-column:1/-1;order:20;margin:0;font-size:.75rem}
.product-editor-body [data-sku-operation-status]:empty,.product-editor-body [data-sku-add-error]:empty{display:none}
.product-editor-body .new-sku-stock{max-width:260px;margin:6px 0}
.product-editor-body .admin-sku-detail,.product-editor-body .admin-sku-add{padding:10px;margin-top:8px}
.product-editor-body .admin-sku-list{display:flex;gap:6px;overflow-x:auto;margin:8px 0}
.product-editor-body .admin-sku-choice{flex:0 0 200px;padding:7px;gap:2px}
.product-editor-body .product-publish-warning{font-size:.78rem;padding:3px 6px;margin:4px 0;overflow-wrap:anywhere}
.product-editor-body .notice{padding:6px 8px;font-size:.8rem;margin:4px 0}
.product-editor-body .actions{margin-top:6px;gap:6px}
.product-editor-body .product-image-size-guidance{font-size:.75rem;color:var(--muted);margin:2px 0 0}
.product-image-size-guidance summary{cursor:pointer}
.product-editor-footer{position:relative;z-index:2;min-height:60px;flex-wrap:wrap}
.product-editor-footer button{min-height:38px;padding:7px 14px}
.admin-photo-compact .admin-photo-grid{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0}
.admin-photo-compact .admin-photo-grid article{width:100px;padding:5px;position:relative}
.admin-photo-compact .admin-photo-thumbnail{width:88px;height:88px;aspect-ratio:auto}
.admin-photo-compact .admin-photo-caption{font-size:.72rem;gap:4px;margin:3px 0}
.admin-photo-compact .admin-photo-scope{margin:3px 0;font-size:.75rem}
.admin-photo-menu summary{cursor:pointer;font-size:.75rem;color:var(--red)}
.admin-photo-menu[open] .admin-photo-actions{position:absolute;z-index:3;left:0;top:100%;min-width:220px;padding:8px;border:1px solid var(--line);border-radius:8px;background:var(--card);box-shadow:0 4px 16px #0002}
.admin-photo-compact .admin-photo-actions button{min-height:34px}
@media(max-width:950px){
 .product-editor-body #product-form>.form-grid,.product-editor-body .sku-edit-grid,.product-editor-body #sku-add-form .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .product-category-field{grid-column:1/-1}
}
@media(max-width:540px){
 .admin-product-editor{width:calc(100% - 12px)}
 .product-editor-body #product-form>.form-grid,.product-editor-body .sku-edit-grid,.product-editor-body #sku-add-form .form-grid{grid-template-columns:minmax(0,1fr)}
 .product-editor-body :is(.product-title-field,.product-brand-field,.product-category-field){grid-column:1/-1}
 .product-category-field{align-items:stretch;flex-direction:column}
 .product-category-field .product-category-controls{grid-template-columns:repeat(2,minmax(0,1fr))}
 .product-category-field>button{align-self:start}
 .product-editor-body .admin-sku-choice{flex-basis:170px}
 .admin-photo-menu[open] .admin-photo-actions{min-width:180px}
}
.product-editor-body #sku-add-form{display:grid;grid-template-columns:minmax(0,1.3fr) repeat(3,minmax(0,1fr));gap:6px 12px;align-items:end}
.product-editor-body #sku-add-form .form-grid,.product-editor-body #sku-add-form .new-sku-stock{display:contents}
.product-editor-body #sku-add-form>p,.product-editor-body #sku-add-form>[data-new-sku-photos]{grid-column:1/-1;order:20;margin:0}
.product-editor-body #sku-add-form>[data-sku-add-submit]{order:30;justify-self:start}
@media(max-width:950px){.product-editor-body #sku-add-form{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:540px){.product-editor-body #sku-add-form{grid-template-columns:minmax(0,1fr)}}
.product-editor-body [data-product-version]{margin:0;font-size:.72rem}
.product-editor-body .editor-secondary-actions{font-size:.8rem;margin:6px 0}
.product-editor-body .editor-secondary-actions summary{cursor:pointer}
.product-editor-body .admin-photo-compact{display:grid;grid-template-columns:auto auto minmax(0,1fr);gap:4px 10px;align-items:center;min-width:0}
.product-editor-body .admin-photo-compact .admin-photo-scope{grid-column:1/-1}
.product-editor-body .admin-photo-compact .admin-photo-grid{margin:0;max-width:100%;grid-column:1}
.product-editor-body .admin-photo-compact>.actions{margin:0;grid-column:2;max-width:180px}
.product-editor-body .admin-photo-compact>[data-photo-review]{grid-column:3;min-width:0}
.product-editor-body .admin-photo-compact>[data-photo-notice]{grid-column:1/-1;margin:0}
.product-editor-body .admin-photo-compact:has(article:nth-child(n+3)){grid-template-columns:minmax(0,1fr) auto}
.product-editor-body .admin-photo-compact:has(article:nth-child(n+3))>[data-photo-review]{grid-column:1/-1}
@media(max-width:700px){
 .product-editor-body .admin-photo-compact{grid-template-columns:minmax(0,1fr) auto}
 .product-editor-body .admin-photo-compact>[data-photo-review]{grid-column:1/-1}
}
.product-editor-frame{grid-template-columns:minmax(0,1fr);width:100%;min-width:0}
.product-editor-header,.product-editor-footer{min-width:0}
.admin-photo-menu[open] .admin-photo-actions{position:static;min-width:0;padding:4px 0;border:0;box-shadow:none}
.admin-photo-menu[open] .admin-photo-actions button{width:100%;font-size:.75rem;padding:4px}
@media(max-width:540px){
 .product-editor-body .admin-sku-list{flex-wrap:wrap;overflow:visible}
 .product-editor-body .admin-sku-choice{flex:1 1 145px}
}

.admin-save-feedback{width:min(440px,calc(100% - 24px));padding:20px}
.admin-save-feedback .save-feedback-heading{display:flex;align-items:center;gap:10px}
.admin-save-feedback h2{margin:0;font-size:1.15rem}
.admin-save-feedback .save-feedback-icon{display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:50%;font-size:22px;font-weight:700}
.admin-save-feedback.is-success .save-feedback-icon{color:var(--green);background:var(--color-successSoft)}
.admin-save-feedback.is-failure .save-feedback-icon{color:var(--red);background:var(--red-soft)}
.admin-save-feedback [data-save-message]{white-space:pre-wrap;overflow-wrap:anywhere;max-height:45dvh;overflow:auto;line-height:1.6}
.admin-save-feedback .actions{justify-content:flex-end}
@media(max-width:540px){.admin-save-feedback{padding:16px}.admin-save-feedback .actions button{flex:1}}
