/* Touch layout; desktop worksheet remains unchanged. */
@media(max-width:700px){
 main{padding:14px 10px 30px}.page-brand{gap:10px}.page-brand .brand{font-size:14px}.page-brand .brand>span{width:32px;height:32px;font-size:20px;flex-shrink:0}
 #open-ranking-link{min-height:36px;display:inline-flex;align-items:center}
 .date-filter{padding:12px;gap:8px;margin-bottom:12px}.date-filter strong{font-size:14px;margin-right:2px}.date-filter button{min-height:40px;padding:8px 16px}.date-filter label{margin-left:0}.date-filter input{font-size:16px;max-width:100%}
 .toolbar{gap:8px;margin-bottom:12px}.toolbar input{width:100%;font-size:16px}.toolbar select{flex:1;width:0;font-size:16px}.toolbar button{min-height:44px;font-size:13px}.toolbar span{width:100%;font-size:12px}
 #notice{font-size:12px;line-height:1.6}.product-columns{display:none}
 #products .product{display:grid;grid-template-columns:80px minmax(0,1fr);gap:8px;padding:12px;align-items:start}
 #products button.photo{grid-column:1;grid-row:1/3;width:80px;height:80px;margin:0;align-self:start}
 #products .product-body{display:contents}#products .product-heading{grid-column:2;grid-row:1;gap:6px;min-width:0}
 #products .shop{flex-basis:100%;font-size:13px;overflow-wrap:anywhere}
 #products .product-detail-button,#products .product-link-button{height:auto;min-height:36px;font-size:12px;padding:7px 8px;margin:0}
 #products .shop-skus{font-size:12px;line-height:1.4}
 #products h2{grid-column:1/-1;grid-row:3;font-size:13px;line-height:1.6}
 #products .price-line{grid-column:1/-1;grid-row:4;flex-wrap:wrap;gap:10px}
 #products .product-profit-list,#products .product-profit{grid-column:1/-1;grid-row:5;width:100%}
 #products .sku-profit{display:block;padding:10px 0}#products .sku-profit:last-child{padding-bottom:0}
 #products .sku-config-card{width:100%;min-height:44px;padding:10px 12px;font-size:13px;line-height:1.6}
 #products .sku-profit-values{margin-top:10px;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;text-align:center}
 #products .sku-profit-values span{display:block;font-size:11px;margin-bottom:4px}#products .sku-profit-values strong{font-size:14px}
 body:has(#detail[open]){overflow:hidden}
 #detail{position:fixed;inset:0;margin:0;width:100%;max-width:none;height:100dvh;max-height:100dvh;border:0;border-radius:0;padding:12px;padding-bottom:max(16px,env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain}
 #detail .detail-top{position:sticky;top:-12px;z-index:3;background:#f5f7fa;padding:12px 0;gap:8px}#detail .detail-top>div{min-width:0}#detail .detail-top h2{font-size:14px;line-height:1.5}#detail .detail-top small{font-size:12px}
 #close-detail{min-width:44px;min-height:44px;flex-shrink:0}#open-product-link{min-height:36px;display:inline-flex;align-items:center}
 #detail .detail-layout{display:flex;flex-direction:column;gap:14px;margin-top:12px}#detail .config-side,#detail .profit-side{width:100%;min-width:0}
 #config-tabs{flex-wrap:nowrap;overflow-x:auto;padding-bottom:6px;scroll-snap-type:x proximity}#config-tabs button{min-width:180px;max-width:240px;flex-shrink:0;min-height:44px;font-size:13px;scroll-snap-align:start}
 #config-image-frame img{max-height:55dvh;width:100%;object-fit:contain}
 #detail .section-heading{flex-wrap:wrap}#detail .section-heading h3{font-size:14px;overflow-wrap:anywhere}#detail #selection-note{font-size:12px}
 #detail .inputs{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:10px}#detail .inputs label{font-size:11px}#detail .inputs output{font-size:17px;overflow-wrap:anywhere}
 #detail .profits{grid-template-columns:repeat(3,minmax(0,1fr))}#detail .profit-item{padding:8px 3px}#detail .profit-item span{font-size:11px}#detail .profit-item strong{font-size:16px;overflow-wrap:anywhere}
 #detail .table-scroll{border:0;overflow:visible}#detail .table-scroll table,#parts{display:block;width:100%}#detail .table-scroll thead{display:none}
 #detail #parts tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);border:1px solid #c4cfdb;border-radius:6px;margin-top:8px;overflow:hidden}
 #detail #parts td{display:block;width:auto;border:0;padding:8px!important;white-space:normal;min-width:0}
 #detail #parts td:first-child,#detail #parts td:nth-child(2){grid-column:1/-1;border-bottom:1px solid #e4e8ed}
 #detail #parts td:first-child{background:#f5f8fc}#detail .part-desc{max-width:none;overflow-wrap:anywhere}#detail .warehouse-code{font-size:13px;overflow-wrap:anywhere}
 #detail #parts td:nth-child(2)::before{content:'仓库型号与成本';display:block;color:#68768a;font-size:11px;margin-bottom:4px}
 #detail #parts td:nth-child(3)::before{content:'数量';margin-right:8px;font-size:12px;color:#68768a}
 #detail #parts td:last-child::before{content:'硬件成本';display:block;font-size:11px;color:#68768a;margin-bottom:4px}
 #detail #parts td:last-child{text-align:right;font-weight:600}#detail td input{min-height:40px;font-size:16px;width:64px}#detail .part-category{font-size:12px}
 .empty{padding:30px 16px}
}

.config-tab-short{display:none}
@media(max-width:700px){
 #detail{padding:8px;box-sizing:border-box}
 #detail .detail-top{position:relative;top:0;padding:4px 0 7px;min-height:52px;align-items:flex-start}
 #detail .detail-top>div{padding-right:134px;width:100%}
 #detail .detail-top small{font-size:10px}
 #detail .detail-top h2{font-size:11px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:3px 0 0}
 #detail #open-product-link{position:absolute;right:34px;top:3px;min-height:28px;height:28px;padding:3px 6px;font-size:11px;box-sizing:border-box}
 #detail #close-detail{position:absolute;right:0;top:3px;min-width:28px;min-height:28px;width:28px;height:28px;padding:0}
 #detail .detail-layout{gap:6px;margin-top:5px}
 #detail #config-tabs{gap:5px;padding-bottom:3px;margin-bottom:4px}
 #detail #config-tabs button{min-width:0;max-width:none;min-height:29px;padding:5px 9px;font-size:12px;white-space:nowrap}
 #detail .config-tab-full{display:none}#detail .config-tab-short{display:inline}
 #detail #config-image-frame img{max-height:clamp(100px,22dvh,190px);width:100%;object-fit:contain}
 #detail .profit-side{border:0;background:transparent;box-shadow:none}
 #detail .profit-side>.section-heading,#detail #selection-note{display:none}
 #detail #profit-calculation{padding:0}
 #detail .inputs{margin-bottom:5px}#detail .inputs label{padding:3px 2px;font-size:10px}#detail .inputs output{font-size:15px;line-height:1.3}
 #detail .profits{margin-bottom:5px}#detail .profit-item{padding:4px 2px}#detail .profit-item strong{font-size:14px}#detail .profit-item span{font-size:10px}
 #detail #profit-calculation>.section-heading{margin:3px 0;padding:0}#detail #profit-calculation>.section-heading h3{font-size:12px;margin:0}
 #detail #parts tr{grid-template-columns:40px minmax(0,1fr) 42px 65px;align-items:center;border-radius:3px;margin-top:3px;min-height:32px}
 #detail #parts td{padding:3px!important;grid-column:auto!important;border:0!important}
 #detail #parts td:first-child{background:transparent}
 #detail #parts .part-desc,#detail #parts td:nth-child(2)>.good,#detail #parts td:nth-child(2)>.warn{display:none}
 #detail #parts td::before{display:none!important}
 #detail #parts .warehouse-code{font-size:11px;line-height:1.25;white-space:normal;overflow-wrap:anywhere}
 #detail #parts .part-category{padding:1px 2px;font-size:10px}
 #detail #parts td input{width:36px;min-height:26px;height:26px;padding:2px;font-size:12px;box-sizing:border-box}
 #detail #parts td:last-child{font-size:12px;white-space:nowrap}
}

.mobile-part-quantity{display:none}@media(max-width:700px){#detail #parts td input[data-quantity]{display:none}#detail #parts .mobile-part-quantity{display:inline;font-size:12px;white-space:nowrap}#detail #parts td:nth-child(3){text-align:center}}

@media(max-width:700px){
 #products .sku-profit{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:7px;align-items:center;padding:8px 0}
 #products .sku-config-card{min-width:0;min-height:44px;height:100%;padding:7px 6px;font-size:11px;line-height:1.5;overflow-wrap:anywhere;text-align:left}
 #products .sku-profit-values{margin:0;min-width:0;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;align-items:center}
 #products .sku-profit-values>div{min-width:0}
 #products .sku-profit-values span{font-size:9px;margin-bottom:4px;white-space:nowrap}
 #products .sku-profit-values strong{font-size:11px;white-space:nowrap;font-variant-numeric:tabular-nums}
}
@media(max-width:350px){#products .sku-profit{grid-template-columns:minmax(0,1fr) minmax(0,1.8fr);gap:4px}#products .sku-profit-values strong{font-size:10px}}

@media(max-width:700px){#products .product-mobile-media{grid-column:1;grid-row:1/3;display:flex;flex-direction:column;gap:7px;align-items:stretch;min-width:0}#products .product-mobile-media button.photo{width:80px;height:80px}#products .product-mobile-media .history-button{margin:0;width:80px;padding:5px 2px;min-height:30px;font-size:11px;box-sizing:border-box}}

@media(max-width:700px){
 .date-filter{flex-wrap:nowrap;gap:4px;padding:8px 6px;min-width:0}
 .date-filter strong{font-size:11px;white-space:nowrap;margin:0;flex:none}
 .date-filter button{font-size:12px;min-height:32px;padding:5px 7px;white-space:nowrap;flex:none}
 .date-filter label{font-size:10px;white-space:nowrap;margin:0;flex:none}
 .date-filter #capture-date{width:0;min-width:0;flex:1;font-size:11px;padding:5px 2px;min-height:32px}
 .date-filter #capture-batch:not([hidden]){width:60px;min-width:0;font-size:10px;padding:3px}
}

#mobile-back-list{display:none}@media(max-width:700px){#detail #mobile-back-list{display:block;width:100%;min-height:34px;margin:8px 0 0;padding:6px 12px;background:#2b5e94;border-color:#2b5e94;color:#fff;font-size:13px}}

@media(max-width:380px){.date-filter{gap:3px;padding:7px 4px}.date-filter button{padding:5px;font-size:11px}.date-filter label[for="capture-date"]{display:none}.date-filter #capture-date{font-size:11px}}

@media(max-width:700px){#detail #config-image-frame{cursor:zoom-in}#detail #config-image-frame.inline-expanded{cursor:zoom-out}#detail #config-image-frame.inline-expanded img{max-height:none;width:100%;height:auto;object-fit:contain}#detail #config-image-frame:focus-visible{outline:2px solid #2563eb;outline-offset:2px}}

@media(max-width:700px){#shop,#refresh-data,#result-count,#notice{display:none!important}.toolbar{margin-bottom:10px}}
