
:root{
  color-scheme:light dark;
  --bg:#f4f4f5; --panel:#fff; --text:#171717; --muted:#6b7280; --border:#dedede;
  --accent:#b91c1c; --accentText:#fff; --chip:#f3f4f6;
}
@media (prefers-color-scheme:dark){
  :root{--bg:#0f0f10;--panel:#19191b;--text:#f4f4f5;--muted:#a1a1aa;--border:#343437;--chip:#242427;}
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
button,input{font:inherit}
button{touch-action:manipulation}
.topbar{position:sticky;top:0;z-index:5;display:flex;justify-content:space-between;align-items:center;padding:calc(12px + env(safe-area-inset-top)) 16px 12px;background:color-mix(in srgb,var(--panel) 94%,transparent);backdrop-filter:blur(14px);border-bottom:1px solid var(--border)}
.eyebrow{text-transform:uppercase;letter-spacing:.12em;font-size:11px;color:var(--muted)}
h1{font-size:22px;margin:2px 0 0}
.secondary,.filter,.qty{border:1px solid var(--border);background:var(--panel);color:var(--text);border-radius:12px;padding:10px 12px}
.secondary:active,.filter:active,.qty:active{transform:scale(.98)}
main{max-width:1200px;margin:0 auto;padding:14px 14px 80px}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:12px}
.stat{background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:12px}
.stat span{display:block;font-size:22px;font-weight:700}
.stat small{color:var(--muted)}
.controls{background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:12px}
.search span{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.search input{width:100%;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:12px;font-size:16px}
.filters{display:flex;gap:7px;overflow:auto;padding-top:10px;-webkit-overflow-scrolling:touch}
.filter{white-space:nowrap}
.filter.active{background:var(--accent);border-color:var(--accent);color:var(--accentText)}
.countline{color:var(--muted);font-size:13px;padding:12px 2px 8px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:12px}
.pokemon-card{overflow:hidden;background:var(--panel);border:1px solid var(--border);border-radius:18px}
.photo-wrap{position:relative;aspect-ratio:4/3;background:var(--chip);display:flex;align-items:center;justify-content:center;overflow:hidden}
.photo{display:none;width:100%;height:100%;object-fit:cover}
.photo.has-photo{display:block}
.photo-placeholder{color:var(--muted)}
.photo-action{position:absolute;left:10px;right:10px;bottom:10px;background:color-mix(in srgb,var(--panel) 92%,transparent);border:1px solid var(--border);padding:10px;border-radius:12px;text-align:center;font-size:13px;font-weight:600;backdrop-filter:blur(8px)}
.photo-action input{position:absolute;opacity:0;width:1px;height:1px}
.card-body{padding:14px}
.number{font-size:12px;color:var(--muted);font-weight:700}
.name{font-size:22px;margin:2px 0 6px}
.meta{display:flex;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:12px}
.meta span{background:var(--chip);padding:5px 8px;border-radius:999px}
.designed-row{display:flex;align-items:center;gap:9px;margin:14px 0;font-weight:600}
.designed{width:24px;height:24px;accent-color:var(--accent)}
.inventory{border-top:1px solid var(--border);padding-top:12px}
.inventory-label{font-size:12px;color:var(--muted);margin-bottom:7px}
.qty-row{display:grid;grid-template-columns:48px 48px 1fr 48px 48px;gap:6px}
.qty{padding:11px 4px;font-weight:700}
.onhand{min-width:0;width:100%;text-align:center;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;font-weight:700;font-size:18px}
@media(max-width:640px){
  .stats{grid-template-columns:repeat(2,1fr)}
  .grid{grid-template-columns:1fr}
}
.header-actions{display:flex;gap:8px;align-items:center}.primary{border:1px solid var(--accent);background:var(--accent);color:var(--accentText);border-radius:12px;padding:10px 12px;font-weight:700}.primary:active{transform:scale(.98)}
.dialog{border:0;padding:0;background:transparent;color:var(--text);width:min(92vw,680px)}.dialog::backdrop{background:rgba(0,0,0,.58);backdrop-filter:blur(3px)}.dialog-card{background:var(--panel);border:1px solid var(--border);border-radius:20px;padding:18px}.dialog-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:14px}.dialog-head h2{margin:2px 0 0}.icon-button{border:1px solid var(--border);background:var(--panel);color:var(--text);border-radius:999px;width:40px;height:40px;font-size:24px;line-height:1}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.form-grid label>span{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}.form-grid input,.form-grid select{width:100%;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:12px;font-size:16px}.form-grid .wide{grid-column:1/-1}.sku-builder{display:grid;grid-template-columns:1fr auto;gap:8px}.form-grid small{display:block;color:var(--muted);margin-top:6px}.form-designed{align-self:end;margin:0;padding:10px 0}.form-error{min-height:20px;color:#b91c1c;font-size:13px;margin-top:8px}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}
@media(max-width:640px){.header-actions{flex-direction:column;gap:5px;align-items:stretch}.header-actions button{padding:8px 10px}.form-grid{grid-template-columns:1fr}.form-grid .wide{grid-column:auto}.dialog-card{padding:14px}.sku-builder{grid-template-columns:1fr}.dialog-actions{display:grid;grid-template-columns:1fr 1fr}}

textarea{width:100%;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:12px;font-size:16px;resize:vertical}
.commerce{border-top:1px solid var(--border);margin-top:12px;padding-top:10px;display:grid;grid-template-columns:1fr 110px;gap:10px;align-items:end}
.store-row{margin:0}
.price-field span{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.price{width:100%;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:10px}
@media(max-width:420px){.commerce{grid-template-columns:1fr}}

.category-filter{display:grid;grid-template-columns:auto minmax(180px,320px);gap:10px;align-items:center;margin-top:10px}
.category-filter span{font-size:12px;color:var(--muted)}
.category-filter select,.channel-fieldset select{border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:10px}
.channel-fieldset{border:1px solid var(--border);border-radius:14px;padding:10px 12px;margin:0}
.channel-fieldset legend{font-size:12px;color:var(--muted);padding:0 5px}
.channel-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px}
.channel-summary{min-width:0}
.channel-label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.channel-badges{display:flex;flex-wrap:wrap;gap:5px}
.channel-badge{display:inline-block;background:var(--chip);border:1px solid var(--border);border-radius:999px;padding:4px 7px;font-size:11px}
@media(max-width:520px){.category-filter{grid-template-columns:1fr}.channel-grid{grid-template-columns:1fr 1fr}}

.load-more-wrap{grid-column:1/-1;display:flex;justify-content:center;padding:8px 0 18px}
.load-more{min-width:180px}
.photo{content-visibility:auto}
.pokemon-card{contain:layout paint style}

.channel-chip{
  appearance:none;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--muted);
  border-radius:999px;
  padding:5px 8px;
  font-size:11px;
  cursor:pointer;
}
.channel-chip.enabled{
  background:var(--accent);
  border-color:var(--accent);
  color:var(--accentText);
}
.channel-chip:disabled{opacity:.55;cursor:wait}
.edit-product{width:100%;margin-top:12px}

/* v5.4 mobile-first reliability and touch improvements */
html{-webkit-text-size-adjust:100%}
body{overscroll-behavior-y:none}
button,input,select,textarea{font-size:16px}
.topbar{gap:8px}
.topbar .actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.live-status{position:sticky;top:74px;z-index:4;background:var(--bg);padding:8px}
.empty-state{grid-column:1/-1;text-align:center;color:var(--muted);padding:30px 10px}
.photo{background:var(--chip)}
.photo-wrap{content-visibility:auto;contain-intrinsic-size:250px 188px}
.pokemon-card{content-visibility:auto;contain-intrinsic-size:360px 620px}
@media(max-width:640px){
  main{padding-left:10px;padding-right:10px}
  .topbar{padding-left:12px;padding-right:12px;align-items:flex-start}
  .topbar h1{font-size:20px}
  .secondary,.primary,.filter,.qty{min-height:44px}
  .stats{gap:6px}
  .stat{padding:10px}
  .stat span{font-size:20px}
  .controls{padding:10px}
  .filters{scrollbar-width:none}
  .filters::-webkit-scrollbar{display:none}
  .pokemon-card{border-radius:16px}
  .card-body{padding:12px}
  .qty-row{grid-template-columns:44px 44px 1fr 44px 44px;gap:5px}
  .channel-chip{min-height:36px;padding:7px 10px}
  .add-dialog{width:calc(100% - 18px);max-height:90dvh;padding:14px}
  .form-grid{grid-template-columns:1fr}
  .form-grid .wide{grid-column:1}
  .dialog-actions{position:sticky;bottom:0;background:var(--panel);padding-top:10px}
}

/* v5.5 iOS checkbox / edit-dialog alignment fix */
.add-dialog .designed-row,
.add-dialog .form-designed,
.add-dialog .channel-fieldset .designed-row{
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  width:auto;
  max-width:100%;
  margin:0;
  font-weight:600;
}

.add-dialog .designed-row input[type="checkbox"],
.add-dialog .form-designed input[type="checkbox"],
.add-dialog .channel-fieldset input[type="checkbox"]{
  flex:0 0 auto;
  width:22px;
  height:22px;
  margin:0;
}

.add-dialog .designed-row span,
.add-dialog .form-designed span,
.add-dialog .channel-fieldset .designed-row span{
  flex:0 1 auto;
  min-width:0;
  width:auto;
  margin:0;
  text-align:left;
  white-space:normal;
}

.add-dialog .channel-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px 14px;
  align-items:start;
}

