#mobile-bottom,.mobile-page-title,.mobile-factory,.mobile-expand{display:none}
@media(max-width:700px){
 html,body{width:100%;min-height:100%;overflow-x:clip}
 .wrap,.wrap:has(.erp-desktop),.wrap:has(.order-list){height:auto;min-height:100dvh;padding:0 12px calc(86px + env(safe-area-inset-bottom))}
 #tab-body{display:block;min-width:0}.card.scroll,.card.scroll.order-list{max-height:none;min-height:0;overflow:visible}
 .topbar{padding:15px 0 8px;flex-wrap:wrap;gap:6px}.brand{font-size:18px}.topbar>.row{width:100%;gap:8px}.topbar>.row .muted{flex:1}.topbar .btn{min-height:36px}
 .tabs-wrap{display:none}.mobile-page-title{display:flex;align-items:center;justify-content:space-between;font-size:20px;font-weight:700;padding:12px 2px}
 .card{padding:12px;border-radius:15px;margin-bottom:12px;min-width:0}.card h3{margin:2px 0 12px;font-size:16px}
 .row{min-width:0;flex-wrap:wrap}.flex1{min-width:0}.btn,.btn.sm{min-height:42px;padding:8px 12px;white-space:normal;line-height:1.4}.btn:disabled{opacity:.45}
 input,select,textarea,.order-query input,.order-query select{font-size:16px;min-height:44px;max-width:100%;min-width:0}
 input[type=checkbox],input[type=radio],th.chk input,td.chk input{width:22px;height:22px;min-height:22px;flex:0 0 22px;accent-color:var(--brand)}
 .export-bar label{white-space:nowrap;display:inline-flex;gap:8px;margin:0;min-height:44px}.export-bar{gap:8px;border-top:1px solid var(--line);padding-top:10px}
 .export-bar .hint{margin:0}.export-bar .btn{font-size:13px}
 .mobile-factory-chips{display:none!important}.mobile-factory{display:block;margin:0;color:var(--muted)}.mobile-factory select{margin:4px 0 10px}
 .mobile-factory-row>.flex1{flex:0 0 100%}.mobile-factory-row>.btn{flex:1}.card:has(.mobile-factory-row)>.hint{display:none}.mobile-query summary{padding:12px 0;color:var(--brand);font-weight:600;cursor:pointer}
 .order-query{grid-template-columns:repeat(2,minmax(0,1fr));margin:0 0 10px}.order-query-keyword,.order-query>.row{grid-column:1/-1}.order-query>.row>.btn{flex:1}
 #order-amount-totals{padding:14px!important}#order-amount-totals>.row{display:grid;grid-template-columns:1fr 1fr;gap:12px!important}#order-amount-totals>.row>div:first-child{grid-column:1/-1;padding-bottom:10px;border-bottom:1px solid #b9d4c6}#order-amount-totals .muted{font-size:12px}
 #mobile-bottom{display:grid;grid-template-columns:repeat(4,1fr);position:fixed;z-index:30;bottom:0;left:0;right:0;background:rgba(255,255,255,.98);border-top:1px solid var(--line);padding:6px 8px calc(6px + env(safe-area-inset-bottom));box-shadow:0 -4px 20px #245b5208}
 #mobile-bottom button{border:0;background:none;color:var(--muted);font:inherit;font-size:12px;display:flex;align-items:center;flex-direction:column;gap:2px;min-height:50px}#mobile-bottom button>span{font-size:25px;line-height:28px}#mobile-bottom button.on{color:var(--brand);font-weight:700;background:#edf5f0;border-radius:12px}
 .mobile-welcome{background:linear-gradient(125deg,#245b52,#398574);color:white;border-radius:18px;padding:22px 18px;margin-bottom:14px}.mobile-welcome>span{font-size:12px;opacity:.8}.mobile-welcome h2{font-size:20px;margin:8px 0}.mobile-welcome p{font-size:13px;margin:0;opacity:.85}
 .mobile-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px 8px;padding:12px 0}.mobile-tile{border:0;background:none;display:flex;flex-direction:column;align-items:center;gap:9px;color:var(--ink);font:inherit;font-size:13px;min-width:0;padding:4px}.mobile-icon{height:52px;width:52px;background:#e2f0e9;color:#245b52;border-radius:17px;display:grid;place-items:center;font-size:28px}.mobile-tile:nth-child(3n+2) .mobile-icon{background:#edf0fa;color:#6176a4}.mobile-tile:nth-child(3n) .mobile-icon{background:#fff1df;color:#a97731}.mobile-sort-row{display:flex;align-items:center;gap:8px;margin:8px 0}
 /* Existing tables become labelled touch cards. No duplicated action controls. */
 .mobile-table,.mobile-table tbody,.mobile-table thead{display:block!important;width:100%!important;min-width:0!important}.mobile-table colgroup{display:none}.mobile-table .rz-handle{display:none}
 .mobile-table tr.mobile-table-head{display:block;padding:6px 0 12px}.mobile-table-head th{display:none}.mobile-table-head th:has(input[type=checkbox]){display:flex!important;align-items:center;width:auto;gap:10px;border:0}.mobile-table-head th:has(input[type=checkbox]):after{content:'全选当前结果';font-size:13px}
 .mobile-table tr.mobile-record{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;border:1px solid var(--line);border-radius:13px;padding:14px;margin:10px 0;background:white;position:relative}
 .mobile-table .mobile-record td{display:block;white-space:normal!important;overflow-wrap:anywhere;text-align:left!important;width:auto!important;min-width:0!important;max-width:none!important;border:0;padding:0;font-size:14px;background:none!important}
 .mobile-table .mobile-record td:before{content:attr(data-mobile-label);display:block;color:var(--muted);font-size:11px;font-weight:400;line-height:1.5;margin-bottom:3px}
 .mobile-table .mobile-record .chk{grid-column:1/-1;display:flex;align-items:center;min-height:28px}.mobile-table .mobile-record .chk:before{content:'选择';margin:0 8px 0 0}
 .mobile-table .mobile-record .mobile-product{grid-column:1/-1;grid-row:2;font-size:17px;font-weight:600;color:var(--brand)}.mobile-table .mobile-record .mobile-product:before{display:none}
 .mobile-table .mobile-wide{grid-column:1/-1}.mobile-table .mobile-secondary{display:none!important}.mobile-table .mobile-expanded .mobile-secondary{display:block!important}.mobile-table .mobile-expand:before{display:none}
 .mobile-table .mobile-record .note-cell{display:block;white-space:normal;max-width:none;-webkit-line-clamp:unset}.mobile-table .mobile-record .row{display:flex;flex-wrap:wrap}.mobile-table .order-open{min-height:32px;text-align:left;overflow-wrap:anywhere}.mobile-table .order-focus-row.is-current{border-color:var(--brand-2);background:#f1f8f4}.order-focus-row.is-current td:first-child{box-shadow:none}
 .mobile-table .month-row,.mobile-table .batch-row{display:flex;align-items:flex-start;border-radius:10px;gap:6px;padding:10px 6px;margin-top:12px}.mobile-table .month-row td,.mobile-table .batch-row td{border:0;padding:2px 4px;white-space:normal;min-width:0}.mobile-table .month-row td:last-child,.mobile-table .batch-row td:last-child{flex:1}.mobile-table .month-row .muted,.mobile-table .batch-row .muted{display:block;float:none!important;text-align:left!important;margin-top:4px;letter-spacing:0}.mobile-table .batch-row{background:#f3f7f5}.mobile-table .chk{flex-shrink:0}
 .order-detail{max-height:none;margin-top:10px;padding:14px}.order-detail-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
 .modal-bg{z-index:100;align-items:flex-end}.modal,.modal.batch{max-width:100%;width:100%;max-height:94dvh;padding:18px 16px calc(18px + env(safe-area-inset-bottom));border-radius:20px 20px 0 0;margin:0;overscroll-behavior:contain}.modal-actions{bottom:calc(-18px - env(safe-area-inset-bottom));margin:12px -16px calc(-18px - env(safe-area-inset-bottom));padding:12px 16px calc(16px + env(safe-area-inset-bottom));z-index:2}.modal-actions>.btn{flex:1}.modal .g2,.modal .g3{grid-template-columns:1fr}.modal .err{white-space:normal;overflow-wrap:anywhere}.modal.batch .b-body{padding:0}.modal.batch .b-picked td input{font-size:16px;min-height:42px}.modal.batch .b-results{max-height:260px}.modal label:has(input[type=checkbox]){display:flex;align-items:flex-start;gap:8px}.modal #ba-list .row{display:grid;grid-template-columns:1fr 1fr}.modal #ba-list .row input:last-child{grid-column:1/-1}
 .erp-desktop{min-height:75dvh}.erp-desk{min-width:0}.erp-main .scroll,.erp-main .ref-grid-scroll{overflow:auto}.erp-dialog{max-width:100vw}
 .login{margin:5vh auto;padding:20px}
}

@media(max-width:700px){.mobile-table .mobile-record .mobile-inline-detail:before{display:none}.mobile-inline-detail .order-detail{padding:12px 0 0;border:0;border-top:1px solid var(--line);border-radius:0}.mobile-inline-detail:has([hidden]){display:none!important}.order-detail-head>.btn{flex-shrink:0}.order-detail[hidden]{display:none!important}}
@media(max-width:700px){
 .modal.batch:not(:has(.b-body)){display:block;overflow:auto}
 .modal.batch:not(:has(.b-body)) .b-results{flex:none;min-height:50px}
 .modal.batch .modal-actions .b-summary{flex:0 0 100%}
 .modal.batch #b-err{padding-bottom:4px!important}
}

@media(max-width:700px){
 .mobile-table .mobile-record>.chk{position:absolute;right:14px;top:14px;min-height:22px}
 .mobile-table .mobile-record>.chk:before{display:none}
 .mobile-table .mobile-record>.mobile-product{grid-row:1;padding-right:34px;min-height:26px}
 .mobile-table .mobile-record>td[data-mobile-label="操作"]:before{display:none}
 .mobile-table .mobile-record>.mobile-expand{border-top:1px solid var(--line);padding-top:8px}
}
/* Dense mobile purchasing lists: the primary scan path is three short lines. */
@media(max-width:700px){
 .topbar{padding:10px 0 2px;gap:4px}.topbar .brand{font-size:17px}.topbar>.row{gap:6px}.topbar>.row .muted{font-size:12px}.topbar .btn.sm{min-height:32px;padding:4px 10px}
 .mobile-page-title{font-size:18px;padding:8px 2px}.mobile-page-title .btn{min-height:34px;padding:4px 10px;font-size:12px}
 .card{padding:10px;margin-bottom:8px}.mobile-grid{gap:10px 6px;padding:8px 0}.mobile-icon{width:44px;height:44px;border-radius:14px}.mobile-tile{gap:5px}.mobile-grid+.hint{margin:0}
 .mobile-factory{font-size:0}.mobile-factory select{margin:0 0 6px}.mobile-factory-row>.btn{min-height:38px;padding:7px 8px;font-size:13px}.mobile-query summary{padding:8px 0;font-size:13px}
 .mobile-tools{margin-top:6px}.mobile-tools>summary{padding:7px 0;cursor:pointer;color:var(--brand);font-size:12px;line-height:1.5}.mobile-tools>summary>span{margin-left:6px;font-size:11px}.mobile-tools .export-bar{margin:2px 0;padding-top:6px}.mobile-tools .export-bar .btn{min-height:38px;padding:6px 10px}
 #order-amount-totals{padding:8px 10px!important}#order-amount-totals>.row{display:block}#order-amount-totals>.row>div,#order-amount-totals>.row>div:first-child{display:flex;gap:8px;align-items:center;justify-content:space-between;grid-column:auto;border:0;padding:2px 0}#order-amount-totals br{display:none}#order-amount-totals strong{font-size:15px!important;white-space:nowrap}#order-amount-totals .muted{font-size:11px}#order-amount-totals>.hint{font-size:10px;margin-top:3px!important}
 .card.scroll:has(>.mobile-table){padding:0 8px 6px}
 .mobile-table .month-row,.mobile-table .batch-row{padding:5px 2px;margin-top:5px;border-radius:5px;align-items:center}.mobile-table .month-row .muted,.mobile-table .batch-row .muted{display:inline!important;margin-left:8px;margin-top:0;font-size:11px}.mobile-table .month-row td:last-child{font-size:12px}.mobile-table .batch-row td .btn{min-height:28px;padding:3px 6px;font-size:11px}
 .mobile-table tr.mobile-table-head{padding:0}.mobile-table-head th:has(input[type=checkbox]){padding:8px 4px;min-height:38px}

 /* A real grid column owns each checkbox; no absolute table-cell positioning. */
 .mobile-table tr.mobile-compact-record{grid-template-columns:32px minmax(0,1fr) minmax(0,1fr) 40px;grid-auto-flow:row dense;gap:0 4px;padding:4px 0 6px;margin:0;border:0;border-bottom:1px solid var(--line);border-radius:0;cursor:pointer;align-items:center}
 .mobile-table tr.mobile-compact-record>td{font-size:12px;line-height:20px;min-height:0}
 .mobile-table tr.mobile-compact-record>.chk{position:static;inset:auto;grid-column:1;grid-row:1;order:0;width:32px!important;height:36px;min-height:36px;display:flex!important;align-items:center;align-self:start;justify-content:center}
 .mobile-table tr.mobile-compact-record>.chk label{width:32px;height:36px;display:flex;align-items:center;justify-content:center;margin:0;padding:0}
 .mobile-table tr.mobile-compact-record>.chk input{margin:0;width:20px;height:20px;min-height:20px;flex:0 0 20px}
 .mobile-table tr.mobile-compact-record>.mobile-product{grid-column:2/4;grid-row:1;order:0;padding:0;font-size:14px;font-weight:600;line-height:20px;min-height:20px;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
 .mobile-table tr.mobile-compact-record>.mobile-expand{position:static;inset:auto;grid-column:4;grid-row:1;order:0;padding:0;border:0;align-self:start;display:block!important}
 .mobile-table tr.mobile-compact-record>.mobile-expand>.btn{min-height:36px;min-width:40px;padding:0;border:0;background:transparent;font-size:11px;color:var(--brand)}
 .mobile-table tr.mobile-compact-record>.chk:before,.mobile-table tr.mobile-compact-record>.mobile-product:before,.mobile-table tr.mobile-compact-record>.mobile-expand:before{display:none!important}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>td:not(.chk):not(.mobile-product):not(.mobile-primary):not(.mobile-expand){display:none!important}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>td:before{display:none}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="下单日期"],.mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="到货日期"]{grid-column:2;grid-row:2;font-size:11px;color:var(--muted)}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="质检"]{grid-column:3;grid-row:2;justify-self:end}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="状态"],.mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="结清"]{grid-column:4;grid-row:2;text-align:right!important}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="数量"]{grid-column:2;grid-row:3}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="数量"]:before{content:'数量 ';display:inline;font-size:11px;margin:0}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="数量"] .order-open{min-height:22px}
 .mobile-table tr.mobile-compact-record:not(.mobile-expanded)>[data-mobile-label="金额"]{grid-column:3/5;grid-row:3;text-align:right!important;font-weight:600;color:var(--brand)}
 .mobile-table tr.mobile-compact-record .tag{font-size:10px;line-height:18px;padding:0 5px;white-space:nowrap}
 /* Expanded records keep labels beside values; long IDs/notes get a full line. */
 .mobile-table tr.mobile-compact-record.mobile-expanded{gap:2px 4px;background:#f6faf8;padding:4px 0 6px;box-shadow:inset 2px 0 var(--brand-2)}
 .mobile-table tr.mobile-compact-record.mobile-expanded>td:where(:not(.chk):not(.mobile-product):not(.mobile-expand)){display:flex!important;grid-column:span 2;grid-row:auto;align-items:baseline;gap:3px;min-height:22px;padding:0 6px;order:7}
 .mobile-table tr.mobile-compact-record.mobile-expanded>td:before{content:attr(data-mobile-short);display:inline;flex-shrink:0;font-size:11px;line-height:20px;margin:0;color:var(--muted)}
 .mobile-table tr.mobile-compact-record.mobile-expanded>.mobile-product{display:block;overflow:visible;-webkit-line-clamp:unset}
 .mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="数量"],.mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="单价"]{order:2!important}
 .mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="金额"],.mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="已到货"]{order:3!important}
 .mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="下单日期"],.mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="到货日期"],.mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="状态"]{order:4!important}
 .mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="质检"],.mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="结清"]{order:5!important}
 .mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="订单编号"]{grid-column:1/-1!important;order:6!important;font-size:11px}
 .mobile-table tr.mobile-compact-record.mobile-expanded>[data-mobile-label="备注"]{grid-column:1/-1!important;order:8!important}
 .mobile-table tr.mobile-compact-record.mobile-expanded>td[data-mobile-label="操作"]{grid-column:1/-1!important;order:9!important;gap:6px;align-items:center;padding-top:2px}
 .mobile-table tr.mobile-compact-record.mobile-expanded>td[data-mobile-label="操作"]:before{display:none}
 .mobile-table tr.mobile-compact-record.mobile-expanded .order-open{min-height:24px;line-height:20px;padding:0;font-size:inherit}
 .mobile-table tr.mobile-compact-record.mobile-expanded .btn{min-height:34px;padding:4px 9px;font-size:12px}
 .mobile-table tr.mobile-compact-record.mobile-expanded>.mobile-expand>.btn{min-height:36px;padding:0}
 .mobile-table tr.mobile-compact-record.mobile-expanded .row{gap:6px}
 .mobile-table tr.mobile-compact-record.mobile-expanded>td.mobile-empty,.mobile-table tr.mobile-compact-record.mobile-expanded>td[data-mobile-label="序号"]{display:none!important}
 .mobile-table tr.mobile-compact-record.mobile-expanded>td.mobile-inline-detail{grid-column:1/-1!important;order:10!important;display:block!important;padding:0 6px}
 .mobile-table tr.mobile-compact-record.mobile-expanded>.mobile-inline-detail:before{display:none}
 .mobile-inline-detail .order-detail{margin-top:4px;padding-top:6px}
 .mobile-inline-detail .order-detail-fields{gap:3px 8px;margin:4px 0}
 .mobile-inline-detail .order-detail-fields>div{display:flex;gap:4px;align-items:baseline;font-size:12px}
 .mobile-inline-detail .order-detail-fields dt{font-size:11px;flex-shrink:0}
 .mobile-inline-detail .order-detail-fields dd{margin:0}
 #mobile-bottom{padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom))}#mobile-bottom button{min-height:46px}
}
