/* Compact price provenance, using the existing glass, accent and type scale. */
.price-origin {display:inline-block;font-size:10px;font-weight:650;line-height:1.5;white-space:nowrap;}
.price-origin.is-personal {color:var(--gold);border:1px solid color-mix(in srgb,var(--gold) 35%,transparent);border-radius:6px;padding:0 5px;background:color-mix(in srgb,var(--gold) 7%,transparent);}
.lot-value:has(.price-origin) {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px;justify-content:start;}
.lot-value>.price-origin {grid-column:1/-1;justify-self:start;}
.value-lot-info>.price-origin {justify-self:start;}
.value-price-sources {margin:14px 0 2px;padding-top:12px;border-top:1px solid var(--line);font-size:13px;}
.value-price-sources>summary {cursor:pointer;color:var(--muted);font-weight:650;}
.value-price-sources dl {margin:12px 0;display:grid;gap:10px;}
.value-price-sources dl>div {display:flex;justify-content:space-between;gap:12px;align-items:center;}
.value-price-sources dt {display:grid;gap:2px;}.value-price-sources dt small {color:var(--muted);font-size:11px;}.value-price-sources dd {margin:0;font-weight:650;}
.grid-size-field {border:0;margin:0;padding:0;min-width:0;}.grid-size-field legend {font-size:13px;font-weight:650;margin-bottom:10px;}
.grid-size-control {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding:4px;gap:4px;border:1px solid var(--line);border-radius:14px;background:var(--surface-2);}
.grid-size-control label {position:relative;min-width:0;cursor:pointer;}.grid-size-control input {position:absolute;width:1px;height:1px;opacity:0;}
.grid-size-control span {display:grid;place-items:center;min-height:44px;border-radius:10px;padding:8px 4px;color:var(--muted);font-size:13px;font-weight:650;}
.grid-size-control input:checked+span {background:var(--glass,var(--surface));color:var(--text);box-shadow:inset 0 1px #ffffff12,0 1px 4px #0002;}
.grid-size-control input:focus-visible+span {outline:2px solid var(--gold);outline-offset:1px;}
.settings-grid>.check {margin-top:20px;}
:root[data-grid-size="small"] #content.view-gallery :is(.card-grid,.display-list) {grid-template-columns:repeat(auto-fill,minmax(min(100%,110px),1fr));gap:14px 10px;}
:root[data-grid-size="large"] #content.view-gallery :is(.card-grid,.display-list) {grid-template-columns:repeat(auto-fill,minmax(min(100%,250px),1fr));}
:root[data-grid-size="small"] #content.view-gallery .display-list .lot-name {font-size:12px;}
:root[data-grid-size="small"] #content.view-gallery .display-list .lot-side {gap:4px;}
:root[data-grid-pinch="on"] #content.view-gallery :is(.card-grid,.display-list) {touch-action:pan-x pan-y;}
@media(max-width:700px) { :root[data-grid-size="large"] #content.view-gallery :is(.card-grid,.display-list) {grid-template-columns:minmax(0,1fr);} }
/* Phone galleries keep predictable Small / Medium / Large densities. */
@media(max-width:599px) {
 :root[data-grid-size="small"] #content.view-gallery :is(.card-grid,.display-list) {grid-template-columns:repeat(3,minmax(0,1fr));}
 :root[data-grid-size="medium"] #content.view-gallery :is(.card-grid,.display-list) {grid-template-columns:repeat(2,minmax(0,1fr));}
}

/* Compact view on phones: one neat card pill. The art spans the row; the name, printing line and a single control
   line (price · condition, then quantity and Edit) sit beside it, so there is no empty band and no third line. Rows being selected keep their batch layout. */
@media (max-width: 480px) {
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) { grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; row-gap: 6px; padding: 8px 10px; align-items: center; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-art { grid-row: 1 / span 2; align-self: start; width: 52px; height: 73px; min-width: 0; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-art .img-missing { font-size: 9px; line-height: 1.15; padding: 2px; overflow-wrap: anywhere; text-align: center; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-info { align-self: end; gap: 1px; min-width: 0; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-info .lot-name { font-size: 15px; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-info .tag { padding: 1px 6px; font-size: 11px; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-side { grid-column: -2; grid-row: 2; align-self: start; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; min-width: 0; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-side .lot-value { display: flex; align-items: center; gap: 6px; min-width: 0; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-side .stepper { margin-left: auto; }
  body[data-view="collection"] #content.view-compact .display-list > .lot:not(:has(> .batch-mark)) > .lot-side [data-act="editLot"] { min-height: 44px; padding-inline: 4px; }
}

/* Collection tools on phones: Sort with its direction on top, search under it, then the filters on one full-width
   line, so every control lines up on the same left and right edges and long labels never clip. */
@media (max-width: 600px) {
  .coll-tools { gap: 8px; margin-bottom: 10px; }
  .coll-tools > .collection-primary-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .coll-tools .collection-sort-controls { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; width: 100%; flex: none; }
  .coll-tools .collection-sort-label { flex: 1 1 auto; min-width: 0; font-size: 0; gap: 0; }
  .coll-tools .collection-direction-label { flex: 0 0 88px; margin-left: 0; }
  .coll-tools .collection-primary-tools > input[type="search"] { width: 100%; min-height: 44px; }
  .coll-tools .collection-sort-controls select { width: 100%; height: 44px; min-height: 44px; font-size: 12px; padding-left: 11px; letter-spacing: -.1px; }
}
/* The narrowest phones give the longest sort names the full row; direction sits under it on the right. */
@media (max-width: 360px) {
  .coll-tools .collection-sort-controls { flex-wrap: wrap; justify-content: flex-end; }
  .coll-tools .collection-sort-label { flex: 1 0 100%; }
}