.add-dialog .channel-grid > label{
  justify-self:start;
}

@media(max-width:640px){
  .add-dialog .channel-grid{
    grid-template-columns:1fr;
    gap:10px;
  }

  .add-dialog .designed-row,
  .add-dialog .form-designed,
  .add-dialog .channel-fieldset .designed-row{
    display:flex;
    width:100%;
    justify-content:flex-start;
  }

  .add-dialog .designed-row span,
  .add-dialog .form-designed span,
  .add-dialog .channel-fieldset .designed-row span{
    flex:0 1 auto;
  }
}

.square-panel{margin-top:12px}
.square-panel-head{display:flex;justify-content:space-between;gap:12px;align-items:center}
.square-panel h2{margin:2px 0 0;font-size:18px}
.square-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.square-location-select{display:grid;grid-template-columns:auto minmax(180px,360px);gap:10px;align-items:center;margin-top:10px}
.square-location-select span{font-size:12px;color:var(--muted)}
.square-location-select select{border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:10px}
.card-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.card-actions .edit-product{margin-top:0}
@media(max-width:520px){
  .square-location-select{grid-template-columns:1fr}
  .card-actions{grid-template-columns:1fr}
}

.square-sync-state{display:flex;justify-content:space-between;gap:8px;align-items:center;margin-top:10px}
.sync-status-badge{border:1px solid var(--border);border-radius:999px;padding:4px 8px;font-size:11px;background:var(--chip)}
.sync-status-badge[data-state="synced"]{background:var(--accent);color:var(--accentText);border-color:var(--accent)}
.sync-status-badge[data-state="needs-update"]{font-weight:700}
.sync-status-badge[data-state="error"]{font-weight:700}
.sync-last{font-size:11px;color:var(--muted);text-align:right}

.bulk-sync-dialog{width:min(1180px,96vw);max-width:none;height:min(86vh,900px);padding:0;border:1px solid var(--border);border-radius:18px;background:var(--bg);color:var(--text)}
.bulk-sync-dialog::backdrop{background:rgba(0,0,0,.55)}
.bulk-sync-shell{padding:18px;height:100%;display:flex;flex-direction:column;box-sizing:border-box}
.bulk-sync-header{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.bulk-sync-header h2{margin:3px 0 4px}
.bulk-toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:end;margin:14px 0}
.bulk-limit{display:grid;gap:4px;font-size:12px;color:var(--muted)}
.bulk-limit select{padding:9px;border-radius:10px;border:1px solid var(--border);background:var(--bg);color:var(--text)}
.bulk-progress-wrap{margin-bottom:12px}
.bulk-progress-wrap progress{width:100%;height:14px}
.bulk-table-wrap{overflow:auto;flex:1;border:1px solid var(--border);border-radius:14px}
.bulk-table{width:100%;border-collapse:collapse;font-size:13px}
.bulk-table th,.bulk-table td{padding:9px;border-bottom:1px solid var(--border);text-align:left;vertical-align:middle;white-space:nowrap}
.bulk-table th{position:sticky;top:0;background:var(--bg);z-index:2}
.bulk-product{display:flex;align-items:center;gap:8px;min-width:190px}
.bulk-thumb{width:42px;height:42px;border-radius:9px;object-fit:cover;border:1px solid var(--border)}
.bulk-thumb-empty{display:grid;place-items:center;color:var(--muted)}
.bulk-row-warning{opacity:.72}
.bulk-ready{font-weight:700}
.bulk-issue{font-weight:700}
@media(max-width:640px){
  .bulk-sync-dialog{width:100vw;height:100dvh;border-radius:0;border:0}
  .bulk-sync-shell{padding:12px}
  .bulk-toolbar{display:grid;grid-template-columns:1fr 1fr}
  .bulk-toolbar .primary{grid-column:1/-1}
}

