/* Operational layouts start with the phone; wide screens retain full reports. */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.mobile-filter-toggle,.mobile-filter-scope{display:none}
.counter-intro{line-height:1.6;margin-bottom:16px}.counter-intro p{margin:6px 0}.counter-ranking,.counter-definitions{padding:22px;margin:20px 0}.counter-ranking h2{font-size:19px;margin:0 0 12px}.counter-rank{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;position:relative;width:100%;min-height:62px;padding:14px 0 10px;border:0;border-bottom:1px solid var(--border);background:transparent;color:var(--ink);font:inherit;text-align:left}.counter-rank span{overflow-wrap:anywhere}.counter-rank i{grid-column:1/-1;height:5px;border-radius:5px;background:#01a8f1}.counter-rank strong{font-variant-numeric:tabular-nums}.counter-card .status{display:inline-flex;white-space:normal}.counter-card h2{font-size:21px;margin:14px 0 8px}.counter-sales{padding:14px 0}.counter-sales small{display:block;font-size:13px;color:var(--muted);margin-bottom:8px}.counter-sales strong{font-size:26px;font-variant-numeric:tabular-nums}.counter-card dl{margin:0 0 16px}.counter-card dl>div{display:flex;justify-content:space-between;align-items:start;gap:16px;padding:10px 0;border-bottom:1px solid var(--border);font-size:13px;line-height:1.5}.counter-card dd{margin:0;font-weight:650;text-align:right;font-variant-numeric:tabular-nums}.counter-card dt{color:var(--muted)}.counter-reasons{padding:12px 12px 12px 28px;background:#fff5e5;color:#785000;border-radius:10px;font-size:13px;line-height:1.6}.counter-card>.btn{width:100%;min-height:48px}.counter-definitions summary{min-height:44px;cursor:pointer;font-weight:650}.counter-definitions p{font-size:13px;line-height:1.7}
.delivery-destination h3{margin:12px 0 6px;overflow-wrap:anywhere}
.cash-register p{overflow-wrap:anywhere;line-height:1.6;font-size:14px}.cash-register .btn{width:100%;min-height:48px}.cash-register h3{font-size:20px;margin:0 0 12px;overflow-wrap:anywhere}
.delivery-contact{display:flex;gap:8px;margin:12px 0 18px;flex-wrap:wrap}
.delivery-contact .btn{min-height:44px}
.delivery-actions{display:flex;flex-wrap:wrap;gap:10px;width:100%}
.delivery-actions .primary{order:-1;flex:1 1 100%}
.delivery-actions .btn{flex:1;min-height:48px}
.field-detail-modal .modal-footer{background:var(--surface,#fff);position:sticky;bottom:0;border-top:1px solid var(--border);padding-top:14px}
.field-detail-modal .modal-footer:has(.delivery-actions:empty){display:none}

@media(max-width:850px){
 html{scroll-padding-bottom:100px}
 .content{padding:16px 16px calc(96px + env(safe-area-inset-bottom))}
 .topbar{padding-top:env(safe-area-inset-top);height:calc(60px + env(safe-area-inset-top));background:#fff}
 .page-head{gap:12px;margin-bottom:16px}
 .page-head h1{font-size:25px;line-height:1.25;overflow-wrap:anywhere}
 .page-head .subtitle{margin-bottom:0}
 .workspace-freshness{margin:0 0 12px;gap:8px;font-size:12px}
 .workspace-freshness .btn{min-height:44px}
 .workspace-freshness .btn svg{width:16px;height:16px}
 .mobile-nav{padding-bottom:max(6px,env(safe-area-inset-bottom));gap:4px}
 .mobile-nav button{min-height:54px;font-size:12px}
 .btn,.text-btn,button.product-add{min-height:48px}
 .btn,.text-btn{white-space:normal;line-height:1.4}
 input:not([type=checkbox]):not([type=range]),select,textarea,.date-control input{font-size:16px!important}
 input,select,textarea,button,a{touch-action:manipulation}
 input[type=range]{touch-action:pan-y}
 .field{min-width:0}
 .field input,.field textarea,.field select{width:100%;max-width:100%;min-width:0}
 textarea{resize:vertical}
 .filters{display:block;margin-bottom:18px;padding:12px;border:1px solid var(--border);border-radius:14px;background:#fff}
 .mobile-filter-toggle{display:flex;align-items:center;justify-content:space-between;width:100%;gap:10px;border:0;background:transparent;color:var(--ink);padding:4px 0;min-height:48px;text-align:left;font:inherit}
 .mobile-filter-toggle>span{display:flex;align-items:center;gap:8px;flex-shrink:0;font-size:14px;font-weight:650}
 .mobile-filter-toggle strong{font-size:13px;font-weight:500;line-height:1.5;flex:1;text-align:right}
 .mobile-filter-toggle svg{width:18px;height:18px;flex-shrink:0}
 .mobile-filter-toggle>svg{transform:rotate(90deg)}
 .filters-open .mobile-filter-toggle>svg{transform:rotate(-90deg)}
 .filters:not(.filters-open)>.filter-left{display:none}
 .filters.filters-open>.filter-left{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0 8px}
 .filter-left select{width:100%;min-width:0;min-height:48px;padding:10px}
 .filter-left #period-filter,.filter-left #apply-date-range,.filter-left .custom-date-help,.filter-left #range-error{grid-column:1/-1}
 .mobile-filter-scope{display:block;margin:4px 0 8px;font-size:12px;color:#465769;line-height:1.5;overflow-wrap:anywhere}
 .filters>.filter-hint{display:flex;gap:6px;margin:6px 0 0;font-size:12px;line-height:1.6}
 .filters>.filter-hint svg{width:14px;height:14px;flex-shrink:0}
 .stats{gap:10px;margin-bottom:16px}
 .stat{padding:15px 12px;min-width:0;border-radius:14px}
 .stat-top{font-size:12px;line-height:1.4;gap:6px;align-items:flex-start}
 .stat-top svg{flex-shrink:0;width:15px;height:15px}
 .stat-value{font-size:clamp(20px,5.8vw,28px);letter-spacing:-.5px;margin:14px 0 10px;white-space:normal;overflow-wrap:anywhere}
 .stat-bottom{display:block;font-size:12px;line-height:1.5}
 .stat-bottom .pill{display:inline-block;margin:0 3px 4px 0;font-size:11px;white-space:normal}
 .card-head{padding:18px 16px;align-items:flex-start;gap:12px;flex-wrap:wrap}
 .card-head h2{font-size:18px;line-height:1.4}
 .card-head>.text-btn{min-height:44px;padding-left:0}
 .work-queue{gap:10px}
 .work-queue button{min-height:88px;padding:16px}
 .work-queue span{font-size:13px;line-height:1.5}
 .retailer-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:10px}
 .retailer-toolbar label{min-width:0;line-height:1.5}
 .retailer-toolbar select{width:100%;max-width:100%}
 .retailer-toolbar .search,.retailer-toolbar>p{grid-column:1/-1}
 .retailer-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 .retailer-actions .btn{padding:10px 7px;font-size:13px}
 .retailer-summary{grid-template-columns:1fr;gap:0;padding:12px 0}
 .retailer-summary>div{display:flex;justify-content:space-between;gap:14px;padding:10px 0;border-bottom:1px solid var(--border)}
 .retailer-summary small{margin:0;line-height:1.5}
 .retailer-summary strong{font-size:18px;text-align:right}
 .factory-roster>div,.factory-unassigned{flex-wrap:wrap}
 .line-total{flex-wrap:wrap;gap:10px;line-height:1.5;padding:14px}
 .line-total strong{font-size:18px;overflow-wrap:anywhere}
 .map-toolbar{gap:10px}.map-toolbar label{min-width:0;flex:1 1 45%}.map-toolbar select{width:100%}
 .table-wrap{border-radius:0}
 .chart{padding-left:12px;padding-right:12px}
 .chart .bars{min-width:0;gap:3px}
 .chart .bar-label{font-size:10px}
 .legend-note{padding:12px 16px;font-size:12px;line-height:1.6}

 /* A seller opens the app to act: the queue and shop search stay near the top. */
 .shell[data-role=salesperson] .page-head .eyebrow,.shell[data-role=salesperson] .page-head .subtitle{display:none}
 .shell[data-role=salesperson] .page-head h1{font-size:23px;margin:0}
 .shell[data-role=salesperson][data-view=Overview] .field-hero{display:none}
 .field-queue{margin:10px 0 16px;gap:8px}
 .field-queue button{min-height:82px;padding:12px;border-radius:14px;gap:5px}
 .field-queue strong{font-size:25px;line-height:1.2}
 .field-queue span{font-size:12px;line-height:1.4}
 .flow-search{margin:12px 0;font-size:14px}
 .flow-search>span{font-size:13px}
 .flow-tabs{gap:8px;padding-bottom:12px;margin:0 0 8px;scroll-padding:12px}
 .flow-tabs button{min-height:48px;padding:10px 14px}
 .shop-stop{padding:18px}
 .shop-heading{gap:10px;margin-bottom:10px}
 .shop-heading h2{font-size:19px;line-height:1.35}
 .shop-symbol{width:40px;height:40px;border-radius:12px}
 .shop-context{margin:12px 0;gap:6px}
 .shop-context span{font-size:12px;padding:6px 8px;line-height:1.4}
 .shop-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 .shop-actions .btn{min-width:0;font-size:13px;padding:10px 6px}
 .shop-actions .primary{grid-column:1/-1;order:-1;min-height:50px;font-size:15px}
 .shop-actions .btn svg{width:17px;height:17px;flex-shrink:0}
 [data-field-order]{padding:18px;display:grid;grid-template-columns:1fr auto;gap:10px;align-items:start}
 [data-field-order]>.eyebrow,[data-field-order]>h2,[data-field-order]>.btn{grid-column:1/-1;margin:0}
 [data-field-order]>h2{font-size:20px;line-height:1.4}
 [data-field-order]>.status{grid-column:1/-1;justify-self:start}
 [data-field-order]>p{margin:0;font-size:14px;line-height:1.5}
 [data-field-order]>.help{text-align:right}
 [data-field-order]>.btn{margin-top:4px;min-height:50px}
 .delivery-destination h3{font-size:23px;line-height:1.3}
 .delivery-contact{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:14px}
 .delivery-contact .btn{padding:10px;min-height:48px;font-size:14px}
 .delivery-contact .btn:only-child{grid-column:1/-1}
 .delivery-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .delivery-actions .btn{font-size:14px;padding:12px 8px;min-height:50px}
 .delivery-actions .primary{grid-column:1/-1;min-height:52px;font-size:16px}
 .field-detail-modal .modal-footer{z-index:4}
 .field-detail-modal .modal-body{padding-top:16px}
 .delivery-pack-summary{padding:14px}

 /* One scrollable sheet, a fixed title, and an always-reachable form footer. */
 #modal[open]{display:flex;flex-direction:column;overflow:hidden}
 #modal>.modal-header{position:relative;flex:0 0 auto;background:#fff;min-height:64px;padding:12px 16px}
 #modal>.modal-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;scroll-padding:16px 0 120px;padding:16px 16px 0}
 #modal-form{min-height:100%;gap:0}
 #modal-form>#form-error:empty{margin:0}
 #modal-form>.modal-footer{position:sticky;bottom:0;margin-top:auto;background:#fff;padding:12px 0 max(12px,env(safe-area-inset-bottom));border-top:1px solid var(--border);z-index:4;flex-shrink:0}
 #modal-form>.modal-footer>.btn{flex:1;min-width:0;min-height:52px;padding:12px;font-size:15px}
 .store-modal .cart-dock{grid-template-columns:minmax(105px,.8fr) minmax(0,1.6fr);gap:8px!important}
 .cart-summary{padding:2px 0 6px;font-size:14px}
 .store-modal .store-destination{padding:12px;margin-bottom:8px;gap:10px}
 .store-destination strong{font-size:17px}
 .store-modal .change-shop{margin-bottom:10px}
 .store-modal .catalogue-heading{margin:4px 0 12px}
 .store-modal .single-product .product-art.has-pack-front{height:clamp(145px,43vw,205px)}
 .store-modal .single-product .product-info{padding:12px 0!important}
 .store-modal .single-product .product-info strong{font-size:20px}
 .store-modal .single-product .product-info b{font-size:20px;margin-top:8px}
 .store-modal .single-product .quantity-stepper{max-width:none}
 .quantity-stepper button{min-width:48px;min-height:48px}
 .quantity-stepper input{min-height:48px}
 .basket-line{min-width:0;flex-wrap:wrap;gap:10px}
 .basket-line>span:not(.line-pack){flex:1;min-width:140px;overflow-wrap:anywhere}
 .basket-line>b{margin-left:auto;white-space:normal}
 .checkout-steps{margin:16px 0;gap:6px}
 .checkout-steps li{font-size:12px;line-height:1.4}
 .draft-actions .btn{min-height:44px;font-size:13px}
 .pending-notice{font-size:14px;line-height:1.6}
 .pack-dialog .pack-preview-body{padding:12px}
 .pack-dialog{height:auto;max-height:calc(100dvh - 16px);margin:auto;inset:8px}
 .pack-dialog .pack-large{max-height:56dvh}
}

/* Phone order cards keep every financial figure and the same table semantics. */
@media(max-width:600px){
 .page-head .eyebrow,.page-head .subtitle{display:none}
 .page-head h1{font-size:23px}
 .order-register{overflow:visible;padding:0 14px 14px}
 .order-register table{display:block;width:100%;min-width:0}
 .order-register thead{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .order-register tbody{display:grid;gap:12px}
 .order-register tbody tr{position:relative;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;padding:16px;border:1px solid var(--border);border-radius:14px;background:#fff}
 .order-register td{display:block;border:0;white-space:normal;padding:0;min-width:0;font-size:14px}
 .order-register td:nth-child(1){grid-column:1/-1;padding-right:44px}
 .order-register td:nth-child(1) .cell-title{font-size:17px;line-height:1.4;overflow-wrap:anywhere}
 .order-register td:nth-child(1) .cell-sub{font-size:12px;margin-top:5px}
 .order-register td:nth-child(2){align-self:center;font-size:13px;line-height:1.4}
 .order-register .person{gap:7px;align-items:center}
 .order-register .person .avatar{display:none}
 .order-register td:nth-child(3){text-align:right;align-self:center;font-size:13px;overflow-wrap:anywhere}
 .order-register td:nth-child(3)::before{content:attr(data-label);display:block;font-size:11px;color:var(--muted);margin-bottom:4px}
 .order-register td:nth-child(4) .cell-title{font-size:19px}
 .order-register td:nth-child(4) .cell-sub{margin-top:4px}
 .order-register td:nth-child(5){align-self:center;text-align:right}
 .order-register td:nth-child(6){position:absolute;right:8px;top:10px}
 .order-register td:nth-child(6) button{width:44px;min-height:44px;padding:10px;background:#f3f6f8;border-radius:10px}
 .table-card .pagination{padding:14px}
 .stats .stat-top svg{display:none}
 .page-head .actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 .page-head .actions .btn:only-child{grid-column:1/-1}
 .page-head .actions .btn{font-size:14px;min-width:0;padding:10px}
 .followup-row{padding:16px}
 .work-queue{grid-template-columns:1fr}
 .work-queue button{display:flex;justify-content:space-between;align-items:center;min-height:64px;gap:12px}
 .work-queue button strong{margin:0;font-size:23px}
}

@media(min-width:601px) and (max-width:850px){
 .content{max-width:100%;padding-left:24px;padding-right:24px}
 .entity-grid,.factory-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
 .filters.filters-open>.filter-left{grid-template-columns:repeat(3,minmax(0,1fr))}
 .stats .stat-value{font-size:28px}
 dialog:not(.pack-dialog){inset:16px;margin:auto;width:min(720px,calc(100vw - 32px));max-width:calc(100vw - 32px);height:auto;max-height:calc(100dvh - 32px);border-radius:20px;padding-top:0}
 #modal>.modal-body{min-height:0}
 #modal-form{min-height:0}
 .shop-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
 .shop-actions .primary{grid-column:1/-1}
}
@media(min-width:851px) and (max-width:1100px){
 .sidebar .nav button{min-height:46px;font-size:14px}
 .btn,.text-btn{min-height:44px}
 .field input,.field select,.field textarea,.language-choice select{min-height:44px;font-size:16px}
 .grid-main{grid-template-columns:1fr}
 .content{padding:24px 20px}
 .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .filter-left{gap:8px}
 .filter-left select{min-height:44px}
 .entity-grid{gap:16px}
}
@media(max-width:359px){
 .content{padding-left:12px;padding-right:12px}
 .stat{padding:13px 10px}
 .stat-value{font-size:21px}
 .stat-top{font-size:11px}
 .shop-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
 .shop-actions .primary{grid-column:1/-1}
 .delivery-actions{grid-template-columns:1fr}
 .delivery-actions .primary{grid-column:auto}
 .field-queue button{padding:10px 8px}
}
@media(max-height:500px) and (max-width:850px){
 .modal-header{min-height:52px!important;padding-top:8px!important;padding-bottom:8px!important}
 #modal>.modal-body{scroll-padding-bottom:90px}
 .store-modal .cart-summary{padding:0}
 #modal-form>.modal-footer{padding-top:8px}
}
.transfer-actions{margin:16px 0;gap:10px;flex-wrap:wrap}
.transfer-balances{margin:18px 0;padding:18px;min-width:0}
.transfer-balances summary{font-weight:650;cursor:pointer;min-height:44px}
.transfer-balances .entity-grid{margin-top:14px}
.transfer-balances .entity-grid>.card{padding:16px;overflow-wrap:anywhere}
.transfer-register h3,.transfer-register p{overflow-wrap:anywhere}
.transfer-register .btn{min-height:48px}
@media(max-width:600px){.transfer-actions{display:grid;grid-template-columns:1fr}.transfer-register>.card{padding:18px}.transfer-balances{padding:16px}.mobile-nav button[data-page="Stock transfers"] span{overflow-wrap:normal;line-height:1.2}}
