:root{font-family:system-ui,-apple-system,"Segoe UI",sans-serif;color:#203b36;background:#f3f6f3;font-size:14px}*{box-sizing:border-box}body{margin:0}header{height:88px;padding:0 max(24px,calc((100vw - 1400px)/2));display:flex;align-items:center;justify-content:space-between;background:#fff;border-bottom:1px solid #dce5df}.brand{display:flex;gap:12px;align-items:center;font-size:28px;font-weight:750;color:#126459}.brand small{display:block;font-size:9px;letter-spacing:2px;margin-top:3px}.local{font-size:12px;color:#57756c;background:#eef5ef;padding:9px 13px;border-radius:24px}main{max-width:1450px;margin:auto;padding:34px 24px}.intro{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:24px}.eyebrow{letter-spacing:2px;font-size:10px;font-weight:800;color:#578075}h1{font-size:32px;letter-spacing:-1px;margin:10px 0}p{color:#647970;line-height:1.6}h2{font-size:17px;margin:0}.panel{background:white;border:1px solid #dce5df;border-radius:14px;margin-bottom:22px}.metadata{padding:22px;display:grid;grid-template-columns:1fr 1.4fr 1.4fr;gap:24px}label{display:flex;flex-direction:column;gap:8px;font-size:12px;font-weight:650}input,textarea{font:inherit;border:1px solid #d4dfd8;border-radius:7px;padding:11px;color:#203b36;background:#fff;width:100%;min-width:0}input:focus,textarea:focus{outline:2px solid #62a798;outline-offset:1px}input[aria-invalid=true]{border-color:#be3939;background:#fff2f0}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin:24px 0}.stats article{border:1px solid #dce5df;background:white;border-radius:12px;padding:21px}.stats span{display:block;color:#647970;font-size:12px}.stats strong{display:block;font-size:28px;margin:12px 0 3px;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.stats small{font-size:10px;letter-spacing:1px;color:#73847c}.stats .accent{background:#126459;color:white;border-color:#126459}.accent span,.accent small{color:#c7e3da}.sectionhead{display:flex;justify-content:space-between;align-items:center;padding:22px;gap:12px}.sectionhead p{font-size:12px;margin:7px 0 0}button,.filebutton{font:inherit;font-weight:650;background:#126459;color:white;padding:11px 16px;border:1px solid #126459;border-radius:7px;cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;min-height:42px}.secondary{background:white;color:#315a4d;border-color:#d2dfd7}button:hover,.filebutton:hover{filter:brightness(.96)}.tablewrap{overflow:auto}table{border-collapse:collapse;width:100%;text-align:left}thead{background:#edf3ef;color:#62796e;font-size:11px}th,td{padding:12px 8px;border-bottom:1px solid #e4ebe5}th:first-child,td:first-child{padding-left:22px}td input{padding:10px 7px}td:nth-child(2){min-width:95px;width:100px}td:nth-child(3){min-width:170px}td:nth-child(n+4):nth-child(-n+7){min-width:125px;text-align:right}td:nth-child(n+4):nth-child(-n+6) input{text-align:right}td:nth-child(8){min-width:150px}td output{font-weight:700;font-variant-numeric:tabular-nums}.name{display:block;font-weight:600}.unknown{font-size:11px;color:#b33b2d}.delete{background:transparent;color:#7c887e;border:0;padding:8px;font-size:18px}tfoot{background:#f6f8f5;font-weight:750}.formula{padding:16px 22px;font-size:12px;color:#4c6e60;display:flex;justify-content:space-between;gap:12px}.formula span{color:#829086}.settlement{padding:22px}.settlement p{font-size:12px}.settlefields{display:grid;grid-template-columns:repeat(4,1fr);gap:18px}.settlefields output{padding:10px;font-size:21px;font-weight:750;color:#126459}.actions{display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap}.actions>div{display:flex;gap:10px;align-items:center;flex-wrap:wrap}#saveState{font-size:11px;color:#6c8375}footer{padding:24px 0;color:#7f8d83;font-size:12px}#notice{color:#b03929;margin-bottom:12px;line-height:1.6}dialog{border:1px solid #d6e2d9;border-radius:16px;max-width:650px;width:calc(100% - 32px);padding:24px}dialog::backdrop{background:#102a2380}dialog .sectionhead{padding:0}textarea{display:block;margin:18px 0}.filebutton input{display:none}#printReport{display:none}.negative{color:#b33b2d}
@media(max-width:760px){header{height:72px;padding:0 16px}.local{max-width:140px;font-size:10px}.brand{font-size:23px}main{padding:20px 14px}.intro{align-items:flex-start;flex-direction:column}h1{font-size:27px}.metadata{grid-template-columns:1fr;gap:16px;padding:18px}.stats{grid-template-columns:1fr 1fr;gap:10px}.stats article{padding:16px}.stats strong{font-size:24px}.sectionhead{padding:18px;align-items:flex-start;flex-direction:column}.report table,.report tbody,.report tr,.report td{display:block}.report thead,.report tfoot{display:none}.report tbody{padding:0 14px}.report tbody tr{display:grid;grid-template-columns:1fr 1fr;gap:10px;border-top:1px solid #e0e7e1;padding:16px 0;position:relative}.report td{border:0;padding:0!important;min-width:0!important;width:auto!important;text-align:left!important}.report td::before{content:attr(data-label);display:block;font-size:11px;font-weight:650;color:#6a7e71;margin-bottom:6px}.report td:nth-child(1){grid-column:1/-1;font-weight:750}.report td:nth-child(3){align-self:center}.report td:nth-child(8){grid-column:1/-1}.report td:nth-child(9){position:absolute;right:0;top:4px}.report td:nth-child(9)::before,.report td:nth-child(1)::before{display:none}.report td output{display:block;padding:10px 7px;background:#edf5ef;border-radius:7px}.formula{flex-direction:column}.settlefields{grid-template-columns:1fr 1fr}.actions>div{width:100%}.actions button,.actions .filebutton{flex:1}.actions{padding-bottom:10px}dialog{padding:18px}}
@media print{@page{size:A4 landscape;margin:10mm}body{background:white}header,main,dialog{display:none!important}#printReport{display:block;color:black;font-size:10px}#printReport h1{font-size:20px}#printReport table{table-layout:fixed}#printReport td,#printReport th{border:1px solid #888;padding:7px;overflow-wrap:anywhere;min-width:0;width:auto}#printReport thead{display:table-header-group}#printReport tr{break-inside:avoid}#printReport p{color:black}#printReport th:first-child{width:35px}#printReport th:nth-child(2){width:65px}}

.add-row{padding:16px 22px;border-top:1px solid #dce5df}.report tfoot th,.report tfoot td,.total-row th,.total-row td{font-weight:800}.total-row{background:#edf3ef}
@media(max-width:760px){.add-row{padding:16px 14px}.add-row button{width:100%}.report tfoot{display:block;padding:16px 14px;background:#edf3ef}.report tfoot tr{display:grid;grid-template-columns:1fr 1fr;gap:14px;padding:0;border:0}.report tfoot th{grid-column:1/-1;padding:0!important}.report tfoot td{font-weight:800}.report tfoot td::before{color:#647970}.report tfoot td:last-child{display:none}.report tfoot #footOld::before{content:"Nợ cũ (VND)"}.report tfoot #footOrder::before{content:"Đơn hôm nay (VND)"}.report tfoot #footPaid::before{content:"Khách TT (VND)"}.report tfoot #footBalance::before{content:"Nợ lại (VND)"}}
[hidden]{display:none!important}.sync-controls{padding:0 22px 22px;display:flex;gap:10px;align-items:end;flex-wrap:wrap}.sync-controls label{flex:1;min-width:220px}select{width:100%;font:inherit;color:inherit;background:white;padding:11px;border:1px solid #d4dfd8;border-radius:7px;min-height:42px}.sync-warning{margin:0 22px 22px;padding:16px;background:#fff3db;border:1px solid #e0c48b;border-radius:8px;line-height:1.7}.sync-warning button{margin:8px}#syncDialog form,#userDialog form{display:flex;flex-direction:column;gap:14px}#loginError{color:#ac3826}.share-actions{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:18px}#sharePreview{width:100%;display:block;margin:18px 0;border:1px solid #d4dfd8}#shareDownloads{display:flex;flex-wrap:wrap;gap:10px}button:disabled{opacity:.5;cursor:not-allowed}#shareDialog{max-width:900px}
@media(max-width:760px){.sync-controls{padding:0 18px 18px}.sync-controls>*{width:100%;flex:auto}.share-actions>*{width:100%}#syncBadge{max-width:150px}}

.single-customer{display:grid;grid-template-columns:1fr 2fr;gap:12px;margin:16px 0 22px}.single-customer button{grid-column:1/-1}#catalogMode{margin-bottom:16px}#catalogSummary{font-weight:700}#catalogPreview{color:#126459}#catalogStatus{line-height:1.7}#catalogDialog>button{margin:4px 4px 4px 0}
@media(max-width:600px){.single-customer{grid-template-columns:1fr}}

.employee-label,.route-label{font-size:17px;font-weight:800}#employee,#route{font-size:22px;font-weight:800;padding:14px}.report .sectionhead button{margin-top:12px}.report td:nth-child(6),.report td:nth-child(7),.report td:nth-child(9){min-width:140px;text-align:right}.report td:nth-child(7) input{text-align:right}.report td:nth-child(8){min-width:220px}.report td:nth-child(10){min-width:180px}.report td:nth-child(8) input{margin-top:8px;text-align:right}.report td select{font-size:13px}.report td:nth-child(11){min-width:40px}.download-actions,#reportDownloads{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}#reportPreview{width:100%;display:block;border:1px solid #d4dfd8;margin-top:16px}#downloadDialog{max-width:1100px}.export-meta{font-size:17px!important;font-weight:800;color:#111!important}
@media(max-width:760px){.report td:nth-child(8){grid-column:1/-1}.report td:nth-child(9){position:static;right:auto;top:auto}.report td:nth-child(9)::before{display:block}.report td:nth-child(10){grid-column:1/-1}.report td:nth-child(11){position:absolute;right:0;top:4px}.report td:nth-child(11)::before{display:none}.report tfoot #footDebt::before{content:"Tổng công nợ (VND)"}.report tfoot #footPaid::before{content:"Tiền mặt (VND)"}.report tfoot #footBank::before{content:"Chuyển khoản (VND)"}#employee,#route{font-size:21px}.download-actions>*{width:100%}}
@media print{#printReport .export-meta{font-size:16px!important;font-weight:800}#printReport th:nth-child(3){width:15%}#printReport th:nth-child(8){width:14%}}
.bank-amount-label{margin-top:9px;font-size:11px}.bank-summary{padding:18px 22px}.bank-summary h3{margin:0 0 12px;font-size:15px}.bank-summary p{display:flex;justify-content:space-between;gap:16px;margin:8px 0}.bank-summary strong{white-space:nowrap;font-variant-numeric:tabular-nums;color:#126459}.migration-warning{padding:18px 22px;background:#fff3db;border-color:#e0c48b}.migration-warning button{margin:5px}select[aria-invalid=true]{border-color:#be3939;background:#fff2f0}#transfer[readonly]{background:#edf3ef;font-weight:750}#accountsDialog textarea{font-size:15px}
@media(max-width:760px){.bank-summary p{flex-direction:column;gap:2px}.report td:nth-child(8) select{font-size:16px}}
/* Bảng đủ chỗ trên màn hình lớn; chuyển sang thẻ nhập liệu khi hẹp. */
.report .tablewrap{width:100%;max-width:100%;overflow:visible}.report table{table-layout:fixed;width:100%;max-width:100%}.report th,.report td{min-width:0!important;width:auto!important;overflow-wrap:anywhere}.report th{font-size:11px;padding:12px 6px}.report td{padding:12px 6px}.report td:first-child,.report th:first-child{padding-left:10px}.report input,.report select{max-width:100%;min-width:0;font-size:13px}.report output{overflow-wrap:anywhere}.report .name{overflow-wrap:anywhere}.report .row-id>span{display:block;font-weight:800}.report .delete{font-size:11px;font-weight:700;min-height:28px;padding:4px 6px;color:#a74435;border:1px solid #e6d1ca;border-radius:5px;background:#fff8f5;margin-top:5px}.report .row-id::before{display:none!important}.new-report{font-size:19px;font-weight:850;min-height:58px;padding:15px 26px;border:2px solid #0e5149;box-shadow:0 4px 10px #12645926}.actions>div:first-child{gap:14px}#resetStatus{font-weight:700;color:#126459;margin:14px 0}#expense{font-weight:800}
@media(max-width:1350px){
.report table,.report tbody,.report tbody tr,.report tbody td,.report tfoot,.report tfoot tr,.report tfoot td,.report tfoot th{display:block}.report thead,.report colgroup{display:none}.report tbody{padding:0 18px}.report tbody tr{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;padding:18px 0;border-top:1px solid #dce5df;position:static}.report tbody td:nth-child(n){position:static!important;grid-column:auto;min-width:0!important;width:auto!important;padding:0!important;border:0;text-align:left!important}.report tbody td::before{content:attr(data-label);display:block;font-size:12px;font-weight:700;color:#647970;margin-bottom:7px}.report tbody .row-id{grid-column:1/-1!important;display:flex!important;align-items:center;justify-content:flex-start;gap:12px}.report .row-id>span{font-size:15px}.report .delete{margin:0}.report tbody td:nth-child(3){grid-column:span 3}.report tbody td:nth-child(8),.report tbody td:nth-child(9){grid-column:span 2}.report tbody td:nth-child(10){grid-column:1/-1}.report tbody td:nth-child(9)::before{display:block}.report tbody input,.report tbody select{font-size:15px;min-height:44px}.report tbody td:nth-child(n+4):nth-child(-n+9) input{text-align:right}.report tbody td output{display:block;background:#edf5ef;border-radius:7px;padding:11px;font-size:17px;min-height:44px}.report tbody td:nth-child(3){align-self:center}.report tfoot{padding:18px;background:#edf3ef}.report tfoot tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px;position:static;border:0;padding:0}.report tfoot th{grid-column:1/-1;padding:0!important;font-weight:850}.report tfoot td:nth-child(n){position:static;grid-column:auto;min-width:0!important;padding:0!important;border:0;text-align:left;font-size:16px;font-weight:850}.report tfoot td::before{display:block;color:#647970;font-size:11px;margin-bottom:6px;font-weight:650}.report tfoot #footOld::before{content:"Nợ cũ (VND)"}.report tfoot #footOrder::before{content:"Đơn hôm nay (VND)"}.report tfoot #footDebt::before{content:"Tổng công nợ (VND)"}.report tfoot #footPaid::before{content:"Tiền mặt (VND)"}.report tfoot #footBank::before{content:"Chuyển khoản (VND)"}.report tfoot #footBalance::before{content:"Nợ lại (VND)"}.report tfoot td:last-child{display:none}
}
@media(max-width:760px){.report tbody{padding:0 14px}.report tbody tr{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.report tbody td:nth-child(3){grid-column:auto}.report tbody td:nth-child(8){grid-column:1/-1}.report tbody td:nth-child(9){grid-column:auto}.report tfoot tr{grid-template-columns:repeat(2,minmax(0,1fr))}.report tfoot td:nth-child(n){grid-column:auto}.new-report{width:100%;flex-basis:100%!important;font-size:20px;min-height:60px}.actions>div:first-child #saveState{flex-basis:100%}.bank-summary p{overflow-wrap:anywhere}}


/* Tiêu đề nhắc lại chỉ dành cho màn hình nhập liệu. */
header{height:auto;min-height:100px;gap:20px;padding-top:18px;padding-bottom:18px}.brand{font-size:23px;line-height:1.35;max-width:1000px}.brand small{font-size:12px;letter-spacing:0;font-weight:500;margin-top:6px}.local{flex-shrink:0}
.report tfoot .input-column-guide{background:#e5eee8;color:#526e60}.report tfoot .input-column-guide th{font-size:11px;font-weight:750;padding:13px 6px;border-bottom:2px solid #cbdcd0}
@media(max-width:1350px){.report tfoot .input-column-guide{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin:-18px -18px 18px;padding:16px 18px}.report tfoot .input-column-guide th{grid-column:auto!important;padding:0!important;border:0;font-size:11px}}
@media(max-width:760px){header{align-items:flex-start;flex-direction:column;gap:10px}.brand{font-size:20px}.brand small{font-size:11px}.local{max-width:none}.report tfoot .input-column-guide{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media print{.input-column-guide{display:none!important}}

/* Đường ngăn mảnh giúp đối chiếu cột và số tiền trên màn hình nhập. */
.report thead th+th,.report #rows td+td,.report .input-column-guide th+th{border-left:1px solid #bed0c4}
@media(max-width:1350px){.report #rows td:not(.row-id){border-left:1px solid #bed0c4!important;padding-left:9px!important}.report .input-column-guide th+th{border-left:1px solid #bed0c4!important;padding-left:9px!important}}

.customer-suggestions{position:fixed;z-index:1000;background:#fff;border:1px solid #87aa98;border-radius:10px;box-shadow:0 8px 24px #173e3529;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;color:#203b36}.customer-suggestions[hidden]{display:none}.customer-suggestion-status{font-size:12px;color:#567264;background:#edf5ef;padding:10px 12px;line-height:1.4}.customer-suggestion-option{display:flex;align-items:flex-start;flex-direction:column;gap:4px;width:100%;min-height:58px;padding:11px 13px;border:0;border-bottom:1px solid #e1e9e3;border-radius:0;background:#fff;color:#203b36;text-align:left;white-space:normal;font-size:14px;line-height:1.4}.customer-suggestion-option strong{color:#126459;font-size:15px;overflow-wrap:anywhere}.customer-suggestion-option span{font-weight:500;overflow-wrap:anywhere}.customer-suggestion-option:hover,.customer-suggestion-option[aria-selected=true]{background:#e5f2ea;filter:none}.report input[data-key="code"]{font-size:16px}
@media print{.customer-suggestions{display:none!important}}

/* Nút tải nổi bật và khung xem trước rộng hơn. */
#png,#downloadAll{background:#c62828;color:#fff;border:2px solid #a91f1f;font-size:20px;font-weight:800;min-height:60px;padding:16px 28px;box-shadow:0 3px 9px #9e202026}
#png:disabled,#downloadAll:disabled{opacity:.6;cursor:wait}
#downloadDialog{width:calc(100vw - 24px);max-width:1560px;max-height:94dvh;padding:18px;overflow:auto}
#downloadDialog .sectionhead{position:sticky;top:-18px;background:#fff;z-index:1;padding:10px 0 12px;flex-direction:row;align-items:center;border-bottom:1px solid #e0e7e1}
#downloadDialog h2{font-size:23px}#reportPreview{width:100%;max-width:none;height:auto;background:#fff;margin:12px 0 0}#downloadDialog .download-actions{margin:12px 0}#downloadDialog>label{max-width:320px}
@media(max-width:760px){#png{width:100%;flex-basis:100%;font-size:21px;min-height:64px}#downloadDialog{width:calc(100vw - 8px);max-width:none;max-height:96dvh;padding:10px;border-radius:10px}#downloadDialog .sectionhead{top:-10px}#downloadDialog h2{font-size:20px}#downloadDialog>label{max-width:none}#downloadAll{font-size:18px;min-height:56px}}

/* Khung báo cáo gần toàn màn hình trên cả trình duyệt máy tính. */
#downloadDialog{width:calc(100vw - 16px);max-width:none;max-height:calc(100dvh - 16px);padding:12px;margin:auto}
#downloadDialog .sectionhead{top:-12px;padding:8px 0 10px}
#reportPreview{margin-top:8px}
@media(max-width:760px){#downloadDialog{width:calc(100vw - 8px);max-height:calc(100dvh - 8px);padding:8px}#downloadDialog .sectionhead{top:-8px}}