.ops-panel{margin-top:12px}
.ops-head{display:flex;justify-content:space-between;align-items:center}
.ops-head h2{margin:2px 0 0;font-size:18px}
.ops-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.ops-dialog{width:min(700px,94vw);max-width:none;border:1px solid var(--border);border-radius:18px;background:var(--bg);color:var(--text);padding:0}
.wide-ops-dialog{width:min(1100px,96vw);height:min(82vh,850px)}
.ops-dialog::backdrop{background:rgba(0,0,0,.55)}
.ops-dialog-shell{padding:16px}
.ops-help{color:var(--muted);font-size:13px}
.scan-form{display:grid;grid-template-columns:1fr auto;gap:8px}
.scan-form input,.txn-toolbar input,.reconcile-card input{border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:11px}
.scan-result-card{display:grid;grid-template-columns:72px 1fr auto;gap:12px;align-items:center;margin-top:14px;padding:12px;border:1px solid var(--border);border-radius:14px}
.scan-result-card img{width:72px;height:72px;object-fit:cover;border-radius:12px}
.scan-stock{margin-top:5px}
.scan-quick-actions{display:flex;gap:6px;flex-wrap:wrap}
.ops-error{margin-top:12px;padding:10px;border:1px solid var(--border);border-radius:12px;font-weight:700}
.ops-success{margin-top:12px;padding:12px;border:1px solid var(--border);border-radius:12px;font-weight:700}
.label-preview{display:grid;place-items:center;padding:20px}
.print-label-sheet{width:2.25in;min-height:1.15in;padding:7px;background:white;color:black;text-align:center;box-sizing:border-box;border:1px solid #bbb}
.print-label-name{font-size:14px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.barcode-svg{display:block;width:100%;height:58px;margin:4px auto}
.print-label-sku{font-family:monospace;font-size:12px}
.print-label-price{font-size:14px;font-weight:800;margin-top:2px}
.card-actions-three{grid-template-columns:1fr 1fr 1fr}
.txn-toolbar{display:flex;gap:8px;margin:10px 0}
.txn-toolbar input{flex:1}
.ops-table-wrap{overflow:auto;max-height:calc(82vh - 150px);border:1px solid var(--border);border-radius:14px}
.ops-table{width:100%;border-collapse:collapse;font-size:12px}
.ops-table th,.ops-table td{padding:8px;border-bottom:1px solid var(--border);text-align:left;white-space:nowrap}
.ops-table th{position:sticky;top:0;background:var(--bg);z-index:2}
.txn-positive{font-weight:800}
.txn-negative{font-weight:800}
.reconcile-card{margin-top:14px;padding:12px;border:1px solid var(--border);border-radius:14px;display:grid;gap:10px}
.reconcile-card label{display:grid;gap:5px}
@media(max-width:640px){
  .ops-actions{display:grid;grid-template-columns:1fr}
  .scan-form{grid-template-columns:1fr}
  .scan-result-card{grid-template-columns:56px 1fr}
  .scan-result-card img{width:56px;height:56px}
  .scan-quick-actions{grid-column:1/-1}
  .card-actions-three{grid-template-columns:1fr}
  .wide-ops-dialog{width:100vw;height:100dvh;border-radius:0;border:0}
}

.camera-actions{margin:8px 0}
.camera-panel{display:grid;gap:8px;margin:10px 0;padding:10px;border:1px solid var(--border);border-radius:14px}
.camera-panel[hidden]{display:none}
.camera-panel video{width:100%;max-height:360px;background:#111;border-radius:12px;object-fit:cover}
.qr-svg{display:block;width:92px;height:92px;background:white}
.dual-code-row{display:grid;grid-template-columns:92px 1fr;gap:8px;align-items:center;margin:4px 0}
.location-toolbar{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}
.location-toolbar input{flex:1;min-width:180px;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:12px;padding:10px}
.location-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:9px;overflow:auto;max-height:65vh}
.location-card{display:grid;text-align:left;gap:4px;padding:12px;border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:14px}
.location-card small{color:var(--muted)}
.location-form{display:grid;gap:10px}
.location-form label{display:grid;gap:5px;font-size:12px;color:var(--muted)}
.location-form input,.location-form select,.location-form textarea{border:1px solid var(--border);background:var(--bg);color:var(--text);border-radius:11px;padding:10px}
.location-view-meta{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.location-view-meta span{padding:6px 8px;border:1px solid var(--border);border-radius:999px;font-size:12px}
.location-view-actions{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.scan-locations{font-size:11px;color:var(--muted);margin-top:4px}
.location-label-sheet{width:2.5in}
@media(max-width:640px){
 .dual-code-row{grid-template-columns:84px 1fr}.qr-svg{width:84px;height:84px}
 .location-toolbar{display:grid;grid-template-columns:1fr 1fr}.location-toolbar input{grid-column:1/-1}
}

.photo-opt-status{
  min-height:14px;
  margin-top:5px;
  padding:0 4px;
  font-size:10px;
  line-height:1.25;
  color:var(--muted);
  text-align:center;
}
.photo-input:disabled + span{opacity:.6}


/* v6.1.2 — compact price + sales-channel layout */
.product-card .price-channels-row,
.product-card .sales-price-row,
.product-card .commerce-row{
  align-items:start;
  gap:10px;
}

.product-card .sales-channels,
.product-card .channel-list,
.product-card .sales-channel-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
  align-content:start;
}

.product-card .sales-channels label,
.product-card .channel-list label,
.product-card .sales-channel-list label,
.product-card .sales-channels .pill,
.product-card .channel-list .pill,
.product-card .sales-channel-list .pill{
  min-width:0;
  width:100%;
  justify-content:center;
}

.product-card .price-field,
.product-card .price-wrap,
.product-card .price-block{
  align-self:end;
}

@media (max-width:640px){
  .product-card .price-channels-row,
  .product-card .sales-price-row,
  .product-card .commerce-row{
    display:grid;
    grid-template-columns:minmax(118px,0.9fr) minmax(0,1.25fr);
    column-gap:10px;
    row-gap:6px;
  }

  .product-card .sales-channels,
  .product-card .channel-list,
  .product-card .sales-channel-list{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:5px;
  }

  .product-card .price-field input,
  .product-card .price-wrap input,
  .product-card .price-block input{
    width:100%;
    max-width:none;
  }
}


/* v6.1.3 — exact product commerce layout fix */
.card .commerce,
.product-card .commerce{
  display:grid;
  grid-template-columns:minmax(110px,0.82fr) minmax(150px,1.18fr);
  gap:10px;
  align-items:end;
}

.card .channel-summary,
.product-card .channel-summary{
  min-width:0;
  align-self:start;
}

.card .channel-badges,
.product-card .channel-badges{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:5px;
  width:100%;
}

.card .channel-chip,
.product-card .channel-chip{
  width:100%;
  min-width:0;
  justify-content:center;
  text-align:center;
  white-space:nowrap;
  padding-left:7px;
  padding-right:7px;
  box-sizing:border-box;
}

.card .price-field,
.product-card .price-field{
  align-self:end;
  min-width:0;
}

.card .price,
.product-card .price{
  width:100%;
  box-sizing:border-box;
}

/* Override the old <=420px rule that forced commerce into one column. */
@media(max-width:420px){
  .card .commerce,
  .product-card .commerce{
    grid-template-columns:minmax(108px,0.86fr) minmax(145px,1.14fr);
    gap:8px;
  }

  .card .channel-badges,
  .product-card .channel-badges{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:4px;
  }

  .card .channel-chip,
  .product-card .channel-chip{
    font-size:11px;
    padding:5px 5px;
  }
}

/* Keep the bottom actions compact but still touch-friendly. */
@media(max-width:640px){
  .card-actions-three{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:7px;
  }
  .card-actions-three button{
    min-width:0;
    padding-left:7px;
    padding-right:7px;
  }
}


/* v6.1.4 — Price first, horizontal sales channels below */
.card .commerce,
.product-card .commerce{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  align-items:start;
}

.card .price-field,
.product-card .price-field{
  width:100%;
  order:1;
}

.card .price,
.product-card .price{
  width:100%;
  max-width:none;
  box-sizing:border-box;
}

.card .channel-summary,
.product-card .channel-summary{
  width:100%;
  order:2;
}

.card .channel-summary > label,
.product-card .channel-summary > label{
  display:block;
  margin-bottom:6px;
}

.card .channel-badges,
.product-card .channel-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  width:100%;
}

.card .channel-chip,
.product-card .channel-chip{
  width:auto;
  min-width:0;
  flex:0 0 auto;
  justify-content:center;
  white-space:nowrap;
  padding:6px 10px;
}

/* Let the five channels naturally form roughly 3 + 2 on phone widths. */
@media(max-width:640px){
  .card .commerce,
  .product-card .commerce{
    grid-template-columns:1fr;
    gap:7px;
  }

  .card .channel-badges,
  .product-card .channel-badges{
    display:flex;
    flex-wrap:wrap;
    gap:5px;
  }

  .card .channel-chip,
  .product-card .channel-chip{
    font-size:11px;
    padding:5px 9px;
  }
}

/* Compact actions after shortening commerce. */
.card-actions-three{
  gap:7px;
}


/* v6.2 TCG foundation */
.tcg-fieldset{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
}
.tcg-fieldset[hidden]{display:none!important}
.tcg-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.tcg-grid label{display:grid;gap:5px}
.external-id-details{margin-top:10px}
.external-id-details summary{cursor:pointer;font-weight:700}
.tcg-market-readout{margin-top:10px;color:var(--muted);font-size:12px}
.tcg-meta{border:1px solid var(--border);border-radius:999px;padding:4px 8px;font-size:11px}
.pokemon-card.tcg-single .photo-wrap{
  background:#171719;
}
.pokemon-card.tcg-single .photo{
  object-fit:contain!important;
  object-position:center;
  background:#171719;
}
.pokemon-card.tcg-single .photo.has-photo{
  object-fit:contain!important;
}
@media(max-width:640px){
  .tcg-grid{grid-template-columns:1fr}
}

/* v6.3.0 Singles Scanner */
.scanner-dialog{width:min(1080px,96vw);max-width:none}
.scanner-grid{display:grid;grid-template-columns:minmax(260px,.85fr) minmax(300px,1.15fr);gap:16px}
.scanner-capture-panel,.scanner-identify-panel,.scanner-match-panel{border:1px solid var(--border);border-radius:16px;padding:12px}
.scanner-preview-shell{min-height:360px;display:grid;place-items:center;background:#111;border-radius:14px;overflow:hidden}
.scanner-preview{width:100%;max-height:520px;object-fit:contain}
.scanner-preview-placeholder{color:var(--muted);padding:30px;text-align:center}
.scanner-capture-actions{display:flex;gap:8px;margin-top:10px}
.scanner-file-button{display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.scanner-file-button input{display:none}
.scanner-lookup-form{display:grid;gap:10px;margin-top:8px}
.scanner-two-col{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.scanner-match-panel{margin-top:16px}
.scanner-match-card{display:grid;grid-template-columns:minmax(180px,280px) 1fr;gap:16px}
.scanner-match-image{width:100%;max-height:430px;object-fit:contain;background:#111;border-radius:14px}
.scanner-match-details{display:grid;gap:10px;align-content:start}
.scanner-match-details h3{margin:0;font-size:22px}
.scanner-match-printing{font-weight:700}
.scanner-id-grid{display:grid;gap:5px;font-size:11px}
.scanner-id-grid div{display:grid;grid-template-columns:90px 1fr;gap:8px}
.scanner-id-grid span{color:var(--muted)}
.scanner-id-grid code{overflow-wrap:anywhere}
.scanner-variant-grid{margin-top:4px}
.scanner-result-actions{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
@media(max-width:700px){
  .scanner-dialog{width:100vw;height:100dvh;border:0;border-radius:0}
  .scanner-grid{grid-template-columns:1fr}
  .scanner-preview-shell{min-height:300px}
  .scanner-match-card{grid-template-columns:1fr}
  .scanner-match-image{max-height:520px}
  .scanner-two-col{grid-template-columns:1fr 1fr}
}

/* v6.3.1 OCR feedback */
#scannerOcrStatus{
  min-height:18px;
  font-weight:600;
}
#scannerOcrRetryBtn{
  margin-top:6px;
  width:100%;
}

/* v6.3.3 OCR tuning */
.scanner-preview-placeholder::after{
  content:"For best recognition, center the card and fill most of the photo.";
  display:block;
  margin-top:8px;
  font-size:11px;
  color:var(--muted);
}

/* v6.3.5 duplicate/variant resolution */
.scanner-existing-panel{
  margin-top:12px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--bg);
}
.scanner-existing-summary{
  display:flex;
  flex-wrap:wrap;
  gap:8px 12px;
  align-items:center;
  margin-top:5px;
}
.scanner-existing-summary strong{font-size:15px}
.scanner-existing-summary span{
  padding:5px 8px;
  border:1px solid var(--border);
  border-radius:999px;
  font-size:11px;
}
.scanner-existing-locations{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
  color:var(--muted);
  font-size:11px;
}

/* v6.3.6 intake batches */
.scanner-batch-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px;
  margin-bottom:14px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--bg);
}
.scanner-batch-status{
  margin-top:4px;
  font-weight:700;
}
.scanner-batch-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
@media(max-width:640px){
  .scanner-batch-bar{
    align-items:stretch;
    flex-direction:column;
  }
  .scanner-batch-actions button{
    width:100%;
  }
}

.scanner-candidate-status{min-height:18px;font-weight:600}
.scanner-dialog{
  width:min(960px,94vw)!important;
  max-width:960px!important;
  max-height:92dvh!important;
  padding:0!important;
  overflow:hidden!important;
}
.scanner-dialog .ops-dialog-shell{
  max-height:92dvh;
  overflow-y:auto;
  padding:14px;
  box-sizing:border-box;
}
.scanner-preview-shell{min-height:280px}
.scanner-preview{max-height:390px}
.scanner-match-image{max-height:360px}

@media(max-width:760px){
  .scanner-dialog{
    width:calc(100vw - 18px)!important;
    max-width:calc(100vw - 18px)!important;
    height:auto!important;
    max-height:calc(100dvh - 18px)!important;
    margin:auto!important;
    border-radius:16px!important;
  }
  .scanner-dialog .ops-dialog-shell{
    max-height:calc(100dvh - 18px);
    padding:10px;
  }
  .scanner-dialog .dialog-head{gap:8px;align-items:flex-start}
  .scanner-dialog .dialog-head h2{font-size:18px;margin-top:2px}
  .scanner-grid{grid-template-columns:1fr;gap:10px}
  .scanner-capture-panel,.scanner-identify-panel,.scanner-match-panel{padding:9px;border-radius:12px}
  .scanner-preview-shell{min-height:220px}
  .scanner-preview{max-height:310px}
  .scanner-match-card{grid-template-columns:1fr;gap:10px}
  .scanner-match-image{max-height:330px}
  .scanner-capture-actions,.scanner-result-actions{display:grid;grid-template-columns:1fr 1fr}
  .scanner-two-col{grid-template-columns:1fr 1fr;gap:7px}
  .scanner-batch-bar{padding:9px;margin-bottom:10px}
}
@media(max-width:390px){
  .scanner-dialog{
    width:calc(100vw - 10px)!important;
    max-width:calc(100vw - 10px)!important;
    max-height:calc(100dvh - 10px)!important;
  }
  .scanner-dialog .ops-dialog-shell{
    max-height:calc(100dvh - 10px);
    padding:8px;
  }
  .scanner-two-col,.scanner-capture-actions,.scanner-result-actions{grid-template-columns:1fr}
  .scanner-preview-shell{min-height:190px}
  .scanner-preview{max-height:270px}
}


/* v6.3.8 — Narrow Singles Scanner UI
   UI-only override. Recognition/inventory logic unchanged. */

.scanner-dialog{
  width:min(780px,88vw)!important;
  max-width:780px!important;
  min-width:0!important;
  max-height:90dvh!important;
  padding:0!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}

.scanner-dialog .ops-dialog-shell{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  max-height:90dvh!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  box-sizing:border-box!important;
  padding:12px!important;
}

/* Desktop/tablet: scanner itself stays narrow; content can still use 2 columns. */
.scanner-dialog .scanner-grid{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
  gap:10px!important;
}

.scanner-dialog .scanner-capture-panel,
.scanner-dialog .scanner-identify-panel,
.scanner-dialog .scanner-match-panel,
.scanner-dialog .scanner-batch-bar,
.scanner-dialog .scanner-match-card,
.scanner-dialog .scanner-match-details{
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}

.scanner-dialog input,
.scanner-dialog select,
.scanner-dialog textarea,
.scanner-dialog button{
  max-width:100%!important;
  box-sizing:border-box!important;
}

.scanner-preview-shell{
  min-height:220px!important;
}

.scanner-preview{
  width:100%!important;
  max-height:320px!important;
  object-fit:contain!important;
}

.scanner-match-image{
  width:100%!important;
  max-height:300px!important;
  object-fit:contain!important;
}

/* Phone: intentionally narrower than the device width and strictly single-column. */
@media(max-width:760px){
  .scanner-dialog{
    width:92vw!important;
    max-width:92vw!important;
    min-width:0!important;
    height:auto!important;
    max-height:88dvh!important;
    margin:auto!important;
    border-radius:14px!important;
  }

  .scanner-dialog .ops-dialog-shell{
    max-height:88dvh!important;
    padding:8px!important;
  }

  .scanner-dialog .scanner-grid{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:8px!important;
  }

  .scanner-dialog .scanner-match-card{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:8px!important;
  }

  .scanner-dialog .scanner-two-col{
    grid-template-columns:minmax(0,1fr)!important;
    gap:6px!important;
  }

  .scanner-dialog .scanner-capture-actions,
  .scanner-dialog .scanner-result-actions,
  .scanner-dialog .scanner-batch-actions{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:6px!important;
  }

  .scanner-dialog .dialog-head{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:6px!important;
    align-items:start!important;
  }

  .scanner-dialog .dialog-head h2{
    font-size:17px!important;
    line-height:1.15!important;
    margin:2px 0 0!important;
  }

  .scanner-dialog .scanner-capture-panel,
  .scanner-dialog .scanner-identify-panel,
  .scanner-dialog .scanner-match-panel,
  .scanner-dialog .scanner-batch-bar{
    padding:8px!important;
    border-radius:10px!important;
  }

  .scanner-preview-shell{
    min-height:170px!important;
  }

  .scanner-preview{
    max-height:240px!important;
  }

  .scanner-match-image{
    max-height:250px!important;
  }
}

/* Very narrow iPhones / compact browsers */
@media(max-width:390px){
  .scanner-dialog{
    width:90vw!important;
    max-width:90vw!important;
    max-height:86dvh!important;
  }

  .scanner-dialog .ops-dialog-shell{
    max-height:86dvh!important;
    padding:7px!important;
  }

  .scanner-preview-shell{
    min-height:150px!important;
  }

  .scanner-preview{
    max-height:220px!important;
  }

  .scanner-match-image{
    max-height:230px!important;
  }
}

.scanner-market-panel{border:1px solid var(--border);border-radius:12px;padding:9px;min-width:0}
.scanner-market-head{display:flex;justify-content:space-between;gap:8px;align-items:start}
.scanner-market-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin-top:8px}
.scanner-market-metrics>div{border:1px solid var(--border);border-radius:9px;padding:6px;min-width:0}
.scanner-market-metrics span{display:block;color:var(--muted);font-size:10px}
.scanner-market-metrics strong{display:block;margin-top:2px;font-size:14px}
.scanner-recent-sales{margin-top:7px;color:var(--muted);font-size:10px;overflow-wrap:anywhere}
@media(max-width:520px){
  .scanner-market-head{display:grid;grid-template-columns:1fr}
  .scanner-market-head button{width:100%}
  .scanner-market-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* v6.4.1 — Mana Pool pricing panel width containment */
.scanner-dialog .scanner-market-panel{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
}

.scanner-dialog .scanner-market-head{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:start!important;
  gap:8px!important;
}

.scanner-dialog .scanner-market-head > div{
  min-width:0!important;
  max-width:100%!important;
  overflow-wrap:anywhere!important;
}

.scanner-dialog #scannerMarketRefreshBtn{
  width:auto!important;
  max-width:150px!important;
  min-width:0!important;
  white-space:normal!important;
}

.scanner-dialog .scanner-market-metrics{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:6px!important;
}

.scanner-dialog .scanner-market-metrics > div{
  width:auto!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
}

.scanner-dialog .scanner-market-metrics span,
.scanner-dialog .scanner-market-metrics strong{
  max-width:100%!important;
  overflow-wrap:anywhere!important;
}

.scanner-dialog .scanner-recent-sales{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  overflow-wrap:anywhere!important;
}

@media(max-width:760px){
  .scanner-dialog .scanner-market-head{
    grid-template-columns:minmax(0,1fr)!important;
  }

  .scanner-dialog #scannerMarketRefreshBtn{
    width:100%!important;
    max-width:100%!important;
  }

  .scanner-dialog .scanner-market-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media(max-width:360px){
  .scanner-dialog .scanner-market-metrics{
    grid-template-columns:minmax(0,1fr)!important;
  }
}


/* v6.4.2 — Mana Pool panel structural full-width fix
   Panel now lives outside scanner-match-card, beside Existing GAA Inventory. */

.scanner-match-panel > .scanner-market-panel{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  margin-top:12px!important;
  padding:12px!important;
  border:1px solid var(--border)!important;
  border-radius:14px!important;
  background:var(--bg)!important;
  overflow:hidden!important;
}

.scanner-match-panel > .scanner-market-panel .scanner-market-head{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  display:flex!important;
  justify-content:space-between!important;
  align-items:flex-start!important;
  gap:10px!important;
  box-sizing:border-box!important;
}

.scanner-match-panel > .scanner-market-panel .scanner-market-head > div{
  flex:1 1 auto!important;
  min-width:0!important;
}

.scanner-match-panel > .scanner-market-panel #scannerMarketRefreshBtn{
  flex:0 0 auto!important;
  width:auto!important;
  max-width:150px!important;
}

