*{box-sizing:border-box}body{margin:0;font:14px -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;background:#f2f5fa;color:#223149}button,input,select,textarea{font:inherit}button,a{touch-action:manipulation}button{cursor:pointer;border:0;border-radius:8px;background:#205bbf;color:white;padding:10px 16px;white-space:nowrap}button:hover{filter:brightness(.96)}button:disabled{opacity:.5;cursor:wait}.soft{background:#eaf0fb;color:#205bbf}.danger{background:#fff0ee;color:#c94639}a{color:#205bbf;text-decoration:none}input,select,textarea{border:1px solid #dce3ed;border-radius:8px;background:#fff;padding:10px 12px;width:100%;color:#223149;min-width:0}input[type=checkbox]{width:auto;accent-color:#205bbf}label{display:grid;gap:7px;color:#62718a;font-size:13px;min-width:0}header{height:74px;background:#205bbf;color:white;display:flex;align-items:center;justify-content:space-between;padding:0 30px;position:sticky;top:0;z-index:10}header strong{font-size:21px;letter-spacing:1px}header small{opacity:.75;font-size:11px;margin-left:12px}header button{background:#ffffff1a;margin-left:10px}aside{position:fixed;top:74px;bottom:0;left:0;width:220px;background:white;border-right:1px solid #e6eaf2;overflow:auto;padding:16px 12px}aside button{display:flex;gap:12px;width:100%;text-align:left;background:transparent;color:#60718a;margin:3px 0;padding:12px 16px}aside button.active{background:#eaf1ff;color:#205bbf;font-weight:600}aside .group{font-size:10px;color:#a0aabc;padding:18px 16px 4px;letter-spacing:2px}main{margin-left:220px;padding:30px 34px;max-width:1700px}.heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:22px;flex-wrap:wrap}h1,h2,h3,p{margin-top:0}h1{font-size:25px;margin-bottom:8px}h2{font-size:18px}h3{font-size:16px}small,.muted{color:#8591a6}p{line-height:1.7}.hero{background:linear-gradient(110deg,#2144a5,#2872da);border-radius:18px;padding:30px;color:white;box-shadow:0 12px 30px #205bbf18}.hero small{color:#c7d8fc}.hero p{opacity:.75}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin:20px 0}.stat{background:white;border:1px solid #e8edf4;border-radius:12px;padding:20px;color:#71809a}.stat strong{display:block;font-size:27px;color:#233956;margin-top:10px;font-weight:600}.hero .stat{background:#ffffff0d;color:#d6e4fc;border:1px solid #ffffff25}.hero .stat strong{color:white}.shortcuts{display:grid;grid-template-columns:repeat(5,1fr);gap:14px;margin:22px 0}.shortcuts button{background:white;color:#384863;padding:22px 8px;display:grid;justify-items:center;gap:14px;border:1px solid #e6ebf3}.shortcuts b{width:46px;height:46px;border-radius:13px;display:grid;place-items:center;background:#eaf1ff;color:#2864ca;font-size:23px}.shortcuts button:nth-child(3n+2) b{background:#e1f7f2;color:#12a68a}.shortcuts button:nth-child(3n) b{background:#fff0e5;color:#ea8d38}.panel{background:white;border:1px solid #e5ebf3;border-radius:14px;padding:22px;margin-bottom:20px}.toolbar,.actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.toolbar{margin-bottom:20px}.toolbar input{max-width:360px}.toolbar select{max-width:200px}.tablewrap{overflow:auto}table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}th{background:#f6f8fc;color:#8290a5;font-weight:500;font-size:12px}th,td{padding:14px 12px;border-bottom:1px solid #edf1f6}td small{display:block;margin-top:5px}.tag{font-size:11px;background:#eef3fb;color:#577097;padding:5px 8px;border-radius:5px}.tag.green{color:#149876;background:#e5f6ef}.tag.orange{color:#bb7e22;background:#fff4dd}.empty{padding:40px 12px;text-align:center;color:#93a0b3}.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.span{grid-column:1/-1}.foot{display:flex;justify-content:flex-end;gap:10px;margin-top:24px}.item{border:1px solid #e5ebf3;border-radius:12px;padding:16px;margin:12px 0;display:flex;justify-content:space-between;gap:12px;align-items:center}.item p{margin:6px 0;color:#8190a6;font-size:12px}.items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.items .item{margin:0}.notice{padding:14px 18px;background:#edf3ff;color:#55729a;border-radius:10px;font-size:13px;margin:18px 0;line-height:1.7}.login{max-width:440px;margin:8vh auto;background:#fff;border:1px solid #e7edf5;padding:36px;border-radius:18px;box-shadow:0 20px 80px #163f7a0d}.login form{display:grid;gap:18px}.logo{height:52px;width:52px;border-radius:15px;background:#205bbf;color:#fff;display:grid;place-items:center;font-size:26px;margin-bottom:20px}dialog{border:0;border-radius:16px;box-shadow:0 20px 100px #10254c33;width:min(920px,94vw);max-height:90vh;padding:26px;color:#223149}dialog::backdrop{background:#15294a66}.dialoghead{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.dialoghead h2{margin:0}.lineform{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:10px;align-items:end;background:#f4f7fc;padding:14px;border-radius:10px;margin-top:20px}.cart{margin-top:18px}.totals{text-align:right;font-size:22px;margin-top:16px}.checkrow{display:flex;align-items:center;gap:12px;border-bottom:1px solid #edf1f6;padding:14px 0}.checkrow label{display:flex;align-items:center;gap:10px;color:#3b4a62}.checkrow strong{margin-left:auto}#toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);background:#223954;color:white;padding:14px 22px;border-radius:10px;z-index:100;max-width:90vw}.bottom{display:none}.collection{max-width:580px;margin:30px auto;padding:24px}.collection .hero{margin-bottom:20px}.qr{width:220px;max-width:100%;display:block;margin:20px auto}.profile{display:flex;gap:18px;align-items:center}.mobile main{margin:0 auto;max-width:680px;padding:18px 14px 100px}.mobile aside{display:none}.mobile header{height:60px;padding:0 16px}.mobile header strong{font-size:18px}.mobile header small{display:none}.mobile header button{font-size:12px;padding:8px 10px}.mobile .hero{padding:24px 18px}.mobile .stats{grid-template-columns:repeat(2,1fr);gap:10px}.mobile .stat{padding:15px}.mobile .stat strong{font-size:23px}.mobile .shortcuts{grid-template-columns:repeat(3,1fr);gap:0;border-radius:14px;overflow:hidden}.mobile .shortcuts button{border:0;border-radius:0;padding:22px 4px;font-size:12px}.mobile .bottom{display:flex;position:fixed;bottom:0;left:0;right:0;background:white;border-top:1px solid #e5eaf3;z-index:15;padding:9px 10px max(12px,env(safe-area-inset-bottom))}.bottom button{flex:1;background:white;color:#929daf;display:grid;gap:4px;font-size:12px}.bottom b{font-size:21px}.bottom button.active{color:#205bbf}.mobile .items{grid-template-columns:1fr}.mobile .panel{padding:17px}.mobile #toast{bottom:85px}.mobile .formgrid{grid-template-columns:1fr}.mobile .lineform{grid-template-columns:1fr 1fr}.mobile .lineform label:first-child{grid-column:1/-1}.mobile .heading{margin-bottom:16px}.mobile h1{font-size:22px}.mobile .tablewrap{font-size:12px}.mobile td,.mobile th{padding:12px 8px}.mobile .item{align-items:flex-start;flex-wrap:wrap}.mobile dialog{padding:18px}.mobile .toolbar input{max-width:none}.mobile .login{margin:30px 16px}.mobile .collection{padding:10px}.mobile .hero .stats{margin-bottom:0}@media(max-width:780px){body:not(.mobile) aside{width:170px}body:not(.mobile) main{margin-left:170px;padding:20px}.stats{grid-template-columns:repeat(2,1fr)}.shortcuts{grid-template-columns:repeat(3,1fr)}}@media print{header,aside,.bottom,.toolbar,.actions,button{display:none!important}main,.mobile main{margin:0;padding:0;max-width:none}dialog{position:static;max-height:none;width:100%;box-shadow:none}body:has(dialog[open]) #root{display:none}body{background:white}.panel{border:0}}

/* Responsive correction: keep wide data inside its scroll region, not the page. */
@media screen {
 main,.panel,.hero,.heading>div,.formgrid>*,.lineform>*,.item>div{min-width:0}
 .stats{grid-template-columns:repeat(4,minmax(0,1fr))}
 .stat strong{overflow-wrap:anywhere}
 .shortcuts{grid-template-columns:repeat(5,minmax(0,1fr))}
 .tablewrap{max-width:100%;min-width:0;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 .tablewrap:focus-visible{outline:2px solid #205bbf;outline-offset:3px}
 .foot{flex-wrap:wrap}
 .dialoghead{gap:12px}.dialoghead h2{min-width:0;overflow-wrap:anywhere}
 .checkrow{min-width:0;flex-wrap:wrap}.checkrow label{min-width:0;flex:1 1 160px;overflow-wrap:anywhere}
 .checkrow input[type=checkbox]{flex-shrink:0}.checkrow strong{flex-shrink:0}
 dialog{overscroll-behavior:contain;overflow:auto;max-height:90dvh}
 .mobile header{height:auto;min-height:60px;gap:8px;padding:8px max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left))}
 .mobile header>div{min-width:0;display:flex;align-items:center}
 .mobile header>div:last-child{justify-content:flex-end;flex:1}
 .mobile header>div:last-child>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:42vw}
 .mobile header strong{white-space:nowrap;font-size:17px}.mobile header button{flex-shrink:0;margin-left:8px}
 .mobile main{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right));padding-bottom:calc(112px + env(safe-area-inset-bottom))}
 .mobile button{min-height:44px;max-width:100%}
 .mobile input,.mobile select,.mobile textarea{font-size:16px;min-height:44px}
 .mobile input[type=checkbox]{min-height:24px;width:24px;height:24px}
 .mobile .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .mobile .shortcuts{grid-template-columns:repeat(3,minmax(0,1fr))}
 .mobile .shortcuts button{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.5}
 .mobile .formgrid{grid-template-columns:minmax(0,1fr)}
 .mobile .lineform{grid-template-columns:repeat(2,minmax(0,1fr))}
 .mobile .actions{max-width:100%}.mobile .actions button{white-space:normal;overflow-wrap:anywhere}
 .mobile dialog{width:calc(100% - 24px);max-width:680px;max-height:calc(100dvh - 24px);padding:16px}
 .mobile .foot button{flex:1 1 auto;white-space:normal}
 .mobile .notice,.mobile .item p,.mobile h3,.mobile .heading small{overflow-wrap:anywhere}
 .mobile .bottom{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
 .mobile .bottom button{min-width:0;padding-left:6px;padding-right:6px}
 .mobile #toast{bottom:calc(98px + env(safe-area-inset-bottom))}
 .mobile .login{max-width:440px;margin:30px auto;padding:24px;width:calc(100% - 28px)}
 @media(max-width:780px){.stats{grid-template-columns:repeat(2,minmax(0,1fr))}.shortcuts{grid-template-columns:repeat(3,minmax(0,1fr))}}
 @media(max-width:380px){.mobile .lineform{grid-template-columns:minmax(0,1fr)}.mobile .stat{padding:12px}.mobile .stat strong{font-size:21px}}
}

