:root{font-family:Inter,"PingFang SC","Microsoft YaHei",sans-serif;color:#102847;background:#f6f8fc;font-synthesis:none;--blue:#2674e8;--orange:#e78900;--line:#dce4ef;--muted:#718099;--green:#17864d}*{box-sizing:border-box}body{margin:0;background:#f6f8fc}button,input{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.48}.hidden{display:none!important}header{height:70px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 34px;position:fixed;inset:0 0 auto;z-index:10}.brand{font-size:20px;font-weight:800}.brand span{color:var(--orange)}.header-note{font-size:13px;color:var(--muted)}.text-button{border:0;background:none;color:var(--blue);margin-left:12px}aside{position:fixed;top:70px;bottom:0;width:230px;background:#fff;border-right:1px solid var(--line);padding:28px 14px}.nav{display:flex;width:100%;gap:14px;align-items:center;border:0;background:transparent;padding:15px 18px;border-radius:10px;color:#304b70;font-weight:700;font-size:15px;margin-bottom:8px}.nav.active{color:#1c6bd8;background:#eaf2ff}main{margin:70px 0 0 230px;padding:38px;max-width:1640px}.title-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:25px}.title-row h1{font-size:32px;margin:0 0 7px}.title-row p,.panel-title p{margin:0;color:var(--muted)}.actions{display:flex;gap:12px}.primary,.secondary{height:46px;border-radius:10px;padding:0 22px;font-weight:800;border:1px solid}.primary{background:var(--orange);border-color:var(--orange);color:#fff}.secondary{background:#fff;border-color:#b9cbe4;color:#246fd4}.wide{width:100%}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px}.stats article{background:#fff;border:1px solid var(--line);border-radius:14px;padding:24px}.stats small{display:block;color:var(--muted);font-weight:700;margin-bottom:12px}.stats strong{font-size:31px;letter-spacing:-1px}.stats span{font-weight:700;margin-left:5px}.profit-card strong{color:var(--orange)}.panel{background:#fff;border:1px solid var(--line);border-radius:14px;margin-bottom:18px;overflow:hidden}.panel-title{padding:20px 22px;border-bottom:1px solid var(--line)}.panel-title h2,.mobile-panel-title h2{font-size:17px;margin:0 0 4px}.balance-grid{display:grid;grid-template-columns:repeat(4,1fr)}.balance{padding:20px;border-right:1px solid var(--line)}.balance:last-child{border-right:0}.balance small{display:block;color:var(--muted);font-weight:700}.balance strong{display:block;font-size:22px;margin:7px 0}.balance em{font-size:12px;color:var(--muted);font-style:normal}.mobile-panel-title{display:none}.products{display:table;width:100%;border-collapse:collapse}.product-row{display:table-row}.product-row>span{display:table-cell;padding:17px 20px;border-bottom:1px solid var(--line);vertical-align:middle}.product-row.header{font-size:13px;color:#52657f;font-weight:800;background:#fbfcfe}.product-row:last-child>span{border-bottom:0}.product-name{font-weight:800}.stock-good,.stock-low{padding:5px 11px;border-radius:30px;font-weight:800;font-size:12px}.stock-good{background:#e4f5ea;color:var(--green)}.stock-low{background:#fff2db;color:#bb6900}.money-profit{color:#c66d00;font-weight:800}.sales-list{display:grid;gap:12px}.sale-record{background:#fff;border:1px solid var(--line);border-radius:13px;padding:18px 21px;display:grid;grid-template-columns:130px 1fr 140px 130px;align-items:center;gap:14px}.sale-record strong{font-size:18px}.sale-record small{color:var(--muted)}.backdrop{position:fixed;inset:0;background:#10284766;z-index:30}.drawer{position:fixed;z-index:31;right:0;top:0;bottom:0;width:min(760px,95vw);background:#fff;box-shadow:-18px 0 45px #17365a22}.drawer-form{height:100%;display:flex;flex-direction:column}.drawer-head{padding:22px 26px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}.drawer-head h2{margin:0 0 4px}.drawer-head p{margin:0;color:var(--muted);font-size:13px}.close{border:0;background:none;font-size:31px;color:#72829a}.drawer-scroll{padding:20px 26px;overflow:auto;flex:1}.field{display:grid;gap:7px;font-weight:800;font-size:14px}.field input{height:48px;border:1px solid #b9c8da;border-radius:9px;padding:0 13px}.section-label{display:flex;justify-content:space-between;margin:18px 0 8px;font-size:14px;font-weight:800}.section-label b{color:var(--muted)}.sale-products{border:1px solid var(--line);border-radius:11px;overflow:hidden}.sale-product{display:grid;grid-template-columns:34px 1fr 90px 100px;align-items:center;padding:12px;border-bottom:1px solid var(--line);gap:8px}.sale-product:last-child{border-bottom:0}.sale-product.selected{background:#f0f6ff}.sale-product input[type=checkbox]{width:22px;height:22px;accent-color:var(--orange)}.sale-product .name{font-weight:800}.sale-product .stock{color:var(--muted);font-size:13px}.qty{height:39px;border:1px solid #c6d2e1;border-radius:9px;width:100%;padding:0 10px}.checkout-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:17px}.checkout-grid fieldset{border:0;padding:0;margin:0}.checkout-grid legend,.upload>span{font-size:14px;font-weight:800;margin-bottom:8px}.payment-methods{display:flex;gap:7px}.payment-methods input{position:absolute;opacity:0}.payment-methods span{display:flex;height:44px;align-items:center;padding:0 14px;border:1px solid var(--line);border-radius:9px;font-weight:800}.payment-methods input:checked+span{border-color:#6ca7fb;background:#eef5ff;color:#1968d4}.upload{display:grid;grid-template-columns:1fr auto}.upload input{display:none}.upload b{grid-column:1/-1;border:1px dashed #b8c9de;border-radius:9px;height:44px;display:flex;align-items:center;padding:0 13px;color:#326ab0}.upload small{color:var(--muted);font-weight:400}.sale-summary{border:1px solid var(--line);border-radius:11px;margin-top:16px;padding:14px 18px}.sale-summary>div{display:flex;justify-content:space-between;padding:5px}.sale-summary .total-row strong{font-size:22px}.sale-summary .profit strong{color:var(--orange)}.drawer-actions{border-top:1px solid var(--line);padding:14px 26px;display:grid;grid-template-columns:1fr 1.5fr;gap:12px}.error{color:#d83b2d;font-size:13px;min-height:20px;margin-top:8px}.toast{position:fixed;z-index:60;left:50%;bottom:28px;transform:translateX(-50%);background:#153252;color:#fff;border-radius:9px;padding:12px 18px}.login-shell{position:fixed;inset:0;display:grid;place-items:center;background:linear-gradient(145deg,#eef4fd,#fff);padding:20px}.login-card{background:#fff;width:min(390px,100%);border:1px solid var(--line);border-radius:18px;padding:35px;box-shadow:0 22px 65px #16345b18;text-align:center}.brand-mark{font-size:36px;color:var(--orange)}.login-card h1{margin:9px 0}.login-card p{color:var(--muted);margin-bottom:24px}.login-card label{text-align:left;display:grid;gap:8px;font-weight:800}.login-card input{height:48px;border:1px solid #bdcadc;border-radius:9px;padding:0 12px;margin-bottom:16px}.mobile-nav{display:none}
@media(max-width:800px){body{padding-bottom:75px}header{height:58px;padding:0 16px}.brand{font-size:17px}.header-note{font-size:0}.header-note .text-button{font-size:13px}aside{display:none}main{margin:58px 0 0;padding:18px 14px}.title-row{margin-bottom:16px}.title-row h1{font-size:25px}.title-row p{font-size:13px}.title-row .actions,.title-row>button{display:none}.stats{grid-template-columns:1fr 1fr;gap:10px}.stats article{padding:16px}.stats small{margin-bottom:7px}.stats strong{font-size:23px}.balance-grid{grid-template-columns:1fr 1fr}.balance{padding:15px;border-bottom:1px solid var(--line)}.balance strong{font-size:18px}.panel-title{padding:16px}.table-panel{border:0;background:transparent;overflow:visible}.mobile-panel-title{display:flex;justify-content:space-between;align-items:center;margin:20px 2px 10px}.mobile-panel-title h2{margin:0}.mobile-panel-title span{font-size:12px;color:var(--muted)}.products{display:grid;gap:9px}.product-row.header{display:none}.product-row{display:grid;background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px;grid-template-columns:1fr auto;gap:7px}.product-row>span{display:block;border:0;padding:0}.product-row .col-status{grid-column:2;grid-row:1}.product-row .col-stock:before{content:"库存 ";color:var(--muted)}.product-row .col-price:before{content:"售价 ";color:var(--muted)}.product-row .col-cost,.product-row .col-profit{display:none}.sales-list{gap:9px}.sale-record{grid-template-columns:1fr auto;padding:15px}.sale-record .items{grid-column:1/-1}.sale-record .method{display:none}.mobile-nav{position:fixed;z-index:20;display:grid;grid-template-columns:1fr 1fr 1fr;inset:auto 0 0;background:#fff;border-top:1px solid var(--line);padding:7px 12px calc(7px + env(safe-area-inset-bottom))}.mobile-nav button{border:0;background:none;color:#65768e;display:grid;place-items:center;gap:2px;font-weight:800;font-size:18px}.mobile-nav span{font-size:11px}.mobile-nav .active{color:var(--blue)}.mobile-nav .sell-button{color:var(--orange)}.drawer{width:100vw}.drawer-head{padding:16px}.drawer-scroll{padding:14px 14px 205px}.sale-product{grid-template-columns:28px 1fr 67px 70px;padding:11px 9px}.sale-product .stock{font-size:12px}.checkout-grid{grid-template-columns:1fr}.payment-methods{display:grid;grid-template-columns:repeat(4,1fr)}.payment-methods span{justify-content:center;padding:0 5px;font-size:13px}.upload{display:block}.upload>span,.upload b,.upload small{display:block}.upload b{margin-top:8px;height:44px}.upload small{margin-top:5px}.sale-summary{position:absolute;z-index:2;left:14px;right:14px;bottom:72px;background:#fff;border:2px solid #f0a334;padding:12px 14px;box-shadow:0 -7px 20px #17365a10}.sale-summary .private-row{display:none}.sale-summary .total-row{align-items:center}.sale-summary .total-row span{font-size:16px;font-weight:800}.sale-summary .total-row strong{font-size:27px;color:var(--orange)}.drawer-actions{position:absolute;z-index:3;bottom:0;left:0;right:0;background:#fff;padding:10px 14px calc(10px + env(safe-area-inset-bottom));grid-template-columns:1fr 2fr}.profit-card{display:none}}
.sale-product{grid-template-columns:34px minmax(0,1fr) 90px 132px}.quantity-stepper{display:grid;grid-template-columns:44px 40px 44px;align-items:center;border:1px solid #c6d2e1;border-radius:10px;overflow:hidden;background:#fff}.quantity-stepper button{width:44px;height:44px;border:0;background:#f4f7fb;color:#176bd6;font-size:23px;font-weight:800}.quantity-stepper button:disabled{color:#aab5c4;background:#f8fafc}.qty-value{display:grid;place-items:center;height:44px;font-weight:800;border-inline:1px solid #dce4ef}@media(max-width:800px){.sale-product{grid-template-columns:28px minmax(0,1fr) 74px 128px}}
.order-preview{position:absolute;z-index:5;inset:0;background:#fff;display:flex;flex-direction:column}.order-preview-body{flex:1;overflow:auto;padding:22px 26px}.order-meta{display:flex;gap:28px;padding:15px 17px;background:#f5f8fc;border-radius:11px;color:var(--muted);font-size:14px}.order-meta strong{color:#102847;margin-left:6px}.order-lines{border:1px solid var(--line);border-radius:12px;margin-top:18px;overflow:hidden}.order-line{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:17px;border-bottom:1px solid var(--line)}.order-line:last-child{border-bottom:0}.order-line div{display:grid;gap:5px}.order-line small{color:var(--muted)}.order-grand-total{display:flex;align-items:center;justify-content:space-between;margin-top:18px;border:2px solid #f0a334;border-radius:12px;padding:19px;font-weight:800}.order-grand-total strong{font-size:27px;color:var(--orange)}.order-note{color:var(--muted);font-size:13px}.order-preview-actions{border-top:1px solid var(--line);padding:14px 26px;display:grid;grid-template-columns:1fr 1.5fr;gap:12px}@media(max-width:800px){.order-preview-body{padding:16px 14px 105px}.order-meta{display:grid;gap:8px}.order-line{padding:15px 13px}.order-grand-total{padding:17px 14px}.order-preview-actions{position:absolute;z-index:3;bottom:0;left:0;right:0;background:#fff;padding:10px 14px calc(10px + env(safe-area-inset-bottom));grid-template-columns:1fr 2fr}.order-preview-actions button{min-height:54px}}
.receipt-grid{grid-template-columns:1fr}.order-payment{border:0;padding:0;margin:18px 0 0}.order-payment legend{font-size:14px;font-weight:800;margin-bottom:8px}@media(max-width:800px){.order-payment{margin-top:14px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#fff}.order-payment .payment-methods span{min-height:46px}}
.discount-option{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:5px 5px 10px;border-bottom:1px solid var(--line);cursor:pointer}.discount-option>span{display:flex;align-items:center;gap:9px}.discount-option input{width:22px;height:22px;margin:0;accent-color:var(--orange)}.discount-option small{color:var(--muted);font-weight:400}.sale-summary .discount-detail,.order-discount-detail{display:flex;align-items:center;justify-content:space-between;color:#b96800;font-weight:700}.sale-summary .discount-detail{padding-top:11px}.order-discount-detail{margin-top:18px;padding:13px 17px;border:1px solid #f0c783;border-radius:11px;background:#fffaf2}.order-discount-detail+ .order-grand-total{margin-top:10px}@media(max-width:800px){.discount-option{min-height:50px;padding:2px 2px 10px}.discount-option small{font-size:11px;text-align:right}.order-discount-detail{margin-top:14px}}
.purchase-summary{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:14px;padding:15px 17px;border:1px solid var(--line);border-radius:12px;background:#f8faff}.purchase-summary span{display:grid;gap:5px;color:var(--muted);font-size:13px;font-weight:700}.purchase-summary strong{color:#102847;font-size:20px}.purchase-summary span:last-child{text-align:right}.purchase-upload{margin-top:14px}

/* Wide-screen shell copied from the original localhost inventory app. */
.desktop-brand-icon,.desktop-header-copy{display:none}.purchase-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.purchase-products{border:1px solid var(--line);border-radius:10px;overflow:hidden}.purchase-product{display:grid;grid-template-columns:minmax(150px,1fr) 100px 130px;gap:12px;align-items:end;padding:11px 13px;border-bottom:1px solid var(--line)}.purchase-product:last-child{border-bottom:0}.purchase-product>div{display:grid;gap:4px}.purchase-product strong{font-size:13px}.purchase-product small{color:var(--muted)}.purchase-product label{display:grid;gap:4px;color:#526278;font-size:11px;font-weight:700}.purchase-product input{height:38px;width:100%;border:1px solid #cbd5e1;border-radius:8px;padding:0 9px;color:#0d2345}.purchase-upload{margin-top:16px}.restock-details{white-space:normal;min-width:260px;line-height:1.55}.stock-pending{display:inline-flex;padding:4px 9px;border-radius:999px;background:#fff2d9;color:#a86000;font-size:11px}.restock-stocked-date{display:block;margin-top:4px;color:var(--muted)}.restock-actions{display:flex;align-items:center;gap:8px}.restock-actions .primary.compact,.restock-actions .secondary.compact{height:34px;min-height:34px;padding:0 12px}.secondary.danger{border-color:#e7a4a4;color:#b42318;background:#fff8f7}.desktop-file-link[type=button]{border:0;padding:0;background:transparent;font:inherit;cursor:pointer}
.restock-item-identity{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.restock-item-toggle{height:28px;min-height:28px;width:max-content;padding:0 9px;font-size:11px}.purchase-product.removing{background:#fff8f7}.purchase-product.removing strong,.purchase-product.removing label{color:#8a6570}.restock-item-state{color:#b42318!important}

@media(min-width:801px){
  :root{--line:#dbe2ea;--muted:#66758d;--orange:#df8500;--blue:#1768d5}
  body{background:#f7f9fc;font-family:"PingFang SC","Microsoft YaHei",system-ui,-apple-system,sans-serif;font-size:13px;color:#0d2345;padding:0}
  header{height:62px;padding:0 28px;border-color:#dbe2ea;box-shadow:none}
  .brand{gap:14px;font-size:20px;letter-spacing:-.02em;color:#0d2345}.brand img{display:none}.brand .desktop-brand-icon{display:grid;width:30px;height:30px;place-items:center;color:#0d2345}.desktop-brand-icon svg{width:22px;height:22px}
  .header-note{display:flex;align-items:center;gap:12px;color:#66758d;font-size:12px}.desktop-header-copy{display:inline}.mobile-header-copy{display:none}.header-note .text-button{margin-left:0}
  aside{top:62px;width:236px;padding:24px 12px;border-color:#dbe2ea}.nav{min-height:48px;margin:0 0 8px;padding:14px 16px;border-radius:10px;gap:12px;font-size:14px;font-weight:500;color:#263a57}.nav.active{background:#e9f1ff;color:#1768d5;font-weight:700}.nav-svg{width:20px;height:20px;flex:none}
  main{margin:62px 0 0 236px;padding:24px clamp(20px,2.7vw,42px) 36px;max-width:none;min-width:0}main>section{max-width:1220px;margin:0 auto}
  .title-row{align-items:center;gap:16px;margin-bottom:20px}.title-row h1{font-size:clamp(24px,2.6vw,32px);letter-spacing:-.035em;margin:0}.title-row p{margin:7px 0 0;font-size:13px;color:#66758d}.actions{gap:12px}
  .primary,.secondary{min-height:44px;height:44px;padding:0 18px;border-radius:9px;font-size:13px;font-weight:700}.primary{background:#df8500;border-color:#df8500}.secondary{background:#fff;border-color:#cbd5e1;color:#0d2345}.secondary.amber-outline{border-color:#df8500;color:#b96800}.secondary.desktop-replenish{border-color:#9dbce8;color:#1768d5;background:#f5f9ff}.secondary.compact{min-height:36px;height:36px;padding:0 13px}
  .stats{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:18px}.stats article{padding:18px 20px;border-radius:12px;border-color:#dbe2ea;min-width:0}.stats small{font-size:12px;font-weight:400;color:#526278;margin-bottom:7px}.stats strong{font-size:clamp(22px,2.1vw,29px);letter-spacing:-.035em}.stats span{font-size:12px;margin-left:5px}.profit-card strong{color:#b96800}
  .panel{border-color:#dbe2ea;border-radius:12px;margin-bottom:14px}.panel-title{display:flex;justify-content:space-between;align-items:center;padding:14px 18px;border-color:#dbe2ea}.panel-title h2{font-size:15px;margin:0}.panel-title p{font-size:12px;margin:4px 0 0}
  .balances{margin-bottom:14px}.balance-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.balance{padding:15px 18px;border-color:#dbe2ea}.balance small{font-size:12px}.balance strong{font-size:19px;margin:5px 0}.balance em{font-size:11px}
  .products{display:table}.product-row>span{padding:13px 16px;border-color:#dbe2ea}.product-row.header{background:#fbfcfe;font-size:12px;color:#40516a}.stock-good,.stock-low{font-size:11px;padding:4px 9px}.inventory-sort{border:0;background:transparent;color:inherit;font-weight:700;padding:0}.inventory-sort b{color:#1768d5;font-size:13px}
  .recent-purchases{margin-top:14px}.activity-list{display:grid}.activity-row{display:grid;grid-template-columns:100px minmax(90px,.65fr) minmax(180px,1.35fr) auto;gap:14px;align-items:center;padding:13px 18px;border-bottom:1px solid #dbe2ea}.activity-row:last-child{border-bottom:0}.activity-row>span:first-child{color:#66758d}.activity-row>span:nth-child(3){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#526278}
  .desktop-table-wrap{overflow:auto}.desktop-table-wrap table{width:100%;min-width:1020px;border-collapse:collapse}.desktop-table-wrap th,.desktop-table-wrap td{padding:13px 16px;text-align:left;white-space:nowrap;border-bottom:1px solid #dbe2ea}.desktop-table-wrap th{font-size:12px;color:#40516a;background:#fbfcfe}.desktop-table-wrap td{font-size:13px;color:#263a57}.desktop-table-wrap td.name{color:#0d2345;font-weight:700}.desktop-table-wrap td.profit{color:#b96800;font-weight:700}.desktop-table-wrap tbody tr:last-child td{border-bottom:0}.desktop-file-link{display:inline-flex;align-items:center;gap:7px;color:#1768d5;font-weight:700;text-decoration:none;max-width:100%}.desktop-file-link:hover{text-decoration:underline}.file-icon{width:17px;height:17px;flex:none}.desktop-missing{color:#66758d}.payment-badge{display:inline-flex;padding:4px 9px;border-radius:999px;font-size:11px;font-weight:700;background:#eef2f7;color:#526278}.payment-badge.cash{background:#e6f6ec;color:#187847}.payment-badge.wechat{background:#e8f7eb;color:#12813d}.payment-badge.alipay{background:#e9f1ff;color:#1768d5}.payment-badge.bbva{background:#f0ecff;color:#5a45a5}
  .desktop-table-wrap .restock-table{min-width:1160px;table-layout:fixed}.restock-table th:nth-child(1){width:120px}.restock-table th:nth-child(2){width:105px}.restock-table th:nth-child(3){width:70px}.restock-table th:nth-child(4){width:120px}.restock-table th:nth-child(5){width:105px}.restock-table th:nth-child(6){width:80px}.restock-table th:nth-child(8){width:225px}.restock-table .restock-details{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.45}.restock-table .restock-actions{white-space:nowrap}
  .mobile-sales-list{display:none}.mobile-nav{display:none}.desktop-only{display:block}.purchase-metrics{margin-bottom:18px}
  .drawer{width:min(760px,95vw)}.drawer-head{padding:15px 20px}.drawer-head h2{font-size:18px}.drawer-scroll{padding:14px 20px}.drawer-actions{padding:10px 20px 12px}.sale-products{max-height:min(390px,45vh);overflow:auto}.sale-product{padding:9px 12px;min-height:54px}.sale-summary{padding:11px 14px}.order-preview-body{padding:22px 26px}
}

@media(max-width:800px){.desktop-only,.desktop-nav-only,.desktop-header-copy,.purchase-drawer{display:none!important}.mobile-header-copy{display:inline}.desktop-brand-icon{display:none}.recent-purchases{display:none}.purchase-fields{grid-template-columns:1fr}.purchase-product{grid-template-columns:1fr 70px 100px}}

/* Mobile inventory is a compact three-column operational table. */
@media(max-width:800px){
  #dashboardView .table-panel{background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden}
  #dashboardView .mobile-panel-title{margin:0;padding:14px;border-bottom:1px solid var(--line)}
  #dashboardView .products{display:grid;gap:0;background:#fff}
  #dashboardView .product-row,#dashboardView .product-row.header{display:grid;grid-template-columns:minmax(0,1.5fr) 72px minmax(95px,1fr);align-items:center;gap:10px;padding:12px 14px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:#fff}
  #dashboardView .product-row.header{padding-block:9px;background:#f8fafc;color:var(--muted);font-size:12px;font-weight:800}
  #dashboardView .product-row:last-child{border-bottom:0}
  #dashboardView .product-row>span{padding:0;border:0;min-width:0}
  #dashboardView .product-row .col-status,#dashboardView .product-row .col-cost,#dashboardView .product-row .col-profit{display:none}
  #dashboardView .product-row .col-stock:before,#dashboardView .product-row .col-price:before{content:none}
  #dashboardView .product-row .col-stock{text-align:center;white-space:nowrap}
  #dashboardView .product-row .col-price{text-align:right;white-space:nowrap}
  #dashboardView .product-row.header>span:nth-child(3),#dashboardView .product-row.header>span:nth-child(5),#dashboardView .product-row.header>span:nth-child(6){display:none}
  #dashboardView .product-row.header>span:nth-child(2){text-align:center}
  #dashboardView .product-row.header>span:nth-child(4){text-align:right}
  #dashboardView .inventory-sort{font-size:12px}
}

/* Mobile sales history matches the compact inventory table density. */
@media(max-width:800px){
  #salesView>.title-row{margin-bottom:12px}
  #salesView .mobile-sales-list{display:grid;gap:0;background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden}
  #salesView .sale-record{grid-template-columns:58px minmax(0,1fr) 90px;align-items:center;gap:8px;margin:0;padding:9px 10px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:#fff}
  #salesView .sale-record:last-child{border-bottom:0}
  #salesView .sale-record-header{min-height:34px;padding-block:8px;background:#f8fafc;color:var(--muted);font-size:12px;font-weight:800}
  #salesView .sale-record-header span:last-child{text-align:right}
  #salesView .sale-date{min-width:0}
  #salesView .sale-date strong{font-size:13px;white-space:nowrap}
  #salesView .sale-record .items{grid-column:auto;font-size:13px;line-height:1.25;min-width:0}
  #salesView .sale-record .method{display:none}
  #salesView .sale-amount{font-size:13px;text-align:right;white-space:nowrap}
}

/* Mobile checkout stays above the persistent app navigation. */
@media(max-width:800px){
  :root{--mobile-nav-height:68px}
  html,body{overflow-x:hidden}
  body{padding-bottom:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom))}
  .mobile-nav{z-index:50;height:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));min-height:0}
  .drawer{bottom:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));height:auto}
  .drawer-scroll{padding:14px 14px 96px}
  .sale-summary{position:static;margin-top:14px;padding:14px 16px;border-radius:14px;box-shadow:none;background:#fffaf2}
  .sale-summary .total-row{min-height:52px;padding:4px 2px;gap:14px}
  .sale-summary .total-row strong{font-size:clamp(25px,8vw,32px);line-height:1.1;text-align:right;white-space:nowrap}
  .checkout-grid{gap:12px}
  .upload{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#f8faff}
  .upload>span{display:block;margin:0;font-weight:800}
  .upload small{display:block;margin:0;color:var(--muted);text-align:right}
  .upload b{display:flex;grid-column:1/-1;height:48px;margin-top:7px;align-items:center;justify-content:center;border:1px dashed #9fb6d2;border-radius:10px;background:#fff;color:#246fd4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .drawer-actions{padding-bottom:10px}
}

/* Mobile sale selector uses the same dense, single-table rhythm as inventory. */
@media(max-width:800px){
  #saleDrawer.mobile-page-active:not(.order-review-active) .section-label{min-height:28px;margin:0 0 5px;font-size:13px;align-items:center}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-products{max-height:none;overflow:hidden;border-radius:12px;background:#fff}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product{grid-template-columns:20px minmax(0,1fr) 72px 120px;min-height:52px;padding:4px 8px;gap:6px;background:#fff}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product.selected{background:#f0f6ff}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product-copy{display:block;min-width:0;line-height:1}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product input[type=checkbox]{width:20px;height:20px;margin:0}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product .name{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:1.15}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product .stock{font-size:11px;line-height:1.1;text-align:right;white-space:nowrap}
  #saleDrawer.mobile-page-active:not(.order-review-active) .quantity-stepper{grid-template-columns:44px 32px 44px;height:44px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .quantity-stepper button{width:44px;height:44px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .qty-value{height:44px}
}

@media(max-width:360px){
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product{grid-template-columns:18px minmax(0,1fr) 64px 112px;padding-inline:7px;gap:5px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product input[type=checkbox]{width:18px;height:18px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-product .stock{font-size:10px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .quantity-stepper{grid-template-columns:40px 32px 40px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .quantity-stepper button{width:40px}
  .sale-summary .total-row strong{font-size:25px}
}

/* On phones, sale entry is a first-class tab page instead of an overlay. */
@media(max-width:800px){
  body.mobile-sale-active .app{height:58px}
  body.mobile-sale-active main{display:none}
  #saleDrawer.mobile-page-active{position:relative;z-index:auto;inset:auto;width:100%;min-height:calc(100dvh - 58px - var(--mobile-nav-height) - env(safe-area-inset-bottom));box-shadow:none;background:#f6f8fc}
  #saleDrawer.mobile-page-active .drawer-form{height:auto;min-height:inherit}
  #saleDrawer.mobile-page-active .drawer-head{padding:18px 14px 12px;border-bottom:0;background:#f6f8fc}
  #saleDrawer.mobile-page-active .drawer-head h2{font-size:25px;letter-spacing:-.03em}
  #saleDrawer.mobile-page-active .drawer-head p{font-size:13px}
  #saleDrawer.mobile-page-active .drawer-head .close{display:none}
  #saleDrawer.mobile-page-active .drawer-scroll{flex:none;overflow:visible;padding:8px 14px 98px}
  #saleDrawer.mobile-page-active .drawer-actions{position:fixed;bottom:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));z-index:45}
  #saleDrawer.mobile-page-active .drawer-actions [data-close]{display:none}
  #saleDrawer.mobile-page-active .drawer-actions{grid-template-columns:1fr}
  #saleDrawer.mobile-page-active .order-preview{position:fixed;top:58px;bottom:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));height:auto}
  #saleDrawer.mobile-page-active .order-preview .close{display:block}
}

/* Order review is the second page state of the mobile sale tab. */
@media(max-width:800px){
  #saleDrawer.mobile-page-active.order-review-active .drawer-form{display:none}
  #saleDrawer.mobile-page-active .order-preview{position:relative;z-index:auto;inset:auto;width:100%;min-height:inherit;background:#f6f8fc}
  #saleDrawer.mobile-page-active .order-preview>.drawer-head{padding:18px 14px 12px}
  #saleDrawer.mobile-page-active .order-preview>.drawer-head .close{display:none}
  #saleDrawer.mobile-page-active .order-preview-body{flex:none;overflow:visible;padding:8px 14px 98px}
  #saleDrawer.mobile-page-active .order-preview-actions{position:fixed;z-index:45;left:0;right:0;bottom:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));padding:10px 14px;background:#fff}
}

/* Mobile task order: stock before balances; products, date and receipt before review. */
@media(max-width:800px){
  #dashboardView{display:flex;flex-direction:column}
  #dashboardView>.table-panel{order:1}
  #dashboardView>.title-row{order:2;margin-top:20px}
  #dashboardView>.stats{order:3;grid-template-columns:1fr 1fr}
  #dashboardView .inventory-cost-card{display:none}
  #dashboardView>.balances{order:4}
  #dashboardView>.recent-purchases{order:5}
  #saleDrawer.mobile-page-active:not(.order-review-active) .drawer-form>.drawer-head{display:none}
  #saleDrawer.mobile-page-active:not(.order-review-active) .drawer-scroll{display:flex;flex-direction:column;padding-top:14px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .section-label{order:1;margin:0 0 8px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-products{order:2}
  #saleDrawer.mobile-page-active:not(.order-review-active) .checkout-grid{display:contents}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-date-field{order:3;margin-top:12px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .checkout-grid>.upload{order:4;margin-top:12px}
  #saleDrawer.mobile-page-active:not(.order-review-active) .sale-summary{order:5}
  #saleDrawer.mobile-page-active:not(.order-review-active) #saleError{order:6}
  .sale-date-control{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:center;margin-top:8px}
  .sale-date-control>b{display:grid;place-items:center;min-width:62px;height:48px;padding:0 10px;border-radius:10px;background:#eaf2ff;color:#1768d5;font-size:14px;white-space:nowrap}
  .sale-date-control>input{margin:0;min-width:0;width:100%}
}

/* 销售明细独立滚动，冻结表头和合计行。 */
#salesView{height:calc(100dvh - 102px);display:flex;flex-direction:column;min-height:0}
#salesView .title-row{flex:none;flex-wrap:wrap;gap:12px}
#salesView .title-row h1{margin-bottom:0}
.sales-panel{display:flex;flex-direction:column;flex:1;min-height:0;margin-bottom:0}
.sales-panel .panel-title{flex:none}
.sales-panel .desktop-table-wrap{flex:1;min-height:0;overscroll-behavior:contain}
.sales-panel .desktop-table-wrap table{min-width:0;border-collapse:separate;border-spacing:0}
.sales-panel .desktop-table-wrap th,.sales-panel .desktop-table-wrap td{padding:12px 8px;text-align:center;white-space:normal;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.sales-panel thead th{position:sticky;top:0;z-index:2}
.sales-panel tfoot th,.sales-panel tfoot td{position:sticky;bottom:0;z-index:3;background:#eef4fd;border-top:2px solid #bdcde3;font-weight:800}
.sales-panel th:not(:last-child),.sales-panel td:not(:last-child){border-right:1px solid var(--line)}
.mobile-sales-scroll,.mobile-sales-totals{display:none}
@media(max-width:800px){
 #salesView{height:calc(100dvh - 150px);min-height:0}
 .mobile-sales-scroll{display:block;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
 .mobile-sales-totals{display:grid;grid-template-columns:1fr 1fr;gap:8px;flex:none;background:#eef4fd;border-top:2px solid #bdcde3;padding:12px 8px;font-size:12px;font-variant-numeric:tabular-nums}
 .mobile-sales-totals>span{display:flex;flex-wrap:wrap;gap:4px}
}

@media(min-width:801px){main:has(#salesView:not(.hidden)){padding-bottom:16px}}