.scanner-match-panel > .scanner-market-panel .scanner-market-metrics{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:6px!important;
  box-sizing:border-box!important;
}

.scanner-match-panel > .scanner-market-panel .scanner-market-metrics > div{
  min-width:0!important;
  width:auto!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}

.scanner-match-panel > .scanner-market-panel .scanner-recent-sales{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow-wrap:anywhere!important;
}

/* Explicitly preserve normal storage-location control styling */
.scanner-match-details > label{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}

.scanner-match-details > label > select,
.scanner-match-details > label > input{
  width:100%!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}

@media(max-width:760px){
  .scanner-match-panel > .scanner-market-panel .scanner-market-head{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
  }

  .scanner-match-panel > .scanner-market-panel #scannerMarketRefreshBtn{
    width:100%!important;
    max-width:100%!important;
  }

  .scanner-match-panel > .scanner-market-panel .scanner-market-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media(max-width:360px){
  .scanner-match-panel > .scanner-market-panel .scanner-market-metrics{
    grid-template-columns:minmax(0,1fr)!important;
  }
}


/* v6.4.3 — Scryfall local catalog manager */
.catalog-dialog{
  width:min(760px,92vw);
  max-width:760px;
}
.catalog-intro{margin:0 0 12px}
.catalog-stat-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
  margin-bottom:12px;
}
.catalog-stat{
  border:1px solid var(--border);
  border-radius:12px;
  padding:9px;
  min-width:0;
}
.catalog-stat span{
  display:block;
  color:var(--muted);
  font-size:10px;
}
.catalog-stat strong{
  display:block;
  margin-top:4px;
  font-size:13px;
  overflow-wrap:anywhere;
}
.catalog-source-panel,
.catalog-import-panel,
.catalog-note{
  border:1px solid var(--border);
  border-radius:14px;
  padding:11px;
  margin-top:10px;
}
.catalog-source-panel{
  display:flex;
  align-items:start;
  justify-content:space-between;
  gap:10px;
}
.catalog-import-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.catalog-progress-track{
  width:100%;
  height:10px;
  margin-top:12px;
  overflow:hidden;
  border-radius:999px;
  background:var(--border);
}
.catalog-progress-bar{
  width:0%;
  height:100%;
  background:var(--accent);
  transition:width .15s ease;
}
.catalog-import-detail{
  margin-top:7px;
  font-size:11px;
  color:var(--muted);
}
@media(max-width:680px){
  .catalog-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .catalog-source-panel{display:grid;grid-template-columns:1fr}
  .catalog-source-panel button,
  .catalog-import-actions button{width:100%}
}