.order-stock{grid-column:1/-1;margin:0;color:#526581}
.order-billing{text-align:center;border-top:1px solid #e5eaf1;margin-top:18px;padding:16px 0}
.order-billing .qr{width:145px;margin:12px auto}
@media print{.order-billing{break-inside:avoid}}

.customer-location{grid-column:1/-1;border-top:1px solid #e5eaf1;padding-top:16px}
.customer-location .muted{margin:10px 0}
.customer-map{width:100%;height:300px;margin:12px 0;z-index:0;background:#edf2f7}
.customer-map[hidden]{display:none}

.product-photo{width:52px;height:52px;border-radius:8px;object-fit:contain;background:#f2f5fa;vertical-align:middle}
.product-photo-editor{margin-top:18px;display:grid;gap:10px;justify-items:start}
.product-photo-editor label{width:100%}
.product-photo-editor .product-photo{width:128px;height:128px}
.product-photo[hidden]{display:none}
.route-stops{padding:0;display:grid;gap:8px}
.route-stops .item{margin:0}
.customer-section,.customer-photo-editor{grid-column:1/-1;padding:16px 0;border-top:1px solid #e5eaf1}
.customer-photo-preview{display:block;width:min(100%,420px);height:180px;object-fit:contain;background:#f2f5fa;border-radius:12px;margin-bottom:12px}
.customer-photo-preview[hidden]{display:none}
.photo-action{display:inline-flex;align-items:center;position:relative;overflow:hidden;height:40px;padding:0 14px;border-radius:8px;background:#eaf0fb;color:#205bbf;cursor:pointer}
.customer-photo-input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}
.photo-action:focus-within{outline:2px solid #205bbf;outline-offset:2px}
