/* Phone presentation. Desktop keeps its existing tables and navigation. */
.mobile-nav,.mobile-expand,.mobile-checkout-amount,.mobile-filter-toggle{display:none}
.mobile-nav button[hidden]{display:none!important}
#oe_productList[hidden],#oe_productList .item-select-row[hidden]{display:none!important}
#oc_productList.mobile-products-collapsed{display:none}
.mobile-product-search{display:flex;gap:8px;align-items:stretch}
.mobile-product-search #oc_search{flex:1;min-width:0;width:0}
#mobileProductToggle{display:block;flex:0 0 64px;padding:8px;border:1px solid #cfe2d9;border-radius:8px;background:#e8f5f1;color:#087f72;min-height:46px;font-size:14px!important}
@media screen and (max-width:700px){
  body{padding:0 0 calc(76px + env(safe-area-inset-bottom));font-size:15px;overflow-wrap:anywhere}
  .nav{display:none!important}.header{min-height:52px;padding:12px 16px}.header h1{font-size:16px!important}.header>div:last-child{display:none!important}.header img{height:24px!important}
  .workspace-heading{padding:18px 16px 0}.workspace-heading small,.workspace-heading p{display:none}.workspace-heading h2{font-size:23px}.main{padding:14px 12px 24px;min-width:0}
  .mobile-nav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;bottom:0;left:0;right:0;z-index:150;background:#fff;border-top:1px solid #dce5e0;padding:5px 8px calc(5px + env(safe-area-inset-bottom));box-shadow:0 -4px 20px #20352f08}
  .mobile-nav button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:56px;border:0;border-radius:12px;background:transparent;color:#687b73;font-size:12px;padding:3px;touch-action:manipulation}
  .mobile-nav button>span:first-child{font-size:24px;line-height:28px}.mobile-nav button.active{color:#087f72;background:#e8f5f1;font-weight:700}.mobile-nav button[data-view="order-create"]>span:first-child{background:#087f72;color:#fff;border-radius:10px;width:40px}
  .mobile-auth .mobile-nav,.mobile-modal .mobile-nav{display:none}.mobile-auth .header{visibility:hidden}.mobile-menu{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mobile-menu button{min-height:58px;background:#eef7f3;border:1px solid #dce8e1;color:#205546;border-radius:12px}
  button,input,select,textarea{font-size:16px!important}button{min-height:44px;touch-action:manipulation}input:not([type=checkbox]):not([type=radio]),select{min-height:46px;max-width:100%;min-width:0}input[type=checkbox],input[type=radio]{width:22px!important;height:22px!important;min-height:22px!important;flex-shrink:0}
  .toolbar,.ops-toolbar{gap:9px;align-items:stretch;flex-wrap:wrap}.toolbar input,.toolbar select,.ops-toolbar input,.ops-toolbar select{width:100%!important;flex:1 1 145px;min-width:0!important}.toolbar button,.ops-toolbar button{flex:1 1 auto;padding:10px 12px!important;white-space:normal}.panel-header{flex-wrap:wrap;gap:10px}.panel-body{padding:13px}.panel{min-width:0}.stats-grid,.stat-grid,.ops-cards{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .main .mobile-cards,.modal .mobile-cards{display:block!important;width:100%!important;min-width:0!important;table-layout:auto!important;overflow:visible;border:0;background:transparent}
  .mobile-cards>thead{display:none!important}.mobile-cards>tbody{display:block!important}.mobile-cards>tbody>tr{display:block!important;background:#fff;border:1px solid #dde7e1;border-radius:14px;padding:8px 13px;margin:0 0 12px;box-shadow:0 2px 8px #173a2405}
  .main .mobile-cards>tbody>tr>td,.modal .mobile-cards>tbody>tr>td{display:block!important;position:relative;padding:9px 0 9px 92px!important;border:0!important;border-bottom:1px solid #f0f4f1!important;min-width:0!important;max-width:none!important;width:auto!important;white-space:normal!important;text-align:left!important;word-break:normal!important;overflow-wrap:anywhere}
  .mobile-cards>tbody>tr>td::before{content:attr(data-label);position:absolute;left:0;top:10px;width:82px;font-size:12px;color:#73847b;font-weight:400}.mobile-cards>tbody>tr>td:first-child{font-weight:650;color:#125b50}.mobile-cards>tbody>tr>td:last-child{border-bottom:0!important}.mobile-cards td button{margin:3px 4px 3px 0!important;padding:8px 12px!important;min-height:44px;font-size:14px!important}.mobile-cards td[colspan]{padding:16px!important}.orders-scroll,.ops-table{overflow:visible;border:0;background:transparent}
  .main .orders-table>tbody>tr:not(.mobile-expanded)>td.order-mobile-extra{display:none!important}
  .mobile-expand{display:inline-block}.order-pagination{gap:8px;flex-wrap:wrap}.date-group-header{font-size:15px;padding:10px 3px}.main .orders-table>tbody>tr>td.order-total-cell{font-size:20px!important;font-weight:700;color:#087f72}
  .modal-mask{padding:0;align-items:stretch;backdrop-filter:none}.modal-mask .modal{width:100%!important;max-width:100%!important;height:100dvh;max-height:100dvh!important;border-radius:0;display:flex;flex-direction:column;overflow:hidden;animation:none}.modal-header{flex:none;padding:12px 16px;min-height:60px}.modal-close{width:44px;height:44px;min-width:44px}.modal-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px}.modal-footer{flex:none;padding:10px 12px calc(10px + env(safe-area-inset-bottom));gap:8px}.modal-footer button{flex:1;min-width:80px}.mobile-modal{overflow:hidden}.customer-detail-actions{flex-wrap:wrap;gap:8px}.customer-detail-actions>div{flex:1;flex-wrap:wrap}.form-row{display:flex;flex-direction:column;gap:0}.form-group{min-width:0!important;width:auto;max-width:100%}.customer-detail dl{grid-template-columns:72px minmax(0,1fr)}
  .oc-prop-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.oc-prop-grid .form-group:last-child{grid-column:1/-1}.oc-prop-grid input,.oc-prop-grid select{width:100%}.oc-cust-bar,.oc-cust-bar>div{width:100%;min-width:0!important}.cust-search-input{height:48px}.cust-dropdown{max-height:260px}.cust-dropdown-item{padding:13px!important;min-height:48px}
  .oc-product-list{max-height:44dvh;min-height:160px}.item-select-row{display:grid!important;grid-template-columns:28px minmax(0,1fr) auto;gap:6px 10px;padding:13px 10px!important}.item-select-row>input[type=checkbox]{grid-row:1/3;align-self:center}.item-select-row .item-name{grid-column:2;min-width:0;font-size:15px!important;white-space:normal!important}.item-select-row .item-price{grid-column:3;grid-row:1;font-weight:650}.item-select-row .item-spec{grid-column:2;font-size:12px!important}.item-select-row .item-stock{grid-column:2;font-size:12px!important}.item-select-row .oc-qty{grid-column:3;grid-row:2/4;width:64px!important;align-self:center}
  .oc-selected-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:14px!important}.oc-sel-name{grid-column:1/-1;min-height:44px;font-size:16px!important;width:100%;text-align:left}.oc-sel-spec,.oc-sel-price{width:auto!important;max-width:none!important}.oc-sel-qty,.oc-sel-disc{display:flex!important;flex-direction:column;align-items:stretch!important;gap:5px}.oc-sel-qty::before{content:'数量';font-size:12px;color:#687b73}.oc-sel-disc::before{content:'优惠金额';font-size:12px;color:#687b73}.oc-sel-qty input,.oc-sel-disc input{width:100%!important;height:46px!important}.oc-sel-sub{font-size:19px!important;width:auto!important;align-self:center}.oc-sel-del{width:auto!important;min-height:44px}.oc-total-bar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.oc-tb-line{min-width:0;flex-wrap:wrap}.oc-tb-line input{width:100%!important}.oc-delivery-section{grid-template-columns:minmax(0,1fr)}.oc-delivery-section #oc_addr_new{grid-column:auto}
  .mobile-checkout{position:sticky;bottom:calc(68px + env(safe-area-inset-bottom));z-index:20;display:flex;align-items:center;gap:12px;padding:12px;margin:16px -13px -13px;background:#fff;border-top:1px solid #dce7df;box-shadow:0 -4px 16px #1d49300a}.mobile-checkout-amount{display:block;flex:1;font-size:17px;font-weight:700;color:#087f72}.mobile-checkout button{width:auto!important;min-width:116px;margin:0!important;padding:13px!important}.mobile-modal .mobile-checkout{z-index:0}.site-filing{position:static!important;z-index:auto}.toast-container{max-width:calc(100vw - 24px)}
  .batch-scroll{overflow:auto}.quick-bottom{bottom:calc(68px + env(safe-area-inset-bottom))}.auth-card{padding:24px;width:100%;max-width:380px}.auth-mask{padding:20px}
  body[data-mobile-view="order-create"] .panel-body{display:flex;flex-direction:column}
  .oc-selected-wrap{order:2}.oc-delivery-section{order:3}.oc-prop-grid{order:4}.oc-total-bar{order:5}.mobile-checkout{order:6;position:fixed;left:0;right:0;bottom:calc(66px + env(safe-area-inset-bottom));margin:0;padding:12px 16px;min-height:72px}
  body[data-mobile-view="order-create"] .main{padding-bottom:100px}.mobile-keyboard .mobile-nav,.mobile-keyboard .mobile-checkout{display:none}
  .order-filter>.mobile-filter-search{flex:1 1 100%;order:-1}
  .mobile-filter-search-row{display:flex;align-items:stretch;gap:8px}
  .mobile-filter-search-row #of_customer_kw{flex:1;min-width:0;width:0!important}
  .mobile-filter-toggle{display:block;flex:0 0 66px;width:auto;min-height:44px;margin:0;text-align:center;background:#eef7f3;color:#176455;border:1px solid #d8e7df;border-radius:8px;padding:10px 8px;font-size:13px}
  .mobile-filter-search-row>.mobile-filter-reset{flex:0 0 58px;width:58px;min-width:58px;min-height:44px;margin:0;padding:10px 6px;font-size:13px;white-space:nowrap}
  .order-filter.mobile-filter:not(.mobile-filter-open)>:not(.mobile-filter-search){display:none!important}
}

@media print{.mobile-nav,.mobile-expand{display:none!important}}
@media screen and (max-width:700px){
  body[data-mobile-view="order-create"] .workspace-heading,
  body[data-mobile-view="order-create"] .mobile-order-hidden{display:none!important}
  body[data-mobile-view="order-create"] .main{padding-top:10px}
  #oc_productList{height:62dvh;max-height:62dvh;min-height:260px}
  #oc_productList .item-name{font-size:13px!important;line-height:1.4}
  #oc_productList .item-price{font-size:13px!important}
  #oc_productList .item-spec,#oc_productList .item-stock{font-size:11px!important}
  #oc_productList .item-select-row{padding:10px 8px!important;gap:4px 8px}
  #oc_selectedList .oc-sel-name{font-size:14px!important}
  .oc-prop-grid{order:3;grid-template-columns:minmax(0,1fr)}
  .mobile-delivery-method{grid-column:1/-1}
  .oc-delivery-section{order:4}
  .oc-delivery-section:not(:has(.form-group:not([style*="display: none"]):not([style*="display:none"]))){display:none}
}

@media screen and (max-width:700px){body[data-mobile-view]:not([data-mobile-view="dashboard"]) .header{display:none}}

/* Compact phone lists and actions. */
@media screen and (max-width:700px){
  .main .orders-table.mobile-cards>tbody>tr{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr));column-gap:8px;padding:8px 12px;margin-bottom:10px;background:#edf6f2;border-color:#cfe3db}
  .main .orders-table.mobile-cards>tbody>tr>td{grid-column:span 2;padding:7px 0!important;white-space:nowrap!important;font-size:13px;line-height:1.5;overflow-wrap:normal;background:transparent!important;border-bottom:0!important}
  .orders-table.mobile-cards>tbody>tr>td::before{position:static;display:block;width:auto;margin-bottom:2px;font-size:10px;line-height:1.5;white-space:nowrap}
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="number"],
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="time"],
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="total"],
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="profit"],
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="payment"],
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="type"]{grid-column:span 3}
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="customer"],
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="actions"],
  .main .orders-table.mobile-cards>tbody>tr.mobile-order-staff>td[data-order-field="total"],
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="total"],
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="delivery"]{grid-column:1/-1}
  .orders-table .mobile-order-value,.orders-table .mobile-order-name{display:block;width:100%;min-width:0;white-space:nowrap;overflow-wrap:normal;word-break:normal;font-variant-numeric:tabular-nums}
  .orders-table .mobile-order-name{font-size:14px;line-height:1.6}
  .main .orders-table.mobile-cards>tbody>tr>td.order-total-cell{font-size:17px!important}
  .main .orders-table.mobile-cards>tbody>tr>td[data-order-field="profit"]{font-size:17px;font-weight:650}
  .main .orders-table.mobile-cards>tbody>tr>td.order-customer-cell .customer-name-link{display:block;width:100%;min-width:0;min-height:30px;padding:2px 0!important;margin:0!important;white-space:nowrap;text-align:left}
  .orders-table.mobile-cards .delivery-badge{padding:2px 6px;font-size:12px;line-height:1.6}
  #oc_selectedList .oc-selected-row{grid-template-columns:repeat(6,minmax(0,1fr));gap:4px 6px;padding:8px 10px!important;align-items:center}
  #oc_selectedList .oc-sel-name{grid-column:1/6;grid-row:1;min-height:32px;padding:3px 0!important;width:100%;font-size:12px!important}
  #oc_selectedList .oc-sel-del{grid-column:6;grid-row:1;justify-self:end;width:auto!important;min-height:30px;padding:4px 7px!important;font-size:11px!important;white-space:nowrap}
  #oc_selectedList .oc-sel-qty{grid-column:1/3;grid-row:2;gap:2px}
  #oc_selectedList .oc-sel-disc{grid-column:3/5;grid-row:2;gap:2px}
  #oc_selectedList .oc-sel-qty::before,#oc_selectedList .oc-sel-disc::before{font-size:10px;line-height:15px}
  #oc_selectedList .oc-sel-qty input,#oc_selectedList .oc-sel-disc input{height:34px!important;min-height:34px!important;padding:3px 5px!important;font-size:16px!important}
  #oc_selectedList .oc-sel-price{grid-column:5/7;grid-row:2;min-width:0;text-align:center;font-size:12px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #oc_selectedList .oc-sel-price::before{content:'单价';display:block;font-size:10px;font-weight:400;color:#687b73;line-height:15px;margin-bottom:2px}
  #oc_selectedList .oc-sel-spec{grid-column:1/5;grid-row:3;font-size:10px!important;line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #oc_selectedList .oc-sel-sub{grid-column:5/7;grid-row:3;min-width:0;font-size:12px!important;line-height:16px;white-space:nowrap}
  body[data-mobile-view="orders"] #main>.panel>.panel-header{display:none}
  .main .orders-table>tbody>tr>td:last-child{display:flex!important;gap:6px;padding:10px 0!important}
  .main .orders-table>tbody>tr>td:last-child::before{display:none}
  .main .orders-table>tbody>tr>td:last-child button{flex:1;min-width:0;min-height:36px;padding:7px 4px!important;margin:0!important;font-size:12px!important;white-space:nowrap;border:1px solid #cfe3db;border-radius:8px;background:#edf6f2;color:#176455;box-shadow:none}
  .main .orders-table>tbody>tr>td:last-child button:first-child{background:#087f72;border-color:#087f72;color:white}
  /* Compact summary: identity, customer, delivery/payment total, then actions. */
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded){row-gap:3px;padding:10px 12px}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td{padding:0!important}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="number"]{grid-column:1/4;grid-row:1}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="time"]{grid-column:4/7;grid-row:1;color:#6b7e75;font-size:11px;text-align:right!important}
  .orders-table>tbody>tr:not(.mobile-expanded)>td[data-order-field="time"] .mobile-order-value{text-align:right}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="customer"]{grid-column:1/-1;grid-row:2}
  .orders-table>tbody>tr:not(.mobile-expanded)>td[data-order-field="number"]::before,
  .orders-table>tbody>tr:not(.mobile-expanded)>td[data-order-field="time"]::before,
  .orders-table>tbody>tr:not(.mobile-expanded)>td[data-order-field="customer"]::before{display:none}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="delivery"]{grid-column:1/4;grid-row:3;align-self:center}
  .orders-table>tbody>tr:not(.mobile-expanded)>td[data-order-field="delivery"]::before{display:none}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="total"]{grid-column:4/7;grid-row:3;display:flex!important;align-items:center;gap:6px;text-align:right!important}
  .orders-table>tbody>tr:not(.mobile-expanded)>td[data-order-field="total"]::before{display:inline;margin:0;font-weight:400;color:#73847b}
  .orders-table>tbody>tr:not(.mobile-expanded)>td[data-order-field="total"] .mobile-order-value{flex:1;min-width:0;width:auto;text-align:right}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded):not(.mobile-order-staff)>td[data-order-field="delivery"]{grid-column:1/3}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded):not(.mobile-order-staff)>td[data-order-field="total"]{grid-column:3/5;font-size:13px!important;gap:4px}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded):not(.mobile-order-staff)>td[data-order-field="profit"]{display:flex!important;grid-column:5/7;grid-row:3;align-items:center;gap:4px;text-align:right!important;font-size:13px!important;color:#dc2626!important}
  .orders-table>tbody>tr:not(.mobile-expanded):not(.mobile-order-staff)>td[data-order-field="profit"]::before{content:'利润';display:inline;margin:0;font-weight:400;color:inherit}
  .orders-table>tbody>tr:not(.mobile-expanded):not(.mobile-order-staff)>td[data-order-field="profit"] .mobile-order-value{flex:1;min-width:0;width:auto;text-align:right}
  .main .orders-table.mobile-cards>tbody>tr:not(.mobile-expanded)>td[data-order-field="actions"]{grid-column:1/-1;grid-row:4;padding:7px 0 0!important;border-top:1px solid #d9e7e1!important;margin-top:3px}
  .main #custTable>tbody>tr{padding:5px 10px;margin-bottom:8px;border-radius:10px}
  .main #custTable>tbody>tr>td{padding:5px 0 5px 76px!important;font-size:12px;line-height:1.4}
  #custTable>tbody>tr>td::before{top:6px;width:70px;font-size:11px}
  #custTable .customer-name-link{display:block;width:100%;min-width:0;min-height:28px;padding:3px 0!important;margin:0!important;font-size:12px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #custTable .mobile-address{display:block;width:100%;min-height:28px;min-width:0;padding:3px 16px 3px 0!important;margin:0!important;border:0;background:transparent;color:#52685d;text-align:left;font-size:12px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative}
  #custTable .mobile-address::after{content:'⌄';position:absolute;right:0;top:3px;color:#087f72}
  #custTable .mobile-address.is-expanded{white-space:normal;overflow-wrap:anywhere}
  #custTable .mobile-address.is-expanded::after{content:'⌃'}
  #oc_productList .item-name,#oc_selectedList .oc-sel-name{min-width:0;white-space:nowrap!important;overflow:hidden;text-overflow:ellipsis;font-size:12px!important;line-height:1.5}
}

@media screen and (max-width:700px){
  .cal-grid{grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}
  .cal-cell{min-width:0;padding:4px 1px}
  .cal-cell .cal-sales,.cal-cell .cal-profit{width:100%;min-width:0;white-space:nowrap;overflow-wrap:normal;word-break:normal;text-align:center;font-size:10px;line-height:1.5;font-variant-numeric:tabular-nums}
  .chart-panel .tabs{display:flex;flex-wrap:nowrap;gap:5px}
  .chart-panel .tabs button{white-space:nowrap;font-size:12px!important;padding:6px 10px!important}
  .chart-panel .rank-cat-bar{display:flex;flex-wrap:nowrap;gap:3px;width:100%}
  .chart-panel .rank-cat-bar button{flex:1 1 0;min-width:0;min-height:36px;margin:0;padding:6px 1px!important;font-size:11px!important;white-space:nowrap}
}

/* Keep phone cards compact while giving controls and sections a calmer hierarchy. */
@media screen and (max-width:700px){
  .analytics-range{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:0}
  .ops-page .analytics-range>label{min-width:0;margin:0}
  .analytics-range input{flex:none!important;height:46px;min-height:46px;max-height:46px}
  .analytics-range>.range-separator{display:none}
  .analytics-range-actions{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .main{padding-left:12px;padding-right:12px}
  .mobile-nav{border-top-color:#dce8e1;box-shadow:0 -2px 12px #153e2d06}
  .mobile-nav button.active{background:#e5f3ed}
  .mobile-menu{gap:9px}.mobile-menu button{border-color:#d5e7dd;background:#f2f8f5;box-shadow:none!important}
  .main .orders-table.mobile-cards>tbody>tr{border-color:#cfe3d8;border-radius:13px;box-shadow:none}
  .mobile-filter{border-color:#d8e7df!important;background:#f7faf8!important;border-radius:11px!important}
  .mobile-filter-search-row button{box-shadow:none!important;white-space:nowrap}
  .date-group-header{border-radius:9px 9px 0 0}
  .customer-purchases .mobile-cards>tbody>tr{border-color:#d7e7de;box-shadow:none}
  .ops-cards>div{padding:14px;border-color:#dce7e1}.ops-cards span{font-size:12px}.ops-cards strong{font-size:21px;line-height:1.3;overflow-wrap:anywhere}
  .analysis-tabs .tab-btn{min-height:38px}
  .panel-header{min-height:50px}.modal-header{padding:13px 14px}.modal-footer{padding:11px 12px}
  .modal-body{padding:14px 12px}
  .applied-filters{gap:5px;margin-bottom:9px}.applied-filters>span{font-size:11px;padding:3px 7px}
}