/* v6.4.4.1 */
#scannerScryfallFallbackBtn{opacity:.86}


/* v6.4.5 — Set Rapid Intake */
.rapid-intake-dialog{
  width:min(760px,92vw);
  max-width:760px;
  max-height:92dvh;
}
.rapid-intake-dialog .ops-dialog-shell{
  max-height:92dvh;
  overflow-y:auto;
}
.rapid-config-panel,
.rapid-entry-panel,
.rapid-last-card,
.rapid-feed-panel{
  border:1px solid var(--border);
  border-radius:14px;
  padding:11px;
  margin-top:10px;
}
.rapid-config-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
}
.rapid-config-grid label,
.rapid-number-label{
  min-width:0;
}
.rapid-config-grid select,
.rapid-number-label input{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
}
.rapid-batch-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  gap:8px;
  align-items:end;
  margin-top:10px;
}
.rapid-number-label input{
  font-size:28px;
  font-weight:800;
  text-align:center;
  padding:14px;
}
.rapid-last-card{
  display:grid;
  grid-template-columns:90px minmax(0,1fr);
  gap:12px;
  align-items:center;
}
.rapid-last-card img{
  width:90px;
  max-height:126px;
  object-fit:contain;
  border-radius:8px;
}
.rapid-stats-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-top:10px;
}
.rapid-stats-grid>div{
  border:1px solid var(--border);
  border-radius:12px;
  padding:9px;
  min-width:0;
}
.rapid-stats-grid span{
  display:block;
  color:var(--muted);
  font-size:10px;
}
.rapid-stats-grid strong{
  display:block;
  margin-top:3px;
  font-size:18px;
}
.rapid-feed-head{
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:start;
}
.rapid-feed{
  display:grid;
  gap:6px;
  margin-top:8px;
  max-height:280px;
  overflow:auto;
}
.rapid-feed-row{
  display:grid;
  grid-template-columns:48px minmax(0,1fr) auto;
  gap:8px;
  align-items:center;
  padding:7px;
  border:1px solid var(--border);
  border-radius:10px;
}
.rapid-feed-seq{
  font-weight:800;
}
.rapid-feed-main{
  min-width:0;
}
.rapid-feed-main strong,
.rapid-feed-main span{
  display:block;
  overflow-wrap:anywhere;
}
.rapid-feed-main span{
  color:var(--muted);
  font-size:10px;
}
.rapid-feed-price{
  font-weight:700;
}
@media(max-width:680px){
  .rapid-config-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .rapid-batch-row{grid-template-columns:minmax(0,1fr)}
  .rapid-batch-row button{width:100%}
}
@media(max-width:420px){
  .rapid-intake-dialog{width:92vw;max-width:92vw}
  .rapid-config-grid{grid-template-columns:minmax(0,1fr)}
  .rapid-stats-grid{grid-template-columns:minmax(0,1fr)}
  .rapid-last-card{grid-template-columns:70px minmax(0,1fr)}
  .rapid-last-card img{width:70px;max-height:98px}
  .rapid-feed-row{grid-template-columns:40px minmax(0,1fr)}
  .rapid-feed-price{grid-column:2}
}


