/* Raw Material + Finished Products pages */
.pgsel{border-radius:999px;padding:7px 12px;max-width:220px}
.skuhint{font-size:12px;color:var(--muted);background:var(--row);border-radius:10px;padding:8px 12px}
.skuhint b{color:var(--ink2);font-weight:600}
.own{display:inline-block;font-size:11px;font-weight:600;padding:3px 8px;border-radius:999px;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis}
.own,.own.em,.own.cl{background:none!important;border:0!important;padding:0;font-size:inherit;font-weight:inherit;color:inherit!important}
.own.cl{background:#fbf1d5;color:#7a5410}
@media (prefers-color-scheme:dark){.own.cl{background:#4a3d14;color:#f7e2a0}}
.pgmodal{position:fixed;inset:0;background:rgba(0,0,0,.28);z-index:60;display:grid;place-items:center;padding:16px}
.pgmodal[hidden]{display:none}
.pgbox{width:min(620px,100%);max-height:calc(100vh - 32px);overflow:auto;padding:22px;display:flex;flex-direction:column;gap:14px;border-radius:20px}
.pgh{display:flex;align-items:center;justify-content:space-between;gap:10px}
.pgh h2{font-size:18px;font-weight:500}
.pgform{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.pgform .full{grid-column:1/-1}
.pgform div.f{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--muted)}
.pgform label.chk{flex-direction:row;align-items:center;gap:8px;color:var(--ink2);font-size:13px}
.skuprev{font-size:15px;font-weight:600;color:var(--ink);background:var(--row);border-radius:10px;padding:9px 12px;letter-spacing:.02em}
.pgbox .acts{display:flex;gap:8px;justify-content:flex-end}
@media(max-width:560px){.pgform{grid-template-columns:1fr}}
.kvgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
@media(max-width:760px){.kvgrid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.kv{background:var(--row);border-radius:12px;padding:10px 12px;display:flex;flex-direction:column;gap:4px;min-width:0}
.kv span{font-size:11px;color:var(--muted)}
.kv b{font-weight:600;font-size:14px;overflow-wrap:anywhere}
.kv a{color:inherit}
/* product edit + photos */
.editbtn{display:inline-flex;align-items:center;gap:6px}
.editbtn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linejoin:round}
.thumb{width:34px;height:34px;border-radius:8px;object-fit:cover;float:left;margin:0 10px 0 0;background:var(--row)}
.pdtop{display:grid;grid-template-columns:260px minmax(0,1fr);gap:16px;align-items:start}
.pdtop.nophoto{grid-template-columns:1fr}
@media(max-width:760px){.pdtop{grid-template-columns:1fr}}
.gal{display:flex;flex-direction:column;gap:8px}
.gmain{border:0;padding:0;border-radius:14px;overflow:hidden;background:var(--row);aspect-ratio:1/1;cursor:zoom-in}
.gmain img{width:100%;height:100%;object-fit:contain;display:block}
.gcap{font-size:12px;color:var(--muted);text-align:center;min-height:16px}
.gthumbs{display:flex;gap:6px;flex-wrap:wrap}
.gt{border:2px solid transparent;padding:0;border-radius:10px;overflow:hidden;width:52px;height:52px;background:var(--row);cursor:pointer}
.gt.on{border-color:#E9B730}
.gt img{width:100%;height:100%;object-fit:cover;display:block}
.phgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px}
.ph{background:var(--row);border-radius:12px;padding:6px;display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--ink2)}
.ph img{width:100%;aspect-ratio:1/1;object-fit:cover;border-radius:8px}
.ph input{font-size:12px;padding:5px 8px}
.ph button{border:0;background:none;color:var(--red-ink);font-size:12px;cursor:pointer;align-self:flex-start;padding:0}
.ph.gone img{opacity:.3}
.ph.gone span{text-decoration:line-through}
.ph.gone button{color:var(--ink2)}
.ph.new{outline:1.5px dashed #E9B730}
.addph{align-self:flex-start;cursor:pointer;margin-top:4px}
.reason textarea{resize:vertical;font:inherit;padding:8px 10px;border-radius:10px;border:1px solid var(--line);background:var(--glass-solid);color:var(--ink)}
/* item windows with supplier prices get more room */
.pgbox.xwide,.pgbox:has(#sk-prices),.pgbox:has(#sx-prices),.pgbox:has(#cc-prices){width:min(1100px,100%)!important}
.pbt th,.pbt td{white-space:nowrap}.pbt td.wrap{white-space:normal}
/* tall windows: sections keep their height and the window scrolls, instead of squashing the last section */
.pgbox > *{flex-shrink:0}
/* phone + tablet: price tables become cards (label above each value) */
@media(max-width:820px){
  .pbt,.pbt tbody{display:block;width:100%}.pbt thead{display:none}
  .pbt tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 14px;padding:12px 4px;border-top:1px solid var(--line)}
  .pbt tbody tr:first-child{border-top:0}
  .pbt td{display:flex;flex-direction:column;gap:2px;white-space:normal!important;text-align:left!important;padding:0!important;border:0!important;min-width:0;background:none!important}
  .pbt td::before{content:attr(data-l);font-size:11px;color:var(--muted);font-weight:400}
  .pbt td[data-l=""]::before{display:none}
  .pbt td:first-child{grid-column:1/-1;font-weight:600}
  .pbt td[data-l=""]:last-child{grid-column:1/-1}
  .pbt td[data-l=""] > span{justify-content:flex-start}.pbt .linkdel{margin-left:0}
}
@media(min-width:561px) and (max-width:820px){.pbt tr{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:640px){.skm td{white-space:normal!important}.skm td:first-child,.skm td:last-child{white-space:nowrap!important}.skm td,.skm th{padding-left:8px!important;padding-right:8px!important}}
.pbx .tbl-wrap{margin:0}
.pbt th{white-space:normal}
.pbt td.wrap{min-width:150px}
@media(max-width:820px){.pbt td.wrap{min-width:0}}
/* phone / tablet: the window fits the visible screen and scrolls by itself, not the page behind */
.pgmodal{height:100vh;height:100dvh;overscroll-behavior:contain}
.pgbox{max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
html:has(.pgmodal:not([hidden])),body:has(.pgmodal:not([hidden])){overflow:hidden}
/* phone: while the calendar sheet is open the page behind stays still */
html:has(.dpscrim),body:has(.dpscrim){overflow:hidden}
.lovr{overflow-x:auto}
