/* Market shares Equipment's measured inventory/detail columns. */
.bag-modal:has(.market-workspace) .sheet{position:relative;width:98vw!important;max-width:1700px;height:94dvh;max-height:94dvh;padding:16px 20px;overflow:hidden}
.bag-modal:has(.market-workspace) .sheet-head{position:static!important;flex:none;padding:0 0 10px!important;background:transparent}
.bag-modal:has(.market-workspace) .sheet-head>div:first-child{display:flex;align-items:center;gap:22px;min-width:0}
.bag-modal:has(.market-workspace) .sheet-head h2{font-size:26px;margin:4px 0;letter-spacing:.2px;white-space:nowrap}
.bag-modal:has(.market-workspace) .sheet-head .eyebrow{display:flex;align-items:center;font-size:11px;line-height:1.2;letter-spacing:1.3px;border-right:1px solid #bc984b66;padding-right:22px;white-space:nowrap}
.bag-modal:has(.market-workspace) #close-panel{width:36px;height:36px;padding:0;font-size:30px;line-height:1}
.market-workspace{gap:0;justify-content:flex-end}
.market-workspace .market-layout{grid-template-columns:minmax(0,1fr) var(--equipment-details-width,493px);gap:14px;min-width:0;height:var(--equipment-panel-height,100%);flex:0 0 var(--equipment-panel-height,100%)}
.market-workspace .market-layout.seller-layout{grid-template-columns:minmax(0,calc(clamp(100px,23vw,300px) + var(--market-stock-width-trim,0px))) minmax(0,1fr) var(--equipment-details-width,493px);grid-template-rows:minmax(0,1fr)}
.market-workspace :is(.bag-items,.bag-details,.market-listed){padding:12px;min-width:0;min-height:0;margin:0;grid-column:auto;overflow:hidden}
.market-workspace .bag-items{gap:0}
.market-workspace .seller-layout>.bag-items{padding:var(--inventory-panel-padding,12px)}
.market-workspace .market-details{padding:var(--equipment-detail-padding,12px)}
.market-workspace .market-mode-tabs{flex:none;display:flex;gap:6px;padding:0 0 12px;margin:0;border:0}
.market-workspace .market-mode-tabs button{padding:6px 15px;font-size:14px}
.market-workspace .gear-section-title{font:600 19px/1.1 Georgia,'Times New Roman',serif;color:#e3c478;letter-spacing:.25px;padding:2px 7px 9px;min-height:29px;gap:8px;border-bottom:1px solid #ad8c3938;margin-bottom:8px}
.market-workspace .gear-section-title>span{font-size:11px;line-height:1.2;letter-spacing:0;text-align:right;color:#ded6b6}
.market-workspace .trade-inventory-filters{grid-template-columns:minmax(0,1fr) minmax(80px,.75fr);gap:9px;margin:0 0 10px}
.market-workspace .trade-inventory-filters :is(input,select){height:34px;margin:0;padding:6px 9px;font-size:14px;line-height:1.2}
.market-workspace .bag-grid{gap:3px;padding:4px;margin:0;border:1px solid #8c753c8c;background:#030805;overflow:auto}
.market-workspace .bag-grid{grid-template-columns:repeat(var(--market-columns,5),var(--inventory-item-size))!important;overflow:hidden}
.market-workspace .market-empty-cell{pointer-events:none;background:#08110d;border-color:#a28b4e33;box-shadow:none}
.market-workspace .trade-pagination{gap:6px;padding-top:8px;margin-top:10px;min-height:39px;font-size:12px}
.market-workspace .trade-pagination button{min-width:30px;min-height:29px;padding:3px 8px;font-size:17px;line-height:1}
/* All thirty-five listing types on one page, fitted as five columns/seven rows. */
.market-workspace .market-listed{display:flex;flex-direction:column;overflow:auto}
.market-workspace .market-list{display:grid;flex:1;min-height:0;grid-template-columns:repeat(5,var(--market-list-cell,40px));grid-template-rows:repeat(7,var(--market-list-cell,40px));gap:3px;width:100%;align-content:start;justify-content:start;overflow:hidden}
.market-workspace .market-list>.market-listing-slot{min-width:0;display:flex;flex-direction:column;align-items:stretch;gap:0;padding:0;margin:0;border:1px solid #a28b4e55;border-radius:4px;background:#0b1510;overflow:hidden}
.market-workspace .market-listing-art{position:relative;display:block;aspect-ratio:1;width:100%;padding:4px;background:radial-gradient(ellipse at center,#304539,#07140f)}
.market-workspace .market-listing-art img{width:100%;height:100%;object-fit:contain;display:block}
.market-workspace .market-listing-art>b{position:absolute;top:2px;left:3px;font-size:10px;line-height:1.1;color:#ffe3a0;text-shadow:0 1px 2px #000}
.market-workspace .market-listing-art>small{position:absolute;right:3px;bottom:2px;font-size:12px;line-height:1.1;color:#fff1ca;background:#0008;padding:1px 2px}
.market-workspace .market-listing-price{display:block;padding:3px 1px;text-align:center;font-size:12px;line-height:1.2;white-space:nowrap;color:#e8c779;background:#050a07}
.market-workspace .market-listing-slot.empty{opacity:.45}
.market-workspace .market-listing-slot.empty .market-listing-art{background:#07110c}
.market-workspace .market-listing-slot.picked{border-color:#f0ce7f;box-shadow:inset 0 0 12px #d3b87533}
.market-workspace .market-listed>.muted{display:block;font-size:12px;line-height:1.5;margin:12px 0 0}
/* A single detail shell in both modes, with the transaction always accessible. */
.market-workspace .market-details{display:flex;flex-direction:column;gap:0}
.market-workspace .market-detail-content{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
/* Seller accepts +0 cards: keep quantity/actions directly after the actual stats. */
.market-workspace[data-market-view="seller"] .market-detail-content{flex:0 1 auto}
.market-workspace .market-details :is(.trade-detail-skill,p,.trade-detail-stats){font-size:15px;line-height:1.35}
.market-workspace .market-details .item-skill-line{line-height:1.35}
.market-workspace .market-details .trade-detail-stats{margin:12px 0;padding:9px 0;border-block:1px solid #ad8d444d}
.market-workspace .market-details .trade-detail-stats>div{display:flex;justify-content:space-between;gap:12px;margin:3px 0}
.market-workspace .market-details .trade-detail-stats :is(dt,dd){margin:0}
.market-workspace .market-transaction{flex:none;margin-top:10px;border-top:1px solid #a18b543d}
.market-workspace .market-price{border:0;padding:8px 0}
.market-workspace .market-price>b{font-size:16px}
.market-workspace .market-price small{font-size:11px;line-height:1.4}
.market-workspace #market-order{display:grid;grid-template-columns:minmax(65px,.4fr) minmax(0,1fr);align-items:end;gap:8px;flex-wrap:nowrap;margin:0}
.market-workspace #market-order label{font-size:13px}
.market-workspace #market-order input{height:36px;margin:3px 0 0;padding:6px 8px;font-size:16px}
.market-workspace #market-order button{min-height:36px;padding:7px;font-size:14px;line-height:1.2}
@media(max-height:900px),(max-width:1100px){
 .market-workspace .gear-section-title{font-size:16px;min-height:24px;margin-bottom:6px;padding-bottom:6px}
 .market-workspace .gear-section-title>span{font-size:9px}
 .market-workspace .market-details :is(.trade-detail-skill,p,.trade-detail-stats){font-size:13px;line-height:1.3}
 .market-workspace .market-details .item-skill-line{line-height:1.3}
}
@media(max-height:750px){.bag-modal:has(.market-workspace) .sheet{padding:10px 14px}}
@media(max-width:1100px){
 .market-workspace .gear-section-title{font-size:13px;padding-inline:2px}
 .bag-modal:has(.market-workspace) .sheet-head>div:first-child{gap:14px}
 .bag-modal:has(.market-workspace) .sheet-head .eyebrow{font-size:9px;letter-spacing:.8px;padding-right:14px}
}
@media(max-width:900px){
 .market-workspace :is(.bag-items,.bag-details){padding:4px}
 .market-workspace .trade-inventory-filters{gap:5px}
 .market-workspace .trade-inventory-filters :is(input,select){height:28px;padding:4px;font-size:10px}
 .market-workspace .trade-pagination{min-height:33px;gap:3px}
 .market-workspace .trade-pagination button{min-width:19px;min-height:23px;font-size:12px;padding:2px 4px}
}
@media(max-width:700px){
 .bag-modal:has(.market-workspace) .sheet-head{position:relative!important}
 .bag-modal:has(.market-workspace) .sheet-head>div:first-child{flex:1}
 .bag-modal:has(.market-workspace) .sheet-head .eyebrow{min-height:17px}
 .bag-modal:has(.market-workspace) .sheet-head .panel-wallet{position:absolute;top:0;right:46px;height:22px;min-height:22px;padding:2px 6px;gap:4px}
 .bag-modal:has(.market-workspace) .sheet-head .panel-wallet b{font-size:12px}
 .bag-modal:has(.market-workspace) .sheet-head .panel-wallet small{font-size:8px}
 .bag-modal:has(.market-workspace) .sheet-head>div:first-child{display:block}
 .bag-modal:has(.market-workspace) .sheet-head .eyebrow{font-size:7px;border:0;padding:0}
 .bag-modal:has(.market-workspace) .sheet-head h2{font-size:18px;white-space:normal}
 .market-workspace .market-layout,.market-workspace .market-layout.seller-layout{gap:6px}
 .market-workspace .gear-section-title{font-size:11px;min-height:20px;gap:3px}
 .market-workspace .gear-section-title>span{font-size:8px}
 .market-workspace .market-mode-tabs{gap:3px;padding-bottom:6px;flex-wrap:wrap}
 .market-workspace .market-mode-tabs button{padding:4px;font-size:10px}
 .market-workspace .trade-inventory-filters{grid-template-columns:minmax(0,1fr);gap:4px}
 .market-workspace .market-listed{padding:4px}
 .market-workspace .market-listing-art{padding:1px}
 .market-workspace .market-listing-price{font-size:8px}
 .market-workspace .market-listing-art>small{font-size:8px;right:1px}
 .market-workspace .market-listed>.muted{font-size:9px}
 .market-workspace .market-details :is(.trade-detail-skill,p,.trade-detail-stats){font-size:12px}
 .market-workspace #market-order{grid-template-columns:1fr;gap:4px}
 .market-workspace .market-price>b{font-size:14px}
 .market-workspace .market-price small{font-size:10px}
}
body.touch-ui .bag-modal:has(.market-workspace) .sheet{width:100vw!important;max-width:100vw;height:100dvh;max-height:100dvh;padding:calc(6px + var(--st)) calc(8px + var(--sr)) calc(6px + var(--sb)) calc(8px + var(--sl))}

/* Market rules belong beneath the page title, in either market mode. */
.market-header-note{display:none}
.bag-modal:has(.market-workspace) .sheet-head>div:first-child{display:block}
.bag-modal:has(.market-workspace) .sheet-head .eyebrow{display:none}
.bag-modal:has(.market-workspace) .sheet-head h2{line-height:1.1;margin:0}
.bag-modal:has(.market-workspace) .market-header-note{display:block;margin:2px 0 0;font-size:13px;line-height:1.2;font-weight:400;letter-spacing:0;color:#c4c8b5}
.market-workspace .market-listed>.muted{display:none}
/* Seller needs quantity only. Buyer reserves full rows for large Gold totals. */
.market-workspace .market-buy-pricing{display:grid;gap:7px;padding:10px 0}
.market-workspace .market-price-row{display:grid;grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr);align-items:center;gap:8px;min-width:0}
.market-workspace .market-price-row>span{font-size:14px;color:#d7d6bf}
.market-workspace .market-price-row>strong{display:flex;justify-content:flex-end;align-items:baseline;flex-wrap:wrap;gap:4px;min-width:0;font-size:20px;line-height:1.15;font-variant-numeric:lining-nums tabular-nums;text-align:right}
.market-workspace .market-price-row>strong>span{min-width:0;max-width:100%;overflow-wrap:anywhere}
.market-workspace .market-price-row>strong>small{display:inline;font-size:11px;color:#c5c1a7}
.market-workspace .market-total-row>strong{font-size:22px;color:#ffe3a0}
.market-workspace .market-stock{color:#acb8a7;overflow-wrap:anywhere}
.market-workspace .market-stock-only{padding:8px 0}
.market-workspace #market-order input{font-variant-numeric:lining-nums tabular-nums;min-width:0}
.market-workspace[data-market-view="buyer"] #market-order{grid-template-columns:minmax(95px,.65fr) minmax(0,1fr)}
@media(max-height:550px){
 .market-workspace .market-buy-pricing{gap:3px;padding:5px 0}
 .market-workspace .market-price-row>strong,.market-workspace .market-total-row>strong{font-size:16px}
 .market-workspace .market-price-row>span{font-size:12px}
}
@media(max-width:700px){
 .market-workspace .market-price-row{grid-template-columns:minmax(0,1fr);gap:2px}
 .market-workspace .market-price-row>strong{font-size:16px}
 .market-workspace .market-price-row>span{font-size:12px}
 .market-workspace[data-market-view="buyer"] #market-order{grid-template-columns:minmax(0,1fr)}
}
@media(max-width:700px){
 .bag-modal:has(.market-workspace) .sheet-head h2{font-size:clamp(12px,4.1vw,16px)}
 .bag-modal:has(.market-workspace) .market-header-note{font-size:11px;line-height:1.15}
}

/* Keep the detail width and fit each grid to full cells. */
.bag-modal:has(.market-workspace) .sheet{height:calc(94dvh - var(--market-height-trim,0px))}
.bag-modal:has(.market-workspace[data-market-view="buyer"]) .sheet{width:var(--market-buyer-width,98vw)!important}
body.touch-ui .bag-modal:has(.market-workspace[data-market-view="buyer"]) .sheet{width:var(--market-buyer-width,100vw)!important}
.market-workspace .market-layout{height:calc(var(--equipment-panel-height,100%) - var(--market-height-trim,0px));flex-basis:calc(var(--equipment-panel-height,100%) - var(--market-height-trim,0px))}
@media(max-width:600px) and (orientation:portrait){
 body.touch-ui .bag-modal:has(.market-workspace) .sheet,body.touch-ui .bag-modal:has(.market-workspace[data-market-view="buyer"]) .sheet{height:100dvh;width:100vw!important}
 .market-workspace{justify-content:flex-start;overflow-y:auto}
 .market-workspace .market-layout,.market-workspace .market-layout.seller-layout{display:flex;flex-direction:column;flex:0 0 auto;height:auto}
 .market-workspace .market-listed{height:280px}
 .market-workspace .bag-items{height:calc(340px - var(--market-height-trim,0px));width:calc(100% - var(--market-stock-width-trim,0px))}
 .market-workspace .market-details{min-height:260px}
}