/* v6.4.5.3 — storage-location removal */
.location-row-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.location-row-actions button{
  white-space:nowrap;
}
@media(max-width:680px){
  .location-row-actions{
    display:grid;
    grid-template-columns:1fr;
  }
}


/* v6.4.5.5 — location management */
.location-view-actions{
  flex-wrap:wrap;
}
@media(max-width:680px){
  .location-view-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .location-view-actions button{
    width:100%;
  }
}


/* v6.4.5.7 — Rapid Intake production-speed pass */
.rapid-entry-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:end;
}
.rapid-speed-controls{
  display:grid;
  gap:6px;
  min-width:170px;
}
.rapid-toggle{
  display:flex;
  align-items:center;
  gap:7px;
  font-size:11px;
  color:var(--muted);
  cursor:pointer;
}
.rapid-toggle input{
  width:auto;
  margin:0;
}
.rapid-speed-status{
  margin-top:5px;
  font-size:11px;
  font-weight:700;
  color:var(--muted);
}
.rapid-speed-status[data-kind="success"]{color:#15803d}
.rapid-speed-status[data-kind="duplicate"]{color:#b45309}
.rapid-speed-status[data-kind="error"]{color:#b91c1c}

.rapid-entry-panel{
  transition:background-color .18s ease,border-color .18s ease,transform .12s ease;
}
.rapid-entry-panel.rapid-flash-success{
  background:color-mix(in srgb,#16a34a 12%,var(--panel));
  border-color:#16a34a;
  transform:scale(1.003);
}
.rapid-entry-panel.rapid-flash-duplicate{
  background:color-mix(in srgb,#f59e0b 14%,var(--panel));
  border-color:#f59e0b;
}
.rapid-entry-panel.rapid-flash-error{
  background:color-mix(in srgb,#dc2626 12%,var(--panel));
  border-color:#dc2626;
}
.rapid-feed-latest{
  border-color:var(--accent);
}
.rapid-dup-badge{
  display:inline-block;
  margin-left:6px;
  padding:2px 6px;
  border-radius:999px;
  font-size:9px;
  font-weight:800;
  background:var(--chip);
  color:var(--text);
  vertical-align:middle;
}
.rapid-feed-meta{
  display:grid;
  justify-items:end;
  gap:2px;
}
.rapid-feed-meta small{
  color:var(--muted);
  font-size:9px;
}
@media(max-width:680px){
  .rapid-entry-head{
    grid-template-columns:minmax(0,1fr);
  }
  .rapid-speed-controls{
    grid-template-columns:1fr 1fr;
    min-width:0;
  }
}


/* v6.4.6.0 — Batch Put-Away */
.batch-putaway-dialog{
  width:min(860px,94vw);
  max-width:860px;
}
.putaway-scan-panel,
.putaway-summary,
.putaway-destination-panel,
.putaway-result{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  margin-top:10px;
}
.putaway-summary-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:start;
}
.putaway-summary-head h3{
  margin:3px 0;
}
.putaway-main-action,
.putaway-confirm{
  width:100%;
  margin-top:12px;
  font-size:16px;
}
.putaway-destination-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-top:8px;
}
.putaway-destination-grid label{
  display:block;
  margin-top:8px;
}
.putaway-destination-grid label>span{
  display:block;
  font-size:11px;
  color:var(--muted);
  margin-bottom:4px;
}
.putaway-destination-grid input,
.putaway-destination-grid select{
  width:100%;
}
.putaway-location-actions{
  display:flex;
  gap:7px;
  margin-top:8px;
}
.putaway-create-location{
  border-left:1px solid var(--border);
  padding-left:14px;
}
.putaway-move-preview{
  margin-top:12px;
  padding:10px;
  border-radius:10px;
  background:var(--chip);
  font-size:12px;
}
.putaway-result strong{
  font-size:16px;
}
@media(max-width:680px){
  .putaway-destination-grid{
    grid-template-columns:1fr;
  }
  .putaway-create-location{
    border-left:0;
    border-top:1px solid var(--border);
    padding-left:0;
    padding-top:12px;
  }
  .putaway-location-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .putaway-summary-head{
    display:grid;
    grid-template-columns:1fr;
  }
}


/* v6.4.6.1 — simplified Move Location */
.move-location-dialog{
  width:min(820px,94vw);
  max-width:820px;
}
.move-location-panel{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  margin-top:10px;
}
.move-location-panel label{
  display:block;
  margin-top:8px;
}
.move-location-panel label>span{
  display:block;
  font-size:11px;
  color:var(--muted);
  margin-bottom:4px;
}
.move-location-panel input,
.move-location-panel select{
  width:100%;
}
.move-location-actions{
  display:flex;
  gap:7px;
  margin-top:8px;
}
.move-location-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-top:8px;
}
.move-create-location{
  border-left:1px solid var(--border);
  padding-left:14px;
}
@media(max-width:680px){
  .move-location-grid{
    grid-template-columns:1fr;
  }
  .move-create-location{
    border-left:0;
    border-top:1px solid var(--border);
    padding-left:0;
    padding-top:12px;
  }
  .move-location-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }
}


/* v6.4.6.2 — optional product thumbnails in storage locations */
.location-photo-toggle{
  display:flex;
  align-items:center;
  gap:7px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel);
  font-weight:700;
  font-size:12px;
  cursor:pointer;
  user-select:none;
}
.location-photo-toggle input{
  width:auto;
  margin:0;
}
.location-photo-col{
  display:none;
  width:64px;
}
.location-inventory-table.show-location-photos .location-photo-col{
  display:table-cell;
}
.location-product-thumb{
  width:52px;
  height:68px;
  object-fit:contain;
  display:block;
  border-radius:6px;
  background:var(--chip);
}
.location-product-thumb-empty{
  font-size:8px;
  color:var(--muted);
  text-align:center;
  padding:18px 4px 0;
  border:1px solid var(--border);
}
@media(max-width:680px){
  .location-product-thumb{
    width:42px;
    height:56px;
  }
  .location-photo-col{
    width:50px;
  }
}


/* v6.4.6.3 — mobile storage table + image preview */
.location-thumb-button{
  display:block;
  border:0;
  padding:0;
  background:transparent;
  border-radius:6px;
  cursor:pointer;
}
.location-thumb-button:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}
.location-mobile-sku{
  display:none;
  margin-top:3px;
  font-size:10px;
  color:var(--muted);
  overflow-wrap:anywhere;
}
.location-product-name{
  font-weight:700;
}
.image-preview-dialog{
  width:min(760px,94vw);
  max-width:760px;
  max-height:94dvh;
  padding:0;
  border:0;
  background:transparent;
}
.image-preview-shell{
  position:relative;
  display:grid;
  place-items:center;
  gap:10px;
  padding:14px;
  border-radius:16px;
  background:var(--panel);
  max-height:92dvh;
  overflow:auto;
}
.image-preview-shell img{
  display:block;
  width:auto;
  height:auto;
  max-width:min(88vw,680px);
  max-height:78dvh;
  object-fit:contain;
  border-radius:10px;
}
.image-preview-close{
  justify-self:end;
}
.image-preview-name{
  font-weight:800;
  text-align:center;
}

@media(max-width:680px){
  .location-inventory-table{
    width:100%;
    table-layout:fixed;
  }
  .location-inventory-table th,
  .location-inventory-table td{
    white-space:normal;
    overflow-wrap:anywhere;
    padding-left:6px;
    padding-right:6px;
  }
  .location-inventory-table .location-desktop-sku{
    display:none;
  }
  .location-inventory-table th:nth-child(3){
    display:none;
  }
  .location-mobile-sku{
    display:block;
  }

  /* Photo off: Product / Qty Here / Total / Actions */
  .location-inventory-table:not(.show-location-photos) th:nth-child(2),
  .location-inventory-table:not(.show-location-photos) td:nth-child(2){
    width:44%;
  }
  .location-inventory-table:not(.show-location-photos) th:nth-child(4),
  .location-inventory-table:not(.show-location-photos) td:nth-child(4){
    width:14%;
    text-align:center;
  }
  .location-inventory-table:not(.show-location-photos) th:nth-child(5),
  .location-inventory-table:not(.show-location-photos) td:nth-child(5){
    width:12%;
    text-align:center;
  }
  .location-inventory-table:not(.show-location-photos) th:nth-child(6),
  .location-inventory-table:not(.show-location-photos) td:nth-child(6){
    width:30%;
  }

  /* Photo on: Photo / Product / Qty Here / Total / Actions */
  .location-inventory-table.show-location-photos th:nth-child(1),
  .location-inventory-table.show-location-photos td:nth-child(1){
    width:48px;
  }
  .location-inventory-table.show-location-photos th:nth-child(2),
  .location-inventory-table.show-location-photos td:nth-child(2){
    width:34%;
  }
  .location-inventory-table.show-location-photos th:nth-child(4),
  .location-inventory-table.show-location-photos td:nth-child(4){
    width:13%;
    text-align:center;
  }
  .location-inventory-table.show-location-photos th:nth-child(5),
  .location-inventory-table.show-location-photos td:nth-child(5){
    width:11%;
    text-align:center;
  }
  .location-inventory-table.show-location-photos th:nth-child(6),
  .location-inventory-table.show-location-photos td:nth-child(6){
    width:28%;
  }

  .location-row-actions{
    display:grid;
    grid-template-columns:1fr;
    gap:5px;
  }
  .location-row-actions button{
    width:100%;
    min-width:0;
    padding-left:6px;
    padding-right:6px;
    font-size:11px;
  }
  .image-preview-dialog{
    width:96vw;
    max-width:96vw;
  }
  .image-preview-shell{
    max-height:94dvh;
    padding:10px;
  }
  .image-preview-shell img{
    max-width:90vw;
    max-height:80dvh;
  }
}


/* v6.4.6.4 — TCG missing-photo repair */
.scryfall-photo-repair{
  width:100%;
  margin-top:6px;
}
.collection-app{min-height:100dvh;background:var(--bg);color:var(--text)}.collection-topbar{display:flex;justify-content:space-between;align-items:center;padding:16px 22px;border-bottom:1px solid var(--border);background:var(--panel)}.collection-brand{font-weight:950;letter-spacing:.08em}.collection-subbrand{font-size:10px;letter-spacing:.25em;color:var(--muted)}.collection-shell{width:min(1050px,100%);margin:auto;padding:34px 16px}.collection-auth-screen{display:grid;grid-template-columns:1.2fr .8fr;gap:36px;align-items:center;min-height:75dvh}.collection-mark{width:78px;height:78px;border-radius:20px;display:grid;place-items:center;background:var(--text);color:var(--bg);font-weight:950}.collection-hero h1,.collection-welcome h1{font-size:clamp(38px,6vw,64px);line-height:1}.collection-hero p,.collection-welcome p{color:var(--muted)}.collection-auth-card{background:var(--panel);border:1px solid var(--border);border-radius:22px;padding:20px}.collection-auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px}.collection-auth-tab{border:0;border-radius:10px;padding:11px;background:var(--chip);color:var(--muted);font-weight:800}.collection-auth-tab.active{background:var(--text);color:var(--bg)}.collection-auth-card label{display:block;font-size:12px;font-weight:800;margin:12px 0}.collection-auth-card input,.collection-main-action{width:100%}.collection-status{min-height:22px;color:var(--muted)}.collection-game-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-top:28px}.collection-game-tile,.collection-action-card{border:1px solid var(--border);background:var(--panel);color:var(--text);border-radius:20px;padding:22px;min-height:155px;text-align:left;display:flex;flex-direction:column;gap:8px;justify-content:flex-end}.collection-game-tile:disabled{opacity:.45}.game-monogram{margin-bottom:auto;font-size:22px;font-weight:950}.collection-game-tile span,.collection-action-card span{font-size:12px;color:var(--muted)}.collection-action-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:28px}.collection-back{border:0;background:transparent;color:var(--muted)}@media(max-width:720px){.collection-auth-screen{grid-template-columns:1fr}.collection-action-grid{grid-template-columns:1fr}}@media(max-width:430px){.collection-game-grid{grid-template-columns:1fr}}