:root{--nav:#182722;--green:#17745b;--green2:#0f5d48;--bg:#f4f6f5;--line:#dfe5e2;--text:#17211e;--muted:#6d7a76;--warn:#bc6b14}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0;font:14px/1.5 "Microsoft YaHei",Arial,sans-serif;color:var(--text);background:var(--bg)}button,input,select,textarea{font:inherit}button{cursor:pointer;border:1px solid var(--line);background:#fff;border-radius:7px;padding:8px 14px;color:var(--text)}button:hover{border-color:var(--green)}button.primary{background:var(--green);color:#fff;border-color:var(--green)}button.primary:hover{background:var(--green2)}.login{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#162a23,#285c4b)}.login-card{width:min(400px,90vw);padding:36px;background:#fff;border-radius:16px;box-shadow:0 20px 50px #0004}.brand-mark{width:50px;height:50px;border-radius:12px;background:var(--green);color:white;display:grid;place-items:center;font-size:24px;font-weight:bold}.login-card h1{margin:18px 0 4px}.login-card p{color:var(--muted);margin:0 0 24px}.login-card label{display:block;margin:14px 0;color:var(--muted)}input,select,textarea{width:100%;padding:9px 10px;border:1px solid #cdd6d2;border-radius:7px;background:white;color:var(--text)}.login-card button{width:100%;margin-top:10px;padding:11px}.login-card small{display:block;text-align:center;color:#88948f;margin-top:14px}#app{min-height:100vh;display:grid;grid-template-columns:220px 1fr}aside{position:fixed;width:220px;height:100vh;background:var(--nav);color:#fff;display:flex;flex-direction:column}.logo{padding:24px 20px;border-bottom:1px solid #ffffff15}.logo b,.logo span{display:block}.logo b{font-size:18px}.logo span{color:#b6c7c0;font-size:12px}nav{padding:14px 10px;display:grid;gap:5px}nav button{border:0;background:transparent;color:#cbd8d3;text-align:left;padding:11px 14px}nav button.active,nav button:hover{background:#ffffff14;color:#fff}.user{margin-top:auto;padding:16px;border-top:1px solid #ffffff15}.user span{display:block;margin-bottom:9px}.user button{font-size:12px;padding:5px 8px;background:transparent;color:#b6c7c0;border-color:#ffffff25}main{grid-column:2;padding:0 26px 40px}main>header{height:82px;display:flex;align-items:center;gap:14px}main>header h1{font-size:23px;margin:0}main>header p{color:var(--muted);margin:2px 0 0}main>header .primary{margin-left:auto}#menuBtn{display:none}.page{display:none}.page.active{display:block}.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.cards article,.panel,.table-wrap{background:#fff;border:1px solid var(--line);border-radius:10px}.cards article{padding:20px}.cards span{display:block;color:var(--muted)}.cards strong{display:block;font-size:28px;margin-top:8px}.cards .warning strong{color:var(--warn)}.panel{margin-top:18px;padding:20px}.panel h2{font-size:17px;margin:0 0 18px}.steps{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.steps div{display:flex;align-items:center;gap:10px;color:var(--muted)}.steps b{border-radius:50%;background:#e4f1ec;color:var(--green);width:30px;height:30px;display:grid;place-items:center}.toolbar{display:flex;gap:10px;margin-bottom:14px}.toolbar input,.toolbar select{width:220px}.toolbar .primary{margin-left:auto}.table-wrap{overflow:auto}table{border-collapse:collapse;width:100%;min-width:760px}th,td{padding:12px 14px;border-bottom:1px solid #edf0ef;text-align:left;white-space:nowrap}th{font-size:12px;color:var(--muted);background:#fafbfa}.num{text-align:right}tbody tr:hover{background:#f8fbfa}.badge{display:inline-block;border-radius:20px;padding:2px 8px;background:#e4f1ec;color:var(--green);font-size:12px}.badge.off{background:#eee;color:#777}.empty{text-align:center;color:var(--muted);padding:35px}dialog{border:0;border-radius:12px;padding:0;width:min(700px,94vw);box-shadow:0 20px 60px #0005}dialog::backdrop{background:#0b171380}dialog header,dialog footer{display:flex;align-items:center;padding:16px 20px;border-bottom:1px solid var(--line)}dialog header h2{margin:0;font-size:18px}dialog header button{margin-left:auto;border:0;font-size:20px}dialog footer{justify-content:flex-end;gap:9px;border:0;border-top:1px solid var(--line)}#modalBody{padding:20px;max-height:68vh;overflow:auto}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}.form-grid label{color:var(--muted)}.form-grid label span{display:block;margin-bottom:4px}.span2{grid-column:1/-1}.sale-line{display:grid;grid-template-columns:2fr .7fr .8fr auto;gap:8px;margin:8px 0}.sale-total{text-align:right;font-size:18px;margin-top:16px}#toast{position:fixed;right:24px;bottom:24px;padding:11px 18px;border-radius:8px;background:#17211e;color:white;opacity:0;pointer-events:none;transition:.2s}#toast.show{opacity:1}@media(max-width:800px){#app{display:block}aside{transform:translateX(-100%);transition:.2s;z-index:5}aside.open{transform:none}main{padding:0 12px}main>header{height:70px}#menuBtn{display:block}.cards{grid-template-columns:1fr 1fr}.steps{grid-template-columns:1fr}.toolbar{flex-wrap:wrap}.toolbar input,.toolbar select{width:100%}.toolbar .primary{margin-left:0}.form-grid{grid-template-columns:1fr}.span2{grid-column:auto}.sale-line{grid-template-columns:1fr 70px 85px auto}}


.receipt{width:100%;max-width:900px;margin:auto;background:#fff;color:#111;font-family:"Microsoft YaHei",sans-serif;padding:8px}.receipt h1{text-align:center;font-size:24px;margin:4px 0 18px;font-weight:700}.receipt-meta{display:grid;grid-template-columns:1fr 1fr;gap:7px 30px;font-size:14px;margin-bottom:9px}.receipt-no{grid-column:2}.receipt table{min-width:0;border:2px solid #111;table-layout:fixed}.receipt th,.receipt td{border:1px solid #111;padding:8px 7px;white-space:normal;background:#fff;color:#111}.receipt th:nth-child(1){width:7%}.receipt th:nth-child(2){width:35%}.receipt th:nth-child(3){width:8%}.receipt th:nth-child(4),.receipt th:nth-child(5),.receipt th:nth-child(6){width:11%}.receipt th:nth-child(7){width:17%}.receipt .item-name small{display:block;color:#666;font-size:10px}.receipt .blank-row{height:38px}.receipt .total-row td{font-weight:700}.receipt .total-row td:first-child{text-align:right}.receipt-bottom{font-size:13px;margin-top:9px}.receipt-bottom p{margin:7px 0}.receipt-bottom p span:last-child{float:right}.receipt-actions{display:flex;justify-content:center;gap:10px;margin-top:18px}
@media(max-width:800px){.receipt{min-width:700px}.receipt-actions{position:sticky;left:0}.receipt h1{font-size:20px}}
@media print{body *{visibility:hidden!important}#receipt,#receipt *{visibility:visible!important}#receipt{position:absolute;left:0;top:0;width:100%;max-width:none;padding:8mm}.receipt-actions,dialog>form>header,dialog>form>footer{display:none!important}@page{size:A4 landscape;margin:8mm}}

dialog>form{display:flex;flex-direction:column;max-height:92vh}dialog>form>header{flex:0 0 auto}dialog>form>footer{flex:0 0 auto;position:sticky;bottom:0;background:#fff;z-index:3}#modalBody{flex:1 1 auto;min-height:0;overflow:auto}
.select-search{margin-bottom:6px;background:#fbfcfc}.sale-line{grid-template-columns:1.1fr 2fr .7fr .8fr auto}
.inv-line{display:grid;grid-template-columns:1.1fr 2fr .7fr .8fr auto;gap:8px;margin:8px 0}.party-fields{display:grid;grid-template-columns:1fr 1fr;gap:13px}.partner-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.partner-grid h2{font-size:17px}
.line-head{display:grid;grid-template-columns:1.1fr 2fr .7fr .8fr auto;gap:8px;margin:8px 0 2px;color:var(--muted);font-size:12px}.sortable{cursor:pointer;padding-right:24px;position:relative}.sortable:after{content:'↕';position:absolute;right:8px;color:#a7b0ad}.sortable.sort-asc:after{content:'↑';color:var(--green)}.sortable.sort-desc:after{content:'↓';color:var(--green)}.filter-row th{padding:6px}.filter-row select{min-width:78px;padding:6px;font-size:12px;font-weight:400;background:#fff}
.resizable{position:relative;min-width:55px}.col-resizer{position:absolute;z-index:4;right:-3px;top:0;width:8px;height:100%;cursor:col-resize;border-right:2px solid transparent}.col-resizer:hover{border-right-color:var(--green)}body.resizing-column,body.resizing-column *{cursor:col-resize!important;user-select:none!important}.page>h2{font-size:17px;margin:22px 0 10px}.stocktake-note{margin:0 0 18px}.table-wrap table{width:max-content;min-width:100%}.filter-row th{overflow:visible}
@media(max-width:800px){.sale-line{grid-template-columns:1fr 1fr 70px 85px auto}.line-search{grid-column:1/-1}}
@media(max-width:800px){.inv-line{grid-template-columns:1fr 1fr 70px 85px auto}.inv-line .line-search{grid-column:1/-1}.party-fields,.partner-grid{grid-template-columns:1fr}}
@media(max-width:800px){.line-head{display:none}}

/* Refined, spacious dashboard and shared controls */
:root{--nav:#101820;--green:#0071e3;--green2:#005bb8;--bg:#f5f5f7;--line:#e5e5ea;--text:#1d1d1f;--muted:#6e6e73;--warn:#d97706}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;letter-spacing:.005em}
aside{background:#17191d;box-shadow:1px 0 16px #0000000a}
nav button{border-radius:10px;transition:background .18s,color .18s,transform .18s}
nav button:hover{transform:translateX(2px)}
nav button.active{background:#ffffff20}
main{max-width:1920px;margin:0 auto;padding-left:32px;padding-right:32px}
main>header{height:98px}
main>header h1{font-size:27px;letter-spacing:-.035em;font-weight:700}
button{border-radius:10px;transition:background .18s,border-color .18s,box-shadow .18s,transform .18s}
button:hover{box-shadow:0 3px 12px #00000010}
button.primary{font-weight:600}
button.primary:hover{transform:translateY(-1px)}
input,select,textarea{border-radius:10px;border-color:#d5d5d9;transition:border-color .18s,box-shadow .18s}
input:focus,select:focus,textarea:focus{outline:none;border-color:#0071e3;box-shadow:0 0 0 3px #0071e322}
.table-wrap,.panel,.cards article{border-color:#e9e9ed;border-radius:16px;box-shadow:0 6px 24px #00000005}
th{background:#fafafa;color:#6e6e73}tbody tr:hover{background:#f5f9ff}
dialog{border-radius:18px;box-shadow:0 24px 80px #0003}
dialog::backdrop{background:#10182080;backdrop-filter:blur(5px)}
.dash-hero{display:flex;justify-content:space-between;align-items:end;gap:24px;padding:30px 34px;background:linear-gradient(120deg,#fff 45%,#eaf4ff);border:1px solid #eceff4;border-radius:24px;box-shadow:0 12px 35px #00000008}
.eyebrow{font-size:11px;letter-spacing:.18em;font-weight:700;color:#0071e3}
.dash-hero h2{font-size:clamp(27px,3vw,42px);line-height:1.18;letter-spacing:-.05em;margin:12px 0 10px}
.dash-hero p{color:var(--muted);margin:0;font-size:15px}
.dash-range{display:flex;align-items:end;gap:10px;flex-wrap:wrap}
.dash-range label{color:var(--muted);font-size:12px}.dash-range input{display:block;width:155px;margin-top:6px}.dash-range button{height:39px}
.dash-presets{display:flex;gap:8px;margin:18px 0 0}.dash-presets button{border-radius:999px;padding:7px 15px;background:#fff}
.dash-caption{font-size:12px;color:var(--muted);margin:12px 0 16px}
.dash-cards{grid-template-columns:repeat(3,minmax(0,1fr))}.dash-cards article{min-height:132px;padding:22px 24px}.dash-cards article strong{font-size:30px;letter-spacing:-.045em;line-height:1.2}.dash-cards article small{display:block;margin-top:9px;color:var(--muted);font-size:12px}
.dash-grid{display:grid;grid-template-columns:minmax(0,1.8fr) minmax(280px,1fr);gap:18px;margin-top:18px}.dash-grid .panel{margin-top:0;min-width:0;padding:24px}.panel-head{display:flex;justify-content:space-between;align-items:start;gap:16px}.panel-head h3{font-size:19px;letter-spacing:-.025em;margin:4px 0 0}.muted{color:var(--muted);font-size:12px}
.chart-legend{display:flex;gap:16px;flex-wrap:wrap;margin:22px 0 10px;color:var(--muted);font-size:12px}.chart-legend span:before{content:'';display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px;background:currentColor}.legend-sales{color:#0071e3}.legend-receipts{color:#30a46c}.legend-purchases{color:#ff9f0a}.legend-expenses{color:#af52de}
.dash-chart{height:275px}.dash-chart svg{width:100%;height:240px;overflow:visible}.chart-axis{display:flex;justify-content:space-between;color:var(--muted);font-size:11px;margin:0 22px}.dash-empty{display:grid;place-items:center;color:var(--muted);min-height:180px;font-size:13px}
.channel-row{margin-top:18px}.channel-row>div:first-child{display:flex;justify-content:space-between;gap:12px;font-size:13px}.channel-row span{color:var(--muted)}.channel-track{height:7px;border-radius:9px;background:#edf1f5;margin-top:9px;overflow:hidden}.channel-track i{display:block;height:100%;background:linear-gradient(90deg,#0071e3,#69b7ff);border-radius:9px}
.dash-secondary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:18px 0}.dash-secondary article{background:#fff;border:1px solid #e9e9ed;border-radius:15px;padding:18px 20px}.dash-secondary span{display:block;color:var(--muted);font-size:12px}.dash-secondary strong{display:block;font-size:21px;margin-top:6px;letter-spacing:-.03em}
.cashflow-report{margin-top:18px;padding:24px}.cashflow-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin-top:18px}.cashflow-grid article{padding:16px;border-radius:13px;background:#f5f5f7}.cashflow-grid span,.cashflow-grid small{display:block;color:#6e6e73;font-size:12px}.cashflow-grid b{display:block;margin:8px 0;font-size:21px;letter-spacing:-.035em}.cashflow-status{padding:6px 10px;border-radius:999px;font-size:12px;background:#f2f2f7}.positive{color:#16803a}.negative{color:#d70015}@media(max-width:1000px){.cashflow-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:520px){.cashflow-grid{grid-template-columns:1fr}.cashflow-report{padding:18px}}
.attachment-preview{margin:0 0 16px;padding:14px;border:1px solid #e5e5ea;border-radius:12px}.attachment-preview b{display:block;margin-bottom:10px}.attachment-preview img{display:block;max-width:100%;max-height:58vh;margin-bottom:10px;border-radius:8px}.attachment-preview iframe{display:block;width:100%;height:58vh;border:0;border-radius:8px;margin-bottom:10px}
@media(max-width:1100px){.dash-grid{grid-template-columns:1fr}.dash-secondary{grid-template-columns:repeat(2,1fr)}}
@media(max-width:800px){main{padding:0 14px 30px}.dash-hero{display:block;padding:24px}.dash-range{margin-top:22px}.dash-range label{flex:1}.dash-range input{width:100%}.dash-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.dash-cards article{padding:17px}.dash-cards article strong{font-size:23px}.dash-presets{overflow:auto}.dash-secondary{gap:8px}}
@media(max-width:460px){.dash-cards{grid-template-columns:1fr 1fr}.dash-secondary{grid-template-columns:1fr 1fr}.dash-secondary article{padding:14px}.dash-secondary strong{font-size:18px}.dash-hero h2{font-size:29px}}
.edit-ledger{display:grid;gap:14px}.edit-block{border:1px solid #e7e9ed;border-radius:15px;padding:17px;background:#fbfbfd}.edit-block-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.edit-block-title span{font-size:15px;font-weight:700;color:#1d1d1f}.edit-block-title small{color:#86868b;font-size:11px}.edit-block>label{display:block;color:var(--muted)}.edit-block>label textarea{margin-top:6px;background:#fff}#editInvPartners>div:not(.edit-block-title){display:grid;grid-template-columns:1fr;gap:13px}#editInvPartners .party-fields{grid-template-columns:1fr 1fr}.edit-ledger input:disabled,.edit-ledger select:disabled{background:#f0f1f3;color:#888}@media(max-width:620px){#editInvPartners .party-fields{grid-template-columns:1fr}.edit-block{padding:14px}}
.export-btn{color:#0066cc;border-color:#c9ddf2;background:#f7fbff;font-weight:600}.export-btn:hover{background:#edf6ff;border-color:#8bbbe9}.export-btn:active{transform:scale(.98)}

/* Tables size themselves once per layout; no pointer-tracking column resize. */
.table-wrap>table{width:100%;min-width:760px;table-layout:auto!important}.table-wrap>table th,.table-wrap>table td{width:auto!important}.resizable{min-width:0}.col-resizer{display:none!important}.filter-row select{max-width:100%}

/* Premium landscape sales document */
dialog.receipt-dialog{width:min(1180px,97vw);max-width:none;border-radius:16px}.receipt-dialog #modalBody{padding:18px;background:#e9eef5}.receipt{position:relative;width:100%;max-width:1100px;margin:auto;padding:0 28px 18px;overflow:hidden;background:#fff;color:#152b47;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;border:1px solid #d7e0eb;box-shadow:0 18px 55px #16334f22}.receipt-accent{height:112px;margin:0 -28px;background:linear-gradient(125deg,#365574 0%,#132d4c 47%,#254564 100%);position:absolute;inset:0 0 auto;overflow:hidden}.receipt-accent:before,.receipt-accent:after{content:'';position:absolute;right:3%;top:-60px;width:140px;height:230px;border-left:18px solid #b9cce0;transform:skewX(-30deg);opacity:.8}.receipt-accent:after{right:11%;border-left-width:46px;opacity:.16}.receipt-head{height:112px;position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between;color:white}.receipt-brand{display:flex;align-items:center;gap:17px}.receipt-logo{width:54px;height:54px;border:2px solid #d9e7f5;border-radius:13px;display:grid;place-items:center;font-size:29px;font-weight:800;background:#ffffff13}.receipt-brand h1{font-size:28px;line-height:1.1;letter-spacing:.02em;text-align:left;margin:0;color:#fff}.receipt-brand p{margin:8px 0 0;letter-spacing:.22em;color:#bfcfe0;font-size:11px}.receipt-slogan{border-left:1px solid #ffffff80;padding-left:24px;margin-right:90px}.receipt-slogan b,.receipt-slogan span{display:block}.receipt-slogan b{font-size:15px;letter-spacing:.12em}.receipt-slogan span{margin-top:8px;font-size:9px;line-height:1.55;letter-spacing:.1em;color:#bccbdb}.receipt-meta{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 22px;padding:22px 0 20px;margin:0;font-size:13px}.receipt-meta>div{display:grid;grid-template-columns:88px minmax(0,1fr);align-items:center;min-width:0}.receipt-meta span{background:#eef3f8;padding:7px 10px;color:#294766;font-weight:600}.receipt-meta b{padding-left:12px;color:#17212c;overflow-wrap:anywhere}.receipt-meta .wide{grid-column:span 2}.receipt table{width:100%;min-width:0;border:1px solid #718aa5;border-collapse:collapse;table-layout:fixed!important}.receipt th,.receipt td{border:1px solid #b2c1d1;padding:10px 9px;white-space:normal;background:#fff;color:#182536}.receipt thead th{background:linear-gradient(180deg,#344f6e,#243e5d);color:#fff;font-size:12px;text-align:center;font-weight:700}.receipt tbody td:first-child,.receipt tbody td:nth-child(3){text-align:center}.receipt th:nth-child(1){width:6%}.receipt th:nth-child(2){width:30%}.receipt th:nth-child(3){width:7%}.receipt th:nth-child(4){width:14%}.receipt th:nth-child(5){width:9%}.receipt th:nth-child(6){width:15%}.receipt th:nth-child(7){width:19%}.receipt .item-name b{display:block}.receipt .item-name small{display:block;margin-top:3px;color:#71849a;font-size:9px}.receipt .currency{font-variant-numeric:tabular-nums}.receipt .blank-row{height:34px}.receipt-summary{display:grid;grid-template-columns:1fr 360px;border:1px solid #b2c1d1;border-top:0;background:linear-gradient(90deg,#fff,#edf4fa)}.receipt-note{padding:16px}.receipt-note span,.receipt-bottom span{font-size:10px;letter-spacing:.08em;color:#72859a}.receipt-note p{margin:6px 0;color:#26394d}.receipt-totals{border-left:1px solid #b2c1d1;padding:10px 16px}.receipt-totals p{display:flex;justify-content:space-between;margin:5px 0;font-size:12px}.receipt-totals .grand{font-size:18px;color:#153d68;border-top:1px solid #b8c8d8;border-bottom:1px solid #b8c8d8;padding:8px 0;margin:8px 0}.receipt-bottom{display:grid;grid-template-columns:2fr 1fr 1fr 1.5fr;gap:16px;align-items:end;padding:20px 6px 12px}.receipt-bottom b{display:block;margin-top:5px;color:#182536;font-size:11px}.receipt-bottom .signature i{display:block;border-bottom:1px solid #173c62;margin-top:17px}.receipt-foot{text-align:right;color:#9aaec2;border-top:1px solid #cbd7e3;padding-top:9px;font-size:9px;letter-spacing:.15em}.receipt-actions{display:flex;justify-content:center;gap:10px;margin-top:18px}
@media(max-width:800px){dialog.receipt-dialog{width:98vw}.receipt-dialog #modalBody{overflow:auto}.receipt{min-width:940px}.receipt-brand h1{font-size:25px}.receipt-actions{position:sticky;left:0}}
@media print{body *{visibility:hidden!important}#receipt,#receipt *{visibility:visible!important}#receipt{position:absolute;left:0;top:0;width:100%;max-width:none;padding:0 7mm 4mm;box-shadow:none;border:0}.receipt-accent{margin:0 -7mm}.receipt-actions,dialog>form>header,dialog>form>footer{display:none!important}@page{size:A4 landscape;margin:5mm}}

/* Customer-facing receipt: calm Apple-style form hierarchy. */
.receipt{padding:30px 34px 24px;color:#1d1d1f;border:0;border-radius:18px;box-shadow:0 18px 60px #00000014}.receipt-accent{position:static;height:5px;margin:-30px -34px 27px;background:linear-gradient(90deg,#1d1d1f,#86868b 68%,#d2d2d7)}.receipt-accent:before,.receipt-accent:after{display:none}.receipt-head{height:auto;color:#1d1d1f;padding:0 0 24px;border-bottom:1px solid #d2d2d7}.receipt-brand{gap:15px}.receipt-logo{width:48px;height:48px;border:0;border-radius:13px;background:#1d1d1f;color:#fff;font-size:25px}.receipt-brand h1{font-size:26px;letter-spacing:-.035em;color:#1d1d1f}.receipt-brand p{margin-top:6px;color:#86868b;letter-spacing:.16em}.receipt-meta{grid-template-columns:repeat(2,minmax(0,1fr));gap:0 44px;padding:22px 0}.receipt-meta>div{grid-template-columns:86px minmax(0,1fr);border-bottom:1px solid #ededf0;padding:7px 0}.receipt-meta span{background:transparent;padding:0;color:#86868b;font-size:11px;font-weight:500}.receipt-meta b{padding-left:0;color:#1d1d1f;font-size:13px}.receipt-meta .wide{grid-column:auto}.receipt table{border:1px solid #d2d2d7;border-radius:10px;overflow:hidden}.receipt th,.receipt td{border-color:#e2e2e5;padding:11px 10px;color:#1d1d1f}.receipt thead th{background:#f5f5f7;color:#1d1d1f;font-size:11px}.receipt tbody tr:nth-child(even):not(.total-row) td{background:#fbfbfd}.receipt .total-row td{background:#f5f5f7;color:#1d1d1f;font-size:14px;border-top:1.5px solid #b8b8bd}.receipt .total-row td:first-child{text-align:right;letter-spacing:.08em}.receipt-bottom{grid-template-columns:2fr 1fr 1fr 1.5fr;padding:25px 4px 2px;border-top:0}.receipt-bottom span{color:#86868b}.receipt-bottom b{color:#1d1d1f;font-weight:600}.receipt-bottom .signature i{border-color:#86868b}.receipt .currency{font-feature-settings:"tnum";letter-spacing:.01em}
@media print{#receipt{padding:5mm 7mm;border-radius:0}.receipt-accent{margin:-5mm -7mm 5mm}.receipt{box-shadow:none}}

/* Receipt refinements from customer preview feedback. */
.receipt-brand{gap:0}.receipt-meta{grid-template-columns:1fr 1fr;gap:0 48px}.receipt-meta-column{display:block!important}.receipt-meta-column>div{display:grid;grid-template-columns:86px minmax(0,1fr);align-items:center;min-height:39px;border-bottom:1px solid #c7c7cc}.receipt-meta-column>div span{background:transparent;padding:0;color:#6e6e73;font-size:11px;font-weight:500}.receipt-meta-column>div b{padding-left:0;color:#1d1d1f;font-size:13px;overflow-wrap:anywhere}.receipt table{border:1.5px solid #8e8e93}.receipt th,.receipt td{border:1px solid #b0b0b5}.receipt thead th{border-color:#a1a1a6}.receipt tbody tr:nth-child(even):not(.total-row) td{background:#fafafa}.receipt td.num,.receipt th.num,.receipt tbody td:nth-child(1),.receipt tbody td:nth-child(3),.receipt tbody td:nth-child(4),.receipt tbody td:nth-child(5),.receipt tbody td:nth-child(6){text-align:center!important}.receipt .total-row td{border-color:#a1a1a6;border-top:1.5px solid #8e8e93}.receipt .total-row td:first-child{text-align:right!important;padding-right:24px}

/* Remove structural wrapper lines; highlight numeric cells as a coherent group. */
.receipt-meta>.receipt-meta-column{display:block!important;min-height:0;padding:0;border:0;background:transparent}.receipt-meta-column>div:last-child{border-bottom-color:#b8b8bd}.receipt tbody td:nth-child(4),.receipt tbody td:nth-child(5),.receipt tbody td:nth-child(6){background:#f4f7fb}.receipt tbody tr:nth-child(even):not(.total-row) td:nth-child(4),.receipt tbody tr:nth-child(even):not(.total-row) td:nth-child(5),.receipt tbody tr:nth-child(even):not(.total-row) td:nth-child(6){background:#eef3f8}.receipt tbody td:nth-child(4){border-left:1.5px solid #9da9b5}.receipt tbody td:nth-child(6){border-right:1.5px solid #9da9b5}.receipt .total-row td{background:#edf2f7!important}.receipt .total-row td:nth-child(5),.receipt .total-row td:nth-child(6){color:#0a4f8a;font-size:15px}.receipt,.receipt *{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}
@media print{html,body{width:100%;height:auto;background:#fff!important}.receipt{padding:5mm 7mm;border:1px solid #d2d2d7!important;border-radius:12px!important;overflow:hidden!important}.receipt-accent{margin:-5mm -7mm 5mm!important}.receipt-meta>.receipt-meta-column{border:0!important}.receipt th,.receipt td{border-color:#aeb5bd!important}.receipt tbody td:nth-child(4),.receipt tbody td:nth-child(5),.receipt tbody td:nth-child(6){background:#f4f7fb!important}.receipt .total-row td{background:#edf2f7!important}}

/* Borderless tile layout inspired by Apple's product grids. */
.receipt-brand h1{font-size:27px;line-height:1.18;font-weight:700;letter-spacing:-.045em}.receipt-brand p{font-size:10px;line-height:1.4;letter-spacing:.17em}.receipt-meta{gap:4px 54px;padding:24px 0 22px}.receipt-meta>.receipt-meta-column,.receipt-meta-column>div{border:0!important}.receipt-meta-column>div{min-height:36px;grid-template-columns:90px minmax(0,1fr);padding:3px 0}.receipt-meta-column>div span{font-size:11px;line-height:1.3;color:#86868b}.receipt-meta-column>div b{font-size:13px;line-height:1.45;font-weight:600}.receipt table{border:0!important;border-collapse:separate;border-spacing:2px;background:#fff;border-radius:13px;overflow:hidden}.receipt th,.receipt td{border:0!important}.receipt thead th{height:42px;padding:9px 10px;background:#f1f1f3;color:#3a3a3c;font-size:11px;line-height:1.25;font-weight:650}.receipt tbody td{height:49px;padding:11px 10px;background:#fafafa!important;font-size:13px;line-height:1.35}.receipt tbody tr:nth-child(even):not(.total-row) td{background:#f7f7f8!important}.receipt tbody td:nth-child(4),.receipt tbody td:nth-child(5),.receipt tbody td:nth-child(6){background:#fafafa!important}.receipt tbody tr:nth-child(even):not(.total-row) td:nth-child(4),.receipt tbody tr:nth-child(even):not(.total-row) td:nth-child(5),.receipt tbody tr:nth-child(even):not(.total-row) td:nth-child(6){background:#f7f7f8!important}.receipt .item-name b{font-size:14px;line-height:1.35}.receipt .item-name small{font-size:9px;line-height:1.3;margin-top:4px}.receipt .currency{font-size:14px}.receipt .blank-row{height:38px}.receipt .blank-row td{height:38px}.receipt .total-row td{height:48px;background:#f1f1f3!important;border:0!important;color:#1d1d1f!important;font-size:14px;font-weight:650}.receipt .total-row td:nth-child(5),.receipt .total-row td:nth-child(6){font-size:16px;color:#1d1d1f!important}.receipt .total-row td:first-child{padding-right:24px}.receipt-bottom{padding-top:24px}.receipt-bottom span{font-size:10px}.receipt-bottom b{font-size:11px;line-height:1.4}.receipt-bottom .signature i{border-bottom:1px solid #a1a1a6}
@media print{.receipt{border:0!important}.receipt-meta>.receipt-meta-column,.receipt-meta-column>div{border:0!important}.receipt table,.receipt th,.receipt td{border:0!important}.receipt thead th{background:#f1f1f3!important}.receipt tbody td,.receipt tbody td:nth-child(4),.receipt tbody td:nth-child(5),.receipt tbody td:nth-child(6){background:#fafafa!important}.receipt tbody tr:nth-child(even):not(.total-row) td{background:#f7f7f8!important}.receipt .total-row td{background:#f1f1f3!important}}
.receipt tbody tr.total-row>td,.receipt tbody tr.total-row>td:nth-child(4),.receipt tbody tr.total-row>td:last-child{background:#f1f1f3!important}.receipt tbody tr.total-row>td:last-child{border-radius:0 0 11px 0}
@media print{.receipt tbody tr.total-row>td,.receipt tbody tr.total-row>td:nth-child(4),.receipt tbody tr.total-row>td:last-child{background:#f1f1f3!important}}

/* Larger, more legible customer-facing receipt typography. */
.receipt-meta-column>div span{font-size:12px}.receipt-meta-column>div b{font-size:14px}.receipt thead th{font-size:12.5px}.receipt tbody td{font-size:14px}.receipt .item-name b{font-size:15px}.receipt .item-name small{font-size:10px}.receipt .currency{font-size:15px}.receipt .total-row td{font-size:15px}.receipt .total-row td:nth-child(5),.receipt .total-row td:nth-child(6){font-size:17px}.receipt-bottom span{font-size:11px}.receipt-bottom b{font-size:13px}

dialog.sale-edit-dialog{width:min(1080px,96vw);max-width:none}.sale-edit-section{border:1px solid #e5e5ea;border-radius:16px;background:#fbfbfd;padding:17px}.sale-edit-head,.sale-edit-line{display:grid;grid-template-columns:1.15fr 2.15fr .65fr .8fr 1fr 46px;gap:8px;align-items:center}.sale-edit-head{padding:0 3px 7px;color:#86868b;font-size:11px}.sale-edit-line{padding:9px 0;border-top:1px solid #ededf0}.sale-edit-line:first-child{border-top:0}.sale-edit-line input,.sale-edit-line select{min-width:0}.sale-edit-line .seq,.sale-edit-line .seu{text-align:center;font-variant-numeric:tabular-nums}.sale-edit-line button{padding:8px;color:#b42318}.sale-edit-section>#addSaleEditLine{margin-top:10px}.sale-edit-total{text-align:right;margin-top:14px;padding-top:13px;border-top:1px solid #d2d2d7;color:#6e6e73}.sale-edit-total b{margin-left:12px;color:#1d1d1f;font-size:20px;letter-spacing:-.03em}@media(max-width:800px){dialog.sale-edit-dialog{width:98vw}.sale-edit-head{display:none}.sale-edit-line{grid-template-columns:1fr 1fr 80px 100px 1fr 42px}.sale-edit-line .ses,.sale-edit-line .sep{grid-column:span 3}}

/* Filter-aware totals shown directly below the main table headings. */
.summary-row th{padding:9px 14px;background:#eef3f7;color:#3a4650;font-size:12px;font-weight:700;border-bottom:1px solid #d8e0e6;font-variant-numeric:tabular-nums}.summary-row th:first-child{color:#6e777f;letter-spacing:.04em}.summary-row th.num{text-align:right;color:#17211e}.filter-row th{border-bottom-color:#dfe5e2}
.logistics-col{text-align:center;font-variant-numeric:tabular-nums}
.nav-children{display:grid;gap:3px;margin:-2px 0 5px;padding-left:12px;border-left:1px solid #ffffff20}.nav-children button{padding:8px 14px!important;font-size:13px;color:#aebdb7!important}.nav-children button.active,.nav-children button:hover{color:#fff!important;background:#ffffff12!important}.nav-arrow{float:right;transition:transform .18s ease}.expanded .nav-arrow{transform:rotate(180deg)}.finance-module>h2{margin-top:4px}.expense-summary-cards{grid-template-columns:repeat(2,minmax(0,1fr));margin:0 0 14px}.expense-summary-cards article{padding:16px 20px}.expense-summary-cards strong{font-size:24px}.expense-summary-cards small{display:block;margin-top:3px;color:var(--muted)}

/* Unified typography for screen and printed documents. */
html,body,button,input,select,textarea,table,dialog,svg text{font-family:"Microsoft YaHei","微软雅黑",sans-serif!important}

/* Enlarged receipt type with coordinated spacing for screen and A4 landscape. */
.receipt-brand h1{font-size:34px;line-height:1.2}.receipt-brand p{font-size:12px;line-height:1.5;margin-top:8px}.receipt-meta{padding:28px 0 26px;gap:6px 58px}.receipt-meta-column>div{min-height:44px;grid-template-columns:108px minmax(0,1fr);padding:5px 0}.receipt-meta-column>div span{font-size:15px;line-height:1.4}.receipt-meta-column>div b{font-size:18px;line-height:1.45}.receipt thead th{height:52px;padding:12px 10px;font-size:16px;line-height:1.35}.receipt tbody td{height:62px;padding:14px 11px;font-size:18px;line-height:1.45}.receipt .item-name b{font-size:20px;line-height:1.4}.receipt .item-name small{font-size:12px;line-height:1.4;margin-top:5px}.receipt .currency{font-size:19px}.receipt .blank-row,.receipt .blank-row td{height:46px}.receipt .total-row td{height:58px;font-size:19px}.receipt .total-row td:nth-child(5),.receipt .total-row td:nth-child(6){font-size:22px}.receipt-bottom{padding-top:29px;gap:20px}.receipt-bottom span{font-size:13px}.receipt-bottom b{font-size:16px;line-height:1.5}.receipt-bottom .signature i{margin-top:23px}
@media print{.receipt-brand h1{font-size:30px}.receipt-meta-column>div span{font-size:13px}.receipt-meta-column>div b{font-size:16px}.receipt thead th{font-size:14px;height:46px}.receipt tbody td{font-size:16px;height:54px}.receipt .item-name b{font-size:18px}.receipt .currency{font-size:17px}.receipt .total-row td{font-size:17px;height:52px}.receipt .total-row td:nth-child(5),.receipt .total-row td:nth-child(6){font-size:20px}.receipt-bottom span{font-size:12px}.receipt-bottom b{font-size:14px}}



.paste-file-zone{display:block;margin-top:8px;padding:13px 14px;border:1px dashed #b6bbc3;border-radius:10px;background:#f5f5f7;color:#6e6e73;text-align:center;cursor:text;transition:border-color .18s,background .18s,color .18s}.paste-file-zone:hover,.paste-file-zone:focus{outline:0;border-color:#0071e3;background:#f0f7ff;color:#0066cc}.paste-file-zone.has-file{border-style:solid;border-color:#68a77a;background:#f1f8f3;color:#246b38}

/* Sites UX pass: a calm, high-density business workspace. */
:root{--nav:#111c19;--green:#0b6b53;--green2:#075440;--bg:#f3f5f4;--line:#dde3e0;--text:#17201d;--muted:#69746f;--blue:#0066cc;--danger:#b42318;--shadow:0 10px 35px #16231e12}
html{scroll-behavior:smooth}body{font-size:15px;line-height:1.55;background:radial-gradient(circle at 86% -10%,#e8f3ef 0,transparent 28%),var(--bg)}
button,input,select,textarea{min-height:42px;font-size:14px;border-radius:10px;transition:border-color .16s,background .16s,box-shadow .16s,transform .12s,opacity .16s}button{font-weight:600;border-color:#d8dedb;box-shadow:0 1px 2px #13221c08}button:hover{border-color:#aab8b2;background:#f8faf9}button:active{transform:translateY(1px)}button:disabled{cursor:wait;opacity:.58;transform:none}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,.paste-file-zone:focus-visible{outline:3px solid #0b6b5330;outline-offset:2px;border-color:var(--green)}button.primary{box-shadow:0 5px 14px #0b6b5324}.quiet{background:#f7f8f8;color:#53605b}.danger{color:var(--danger)!important;border-color:#f0c9c5!important;background:#fffafa!important}.danger:hover{background:#fff0ee!important;border-color:#e5a49e!important}
#requestProgress{position:fixed;z-index:9999;inset:0 auto auto 0;width:0;height:3px;background:linear-gradient(90deg,#0b6b53,#43b890);opacity:0;transition:opacity .18s,width .35s}#requestProgress.active{width:72%;opacity:1;animation:request-progress 1.3s ease-in-out infinite}@keyframes request-progress{0%{transform:translateX(-70%)}55%{transform:translateX(45%)}100%{transform:translateX(140%)}}
#app{grid-template-columns:248px minmax(0,1fr)}aside{width:248px;background:linear-gradient(180deg,#13231f,#0f1b18);border-right:1px solid #ffffff0d;box-shadow:8px 0 30px #10251b0d;z-index:20}.logo{padding:27px 22px 22px}.logo b{font-size:20px;letter-spacing:.02em}.logo span{font-size:13px;margin-top:2px}nav{padding:15px 12px;gap:4px;overflow:auto}nav button{min-height:44px;padding:10px 14px;border-radius:10px;font-size:15px;font-weight:500;color:#bfcac6}nav button.active{background:linear-gradient(90deg,#ffffff1c,#ffffff0d);color:#fff;box-shadow:inset 3px 0 #4fc49c}nav button:hover{background:#ffffff10;color:#fff}.nav-children{margin:2px 0 7px 20px;padding-left:8px}.nav-children button{min-height:38px;font-size:14px!important}.user{padding:18px}.user>span{font-weight:700;color:#fff}.user button{min-height:34px}
main{grid-column:2;padding:0 clamp(18px,2.5vw,38px) 48px;min-width:0}main>header{position:sticky;top:0;z-index:12;height:88px;margin:0 calc(clamp(18px,2.5vw,38px)*-1) 12px;padding:0 clamp(18px,2.5vw,38px);background:#f3f5f4e8;backdrop-filter:blur(18px);border-bottom:1px solid #dce3dfb8}main>header h1{font-size:26px;letter-spacing:-.04em}main>header p{font-size:13px}.page.active{animation:page-in .18s ease-out}@keyframes page-in{from{opacity:.35;transform:translateY(3px)}to{opacity:1;transform:none}}
.toolbar{align-items:center;gap:9px;margin:0 0 16px;padding:11px;background:#ffffffc7;border:1px solid #e1e6e3;border-radius:14px;box-shadow:0 5px 18px #17211e09;backdrop-filter:blur(12px)}.toolbar input,.toolbar select{width:min(240px,28vw);background:#fff}.toolbar button{white-space:nowrap}.toolbar .primary{margin-left:auto}
.table-wrap{border:1px solid #e0e5e2;border-radius:14px;box-shadow:var(--shadow);background:#fff;max-height:calc(100vh - 205px);overscroll-behavior:contain}.table-wrap table{font-size:14px}.table-wrap thead{position:sticky;top:0;z-index:4}.table-wrap th{height:45px;padding:10px 13px;background:#f7f8f8;color:#56625d;font-size:13px;font-weight:700;border-bottom-color:#dfe4e1}.table-wrap td{padding:12px 13px;border-bottom-color:#ecefed}.table-wrap tbody tr{transition:background .12s}.table-wrap tbody tr:hover{background:#f5f9f7}.table-wrap tbody tr:last-child td{border-bottom:0}.filter-row select{min-height:34px;padding:6px 8px;font-size:13px;background:#fff}.summary-row th{background:#edf3f0;color:#2f3c37}.summary-row th.num{color:#0b5b47}.sortable{user-select:none}.sortable:hover{color:#0b6b53}.badge{font-size:13px;font-weight:600;padding:3px 9px}.empty{font-size:14px;color:#7b8782;background:#fbfcfb}
.cards article,.panel,.dash-secondary article{border-color:#e1e6e3!important;box-shadow:0 7px 24px #17211e0b!important}.dash-hero{min-height:0;padding:24px 27px;border-radius:18px;background:linear-gradient(135deg,#132821,#21483b);box-shadow:0 14px 35px #16382b26}.dash-hero h2{font-size:30px;margin:3px 0}.dash-hero p{margin:4px 0 0}.dash-range{align-items:end}.dash-range input{min-width:150px}.dash-cards{gap:12px}.dash-cards article{min-height:125px;border-radius:15px}.dash-cards article strong{font-size:25px}.dash-grid{gap:14px}.panel{border-radius:16px}.dash-secondary article{border-radius:14px}
dialog{width:min(760px,94vw);max-height:92vh;border-radius:18px;box-shadow:0 28px 90px #07140e55;overflow:hidden}dialog::backdrop{background:#07140e80;backdrop-filter:blur(3px)}dialog>form>header{padding:18px 22px;background:#fff}dialog>form>header h2{font-size:20px;letter-spacing:-.02em}dialog>form>footer{padding:13px 20px;background:#fbfcfb;border-top:1px solid #e4e8e6}#modalBody{padding:22px;max-height:70vh;background:#fff}.form-grid{gap:16px}.form-grid label{font-size:14px;font-weight:500;color:#5e6a65}.form-grid label>span{margin-bottom:6px}.form-grid input,.form-grid select,.form-grid textarea{margin-top:0;background:#fff}.form-grid textarea{min-height:90px;resize:vertical}.is-saving #modalBody{pointer-events:none;opacity:.72}
#toast{right:26px;bottom:26px;max-width:min(420px,calc(100vw - 32px));padding:13px 18px;border:1px solid #ffffff20;border-radius:12px;background:#16342b!important;box-shadow:0 16px 45px #07140e35;font-size:14px;transform:translateY(12px);opacity:0}.show#toast{opacity:1;transform:none}.bad#toast{background:#9d2d25!important}
#navBackdrop{display:none;position:fixed;z-index:19;inset:0;width:100%;height:100%;padding:0;border:0;border-radius:0;background:#07140e66;box-shadow:none}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
@media(max-width:1000px){.toolbar{flex-wrap:wrap}.toolbar input,.toolbar select{width:min(260px,44vw)}.dash-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:800px){#app{display:block}aside{width:min(310px,86vw);transform:translateX(-105%);box-shadow:20px 0 70px #07140e55}aside.open{transform:none}#navBackdrop.show{display:block}main{padding:0 12px 32px}main>header{height:72px;margin:0 -12px 12px;padding:0 14px}main>header h1{font-size:22px}main>header p{display:none}main>header .primary{padding:8px 11px}#menuBtn{display:grid;place-items:center;width:42px;padding:0;font-size:0}#menuBtn:after{content:'☰';font-size:20px}.toolbar{padding:9px;border-radius:12px}.toolbar input,.toolbar select{width:100%}.toolbar .primary{margin-left:0}.table-wrap{max-height:calc(100vh - 178px);border-radius:12px}.table-wrap th,.table-wrap td{padding:10px 11px}.dash-hero{padding:20px}.dash-hero h2{font-size:25px}.dash-range{display:grid;grid-template-columns:1fr 1fr}.dash-range button{grid-column:1/-1}.dash-cards{grid-template-columns:1fr 1fr}.form-grid{gap:13px}dialog{width:96vw;border-radius:15px}#modalBody{padding:17px}.receipt-actions{position:sticky;left:0;flex-wrap:wrap}.receipt-actions button{flex:1;min-width:145px}}
@media(max-width:480px){.dash-cards,.dash-secondary{grid-template-columns:1fr}.dash-presets button{flex:0 0 auto}.cards strong{font-size:23px}.toolbar button{flex:1}.toolbar .primary{flex-basis:100%}#toast{right:16px;bottom:16px}}

/* Apple-inspired neutral palette and dashboard visualization. */
:root{--nav:#1d1d1f;--green:#0071e3;--green2:#0062c4;--bg:#f5f5f7;--line:#d2d2d7;--text:#1d1d1f;--muted:#6e6e73;--blue:#0071e3;--danger:#d70015;--shadow:0 12px 34px #0000000b}
body{color:#1d1d1f;background:#f5f5f7}aside{background:#1d1d1f;border-right:1px solid #ffffff0f;box-shadow:none}.logo span,nav button{color:#c7c7cc}nav button.active{background:#ffffff14;box-shadow:inset 3px 0 #2997ff}.nav-children button{color:#a1a1a6!important}.user button{color:#d2d2d7}
button{color:#1d1d1f;border-color:#d2d2d7;background:#fff}button:hover{border-color:#a1a1a6;background:#f5f5f7}button.primary{background:#0071e3;border-color:#0071e3;box-shadow:none}button.primary:hover{background:#0077ed;border-color:#0077ed}.export-btn{color:#0066cc;border-color:#b9d6f2;background:#fff}.export-btn:hover{background:#f0f7ff;border-color:#7cb5eb}input,select,textarea{color:#1d1d1f;border-color:#d2d2d7}input::placeholder,textarea::placeholder{color:#86868b}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,.paste-file-zone:focus-visible{outline-color:#0071e333;border-color:#0071e3}
main>header{background:#f5f5f7e8;border-bottom-color:#d2d2d780}main>header h1{color:#1d1d1f}.toolbar{background:#ffffffd9;border-color:#e5e5ea;box-shadow:0 7px 24px #00000008}.table-wrap{border-color:#e5e5ea;box-shadow:0 10px 34px #00000008}.table-wrap th{background:#f5f5f7;color:#515154;border-bottom-color:#d2d2d7}.table-wrap td{color:#1d1d1f;border-bottom-color:#ededf0}.table-wrap tbody tr:hover{background:#f5f9ff}.summary-row th{background:#eef5fc;color:#515154}.summary-row th.num{color:#0066cc}.sortable:hover{color:#0071e3}.badge{background:#eaf7ed;color:#248a3d}.badge.off{background:#f2f2f2;color:#6e6e73}
.dash-hero{color:#1d1d1f;background:#fff;border:1px solid #e5e5ea;box-shadow:0 12px 36px #00000009}.dash-hero h2{color:#1d1d1f}.dash-hero p{color:#6e6e73}.dash-hero .eyebrow{color:#0066cc}.dash-range label{color:#6e6e73}.dash-presets button{color:#515154;background:#fff}.dash-presets button:hover{color:#0066cc;border-color:#8ec3f2;background:#f5faff}.dash-caption{color:#6e6e73}.cards article,.panel,.dash-secondary article{border-color:#e5e5ea!important;box-shadow:0 10px 30px #00000008!important}.dash-cards article{position:relative;overflow:hidden;background:#fff}.dash-cards article:before{content:'';position:absolute;inset:0 0 auto;height:3px;background:#0071e3}.dash-cards article:nth-child(2):before{background:#34c759}.dash-cards article:nth-child(3):before{background:#ff9f0a}.dash-cards article:nth-child(4):before{background:#af52de}.dash-cards article:nth-child(5):before{background:#5e5ce6}.dash-cards article:nth-child(6):before{background:#1d1d1f}.dash-cards article span,.dash-cards article small,.dash-secondary span{color:#6e6e73}.dash-cards article strong,.dash-secondary strong{color:#1d1d1f}.panel{background:#fff}.panel-head h3{color:#1d1d1f}.muted{color:#86868b}
.chart-legend{gap:8px;margin:17px 0 14px}.chart-legend button{min-height:34px;padding:6px 11px;border:0;border-radius:999px;background:#f5f5f7;color:#86868b;font-size:13px;font-weight:600;box-shadow:none}.chart-legend button:before{content:'';display:inline-block;width:8px;height:8px;margin-right:7px;border-radius:50%;background:currentColor}.chart-legend button.active{color:#1d1d1f;background:#e8e8ed}.chart-legend button:not(.active){opacity:.52}.chart-legend .legend-sales:before{background:#0071e3}.chart-legend .legend-receipts:before{background:#34c759}.chart-legend .legend-purchases:before{background:#ff9f0a}.chart-legend .legend-expenses:before{background:#af52de}
.chart-kpis{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;margin-bottom:10px;border:1px solid #e5e5ea;border-radius:12px;overflow:hidden;background:#e5e5ea}.chart-kpis>div{min-height:66px;padding:10px 14px;background:#fbfbfd}.chart-kpis span{display:block;color:#86868b;font-size:12px}.chart-kpis b{display:inline-block;margin-top:3px;color:#1d1d1f;font-size:17px}.chart-kpis small{margin-left:7px;color:#86868b;font-size:11px}
.dash-chart{position:relative;height:330px;min-width:0}.dash-chart svg{display:block;width:100%;height:310px;overflow:visible}.chart-grid line{stroke:#e5e5ea;stroke-width:1}.chart-grid text{fill:#86868b;font-size:11px}.chart-grid .chart-date{font-size:11px}.chart-area{fill:#0071e30d}.series-line{stroke-width:3;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.chart-dot{stroke:#fff;stroke-width:2;vector-effect:non-scaling-stroke;cursor:pointer;transition:r .15s}.chart-dot:hover,.chart-dot:focus{r:7;outline:none}.chart-tooltip{position:absolute;z-index:3;min-width:150px;padding:10px 12px;border:1px solid #d2d2d7;border-radius:11px;background:#fffffff2;box-shadow:0 12px 35px #0000001a;pointer-events:none;transform:translate(-50%,calc(-100% - 12px));backdrop-filter:blur(15px)}.chart-tooltip b,.chart-tooltip span{display:block}.chart-tooltip b{font-size:12px;color:#6e6e73}.chart-tooltip span{margin-top:3px;color:#1d1d1f;font-size:14px;font-weight:600}.channel-row>div:first-child strong{display:flex;align-items:center;gap:8px}.channel-row>div:first-child strong>i{display:grid;place-items:center;width:23px;height:23px;border-radius:7px;background:#f2f2f7;color:#6e6e73;font-size:11px;font-style:normal}.channel-row>small{display:block;margin-top:6px;color:#86868b;font-size:11px}.channel-track{height:8px;background:#e8e8ed}.channel-track i{background:linear-gradient(90deg,#0071e3,#64b5f6)}
dialog{color:#1d1d1f}dialog::backdrop{background:#00000055}.form-grid label{color:#6e6e73}#toast{background:#1d1d1f!important}.bad#toast{background:#d70015!important}#requestProgress{background:linear-gradient(90deg,#0071e3,#64b5f6)}
@media(max-width:800px){.chart-kpis{grid-template-columns:1fr 1fr 1fr}.chart-kpis>div{padding:9px}.chart-kpis b{font-size:15px}.dash-chart{height:285px}.dash-chart svg{height:270px}.chart-tooltip{min-width:130px}}
@media(max-width:480px){.chart-kpis{grid-template-columns:1fr}.chart-kpis>div{min-height:54px}.chart-legend{overflow:auto;flex-wrap:nowrap}.chart-legend button{flex:0 0 auto}.dash-chart{height:250px}.dash-chart svg{height:235px}}

/* Per-SKU notes in sales entry and a dedicated order-note row on receipts. */
.sale-line,.sale-line-head{grid-template-columns:1.05fr 1.8fr .55fr .7fr 1.2fr 44px}.sale-line .ln{min-width:150px}.receipt .order-note-row td{height:54px!important;padding:12px 18px!important;text-align:left!important;background:#fafafa!important;color:#1d1d1f!important}.receipt .order-note-row b{margin-right:10px;font-size:15px}.receipt .order-note-row span{font-size:15px;white-space:normal;overflow-wrap:anywhere}.receipt .order-note-row+tr.total-row td{border-radius:0!important}
@media(max-width:800px){.sale-line{grid-template-columns:1fr 1fr 78px 96px 1fr 42px}.sale-line .line-search,.sale-line .lp{grid-column:span 3}.sale-line .ln{grid-column:1/-2;min-width:0}.sale-line-head{display:none}}

/* Complete purchase editor: searchable multi-SKU rows with stable responsive layout. */
dialog.purchase-edit-dialog{width:min(1120px,96vw);max-width:none}.purchase-edit-section{border:1px solid #e5e5ea;border-radius:16px;background:#fbfbfd;padding:17px}.purchase-edit-head,.purchase-edit-line{display:grid;grid-template-columns:1.1fr 2fr .65fr .8fr 1.2fr 46px;gap:8px;align-items:center}.purchase-edit-head{padding:0 3px 7px;color:#86868b;font-size:11px}.purchase-edit-line{padding:9px 0;border-top:1px solid #ededf0}.purchase-edit-line:first-child{border-top:0}.purchase-edit-line input,.purchase-edit-line select{min-width:0}.purchase-edit-line .peq,.purchase-edit-line .pec{text-align:center;font-variant-numeric:tabular-nums}.purchase-edit-line button{padding:8px;color:#b42318}.purchase-edit-section>#addPurchaseEditLine{margin-top:10px}.purchase-edit-total{text-align:right;margin-top:14px;padding-top:13px;border-top:1px solid #d2d2d7;color:#6e6e73}.purchase-edit-total b{margin-left:12px;color:#1d1d1f;font-size:20px;letter-spacing:-.03em}@media(max-width:800px){dialog.purchase-edit-dialog{width:98vw}.purchase-edit-head{display:none}.purchase-edit-line{grid-template-columns:1fr 1fr 80px 100px 1fr 42px}.purchase-edit-line .pes,.purchase-edit-line .pep{grid-column:span 3}.purchase-edit-line .pen{grid-column:1/-2}}

/* Consistent table header grid and aligned sort controls across the application. */
.table-wrap table thead tr>th{position:relative;vertical-align:middle;border-right:1px solid #d9d9de;border-bottom:1px solid #c7c7cc;box-shadow:none;white-space:nowrap}
.table-wrap table thead tr>th:last-child{border-right:0}
.table-wrap table thead tr:first-child>th{height:46px;padding:10px 34px 10px 13px;line-height:24px;background:#f5f5f7}
.table-wrap table thead tr:first-child>th.num{text-align:right}
.table-wrap table thead tr:first-child>th.table-actions-head{padding-right:13px}
.table-wrap table .sortable:after{content:'↕';position:absolute;right:11px;top:50%;width:16px;height:20px;margin:0;transform:translateY(-50%);color:#a1a1a6;font-size:13px;line-height:20px;text-align:center}
.table-wrap table .sortable.sort-asc:after{content:'↑';color:#0071e3}.table-wrap table .sortable.sort-desc:after{content:'↓';color:#0071e3}
.table-wrap table thead .summary-row>th{height:38px;padding:8px 12px;border-right-color:#d7e0e9;border-bottom-color:#d2d2d7;background:#eef5fc;line-height:20px}
.table-wrap table thead .filter-row>th{height:48px;padding:7px 8px;border-right-color:#e1e1e6;border-bottom:1px solid #c7c7cc;background:#fafafa}
.table-wrap table thead .filter-row select{display:block;width:100%;min-width:78px;max-width:none;height:34px;margin:0;padding:5px 28px 5px 9px;border-color:#d2d2d7;border-radius:8px;background:#fff;font-weight:400}
.table-wrap table thead .filter-row>th:not(.table-actions-head){min-width:120px}
.table-wrap table thead .filter-row select{width:100%;min-width:112px;padding-left:10px;padding-right:22px;overflow:visible;text-overflow:clip;white-space:nowrap}
.column-filter-button{display:block;width:100%;min-width:112px;height:34px;padding:5px 26px 5px 10px;border:1px solid #d2d2d7;border-radius:8px;background:#fff;color:#3a3a3c;font-size:13px;font-weight:400;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative}.column-filter-button:after{content:'⌄';position:absolute;right:9px;color:#86868b}.column-filter-button.active{border-color:#0071e3;background:#f0f7ff;color:#0066cc;box-shadow:0 0 0 3px #0071e31a}.column-filter-popover{position:fixed;z-index:1000;margin:0;padding:14px;border:1px solid #d2d2d7;border-radius:14px;background:#fffffff7;box-shadow:0 18px 55px #0003;backdrop-filter:blur(18px);color:#1d1d1f;font-family:'Microsoft YaHei','微软雅黑',sans-serif}.column-filter-popover::backdrop{background:transparent}.column-filter-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.column-filter-title b{font-size:14px}.column-filter-title .filter-close{border:0;background:transparent;font-size:21px;color:#6e6e73;padding:0 4px}.filter-option-search{width:100%;height:36px;margin:0 0 9px}.filter-quick{display:flex;gap:8px;margin-bottom:8px}.filter-quick button{flex:1;padding:6px 9px}.filter-option-list{max-height:245px;overflow:auto;border-top:1px solid #e5e5ea;border-bottom:1px solid #e5e5ea;padding:5px 0}.filter-option-list label{display:flex;align-items:center;gap:9px;min-height:34px;padding:5px 7px;border-radius:7px;font-size:13px;font-weight:400;cursor:pointer}.filter-option-list label:hover{background:#f2f2f7}.filter-option-list input{width:16px;height:16px;margin:0;flex:0 0 auto}.filter-option-list span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.filter-apply{width:100%;margin-top:10px}
.table-wrap table thead .table-actions-head select{display:none!important}

/* 商品明细的表头与输入行共用同一列网格。 */
dialog:has(.inv-line),dialog:has(.sale-line),dialog:has(#editInvProduct),dialog:has(#stocktakeProduct){width:min(1080px,96vw);max-width:none}
dialog:has(#conversionRows){width:min(1380px,98vw);max-width:none}.conversion-toolbar{position:sticky;z-index:6;top:-22px;display:flex;align-items:center;gap:8px;margin:-4px 0 12px;padding:12px 0;background:#fff}.conversion-toolbar input{width:min(320px,35vw)}.conversion-toolbar span{margin-left:auto;color:#6e6e73;white-space:nowrap}.conversion-table-wrap{max-height:58vh}.conversion-table-wrap table{min-width:1120px}.conversion-table-wrap th:first-child,.conversion-table-wrap td:first-child,.conversion-table-wrap th:nth-child(2),.conversion-table-wrap td:nth-child(2){width:58px;text-align:center}.conversion-table-wrap input[type="checkbox"]{width:18px;height:18px}.conversion-table-wrap .conversion-reference{min-width:190px}.conversion-table-wrap .conversion-factor{width:110px}.conversion-table-wrap .conversion-hint{min-width:240px;color:#6e6e73}@media(max-width:800px){.conversion-toolbar{top:-17px;flex-wrap:wrap}.conversion-toolbar input{width:100%}.conversion-toolbar span{width:100%;margin-left:0}}
.inv-line,.line-head.inv-line-head{grid-template-columns:minmax(130px,1fr) minmax(350px,3.2fr) minmax(80px,.7fr) minmax(95px,.8fr) 42px}
.sale-line,.line-head.sale-line-head{grid-template-columns:minmax(130px,1fr) minmax(350px,3.2fr) minmax(80px,.7fr) minmax(95px,.8fr) minmax(145px,1.2fr) 42px}
.inv-line,.sale-line,.line-head.inv-line-head,.line-head.sale-line-head{align-items:center}
.inv-line .select-search,.sale-line .select-search,.sale-edit-line .select-search,.purchase-edit-line .select-search{margin-bottom:0}
.inv-line>*,.sale-line>*,.sale-edit-line>*,.purchase-edit-line>*{box-sizing:border-box}
.inv-line select,.sale-line select,.sale-edit-line select,.purchase-edit-line select,#editInvProduct,#stocktakeProduct,#invProduct{min-width:0;width:100%;font-variant-numeric:tabular-nums}
.sale-edit-head,.sale-edit-line{grid-template-columns:minmax(150px,1fr) minmax(390px,3fr) minmax(85px,.65fr) minmax(105px,.8fr) minmax(150px,1fr) 46px}
.purchase-edit-head,.purchase-edit-line{grid-template-columns:minmax(150px,1fr) minmax(390px,3fr) minmax(85px,.65fr) minmax(105px,.8fr) minmax(160px,1.2fr) 46px}
@media(max-width:800px){.inv-line,.sale-line{min-width:900px}.sale-edit-line,.purchase-edit-line{min-width:980px}.sale-edit-section,.purchase-edit-section{overflow-x:auto}}
.table-wrap table tbody td{border-right:1px solid #f0f0f2}.table-wrap table tbody td:last-child{border-right:0}

/* Compact tables: short header dividers, uniform rows, and expandable long notes. */
.table-wrap table thead tr>th{border-right:0!important}
.table-wrap table thead tr:first-child>th:not(:last-child):before{content:'';position:absolute;z-index:1;top:11px;right:0;bottom:11px;width:1px;background:#d2d2d7}
.table-wrap table thead .summary-row>th,.table-wrap table thead .filter-row>th{border-right:0!important}
.table-wrap table tbody tr{height:52px}
.table-wrap table tbody td{height:52px;max-height:52px;border-right:0!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
.table-wrap table tbody td:last-child{overflow:visible;white-space:nowrap}
.table-pagination{position:sticky;left:0;bottom:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:16px;min-width:100%;padding:11px 14px;border-top:1px solid #e5e5ea;background:#fffffff2;backdrop-filter:blur(14px);color:#6e6e73;font-size:13px}
.table-pagination>div{display:flex;gap:8px}.table-pagination button{min-height:34px;padding:6px 13px;background:#fff}.table-pagination button:disabled{cursor:default;opacity:.42}
.stock-ledger-link{border:0;background:transparent;color:#06715a;font-weight:700;padding:3px 5px;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:3px}.stock-ledger-link:hover{border:0;background:#e8f5f0;color:#075d4b}
.inv-type{display:inline-flex;align-items:center;border-radius:999px;padding:3px 9px;font-size:12px;font-weight:700;line-height:1.35;white-space:nowrap}.inv-type-opening{background:#eef1f4;color:#53606b}.inv-type-purchase_in{background:#dcf4e8;color:#08734e}.inv-type-other_in{background:#e5f6ef;color:#197255}.inv-type-sales_out{background:#ffe7dc;color:#b64518}.inv-type-other_out{background:#fff0d6;color:#9a5b00}.inv-type-sales_return{background:#e5edff;color:#315fb5}.inv-type-purchase_return{background:#f0e7ff;color:#7040ad}.inv-type-stock_gain{background:#dcf7f5;color:#087b77}.inv-type-stock_loss{background:#ffe2e5;color:#b3263e}.inv-type-unknown{background:#eeeeef;color:#626267}
.table-fuzzy-search{display:flex;align-items:center;gap:10px;margin:14px 0 9px;padding:10px 12px;border:1px solid #e5e5ea;border-radius:12px;background:#fff;box-shadow:0 5px 18px #00000007}.table-fuzzy-search span{flex:0 0 auto;color:#6e6e73;font-size:13px;font-weight:600}.table-fuzzy-search input{width:min(480px,55vw);min-height:38px;padding-left:36px;background:#f5f5f7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat 12px center}.table-fuzzy-search button{min-height:36px;padding:6px 11px;color:#0066cc;border:0;background:transparent;box-shadow:none}.table-fuzzy-search button:hover{background:#f5f5f7}
@media(max-width:800px){.table-fuzzy-search{align-items:stretch;flex-wrap:wrap}.table-fuzzy-search span{width:100%}.table-fuzzy-search input{width:calc(100% - 64px)}.table-fuzzy-search button{width:54px;padding:6px}}
.compact-text{display:block;width:100%;max-width:240px;min-height:0;height:auto;margin:0;padding:2px 0;overflow:hidden;border:0!important;border-radius:0;background:transparent!important;box-shadow:none!important;color:inherit;font:inherit;font-weight:400;text-align:left;white-space:nowrap;text-overflow:ellipsis;transform:none!important;cursor:pointer}
.compact-text:hover{color:#0066cc;text-decoration:underline}.compact-text:focus-visible{outline:2px solid #0071e355;outline-offset:2px}
.full-text-content{min-height:110px;padding:18px;border-radius:12px;background:#f5f5f7;color:#1d1d1f;font-size:15px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}
.direct-supplier-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:16px;border:1px solid #dbe7f3;border-radius:14px;background:#f5f9fd}.direct-supplier-fields[hidden],.direct-lines[hidden]{display:none!important}.direct-ocr-actions{display:flex;align-items:center;gap:12px}.direct-ocr-actions small{color:#6e6e73;line-height:1.55}.direct-lines{padding:16px;border:1px solid #e5e5ea;border-radius:14px;background:#fbfbfd;overflow-x:auto}.direct-line-head,.direct-sale-line{display:grid;grid-template-columns:minmax(230px,2fr) 75px 90px 115px 115px minmax(150px,1fr) 42px;gap:8px;align-items:center;min-width:900px}.direct-line-head{padding:0 2px 8px;color:#6e6e73;font-size:12px}.direct-sale-line{padding:8px 0;border-top:1px solid #ededf0}.direct-sale-line input{min-width:0;width:100%;box-sizing:border-box}.direct-sale-line .dq,.direct-sale-line .dc,.direct-sale-line .dp{text-align:center;font-variant-numeric:tabular-nums}.direct-sale-line button{padding:8px;color:#b42318}.direct-lines>button{margin-top:10px}.direct-badge{background:#eef5fc;color:#0066cc}.sale-total #directCostTotal{margin-left:12px;color:#6e6e73;font-size:13px}.sale-total #directCostTotal b{font-size:15px;color:#1d1d1f}
@media(max-width:800px){.direct-supplier-fields{grid-template-columns:1fr}.direct-ocr-actions{align-items:flex-start;flex-direction:column}}
.channel-business-report{margin-top:18px}.channel-report-kpis{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:16px 0}.channel-report-kpis article{min-height:106px;padding:15px;border:1px solid #e5e5ea;border-radius:13px;background:#fbfbfd}.channel-report-kpis span,.channel-report-kpis small{display:block;color:#6e6e73}.channel-report-kpis span{font-size:12px}.channel-report-kpis b{display:block;margin:6px 0 4px;color:#1d1d1f;font-size:21px;letter-spacing:-.025em}.channel-report-kpis small{font-size:11px;line-height:1.55}.channel-report-kpis .positive,.channel-report-table .positive{color:#248a3d}.channel-report-kpis .negative,.channel-report-table .negative{color:#d70015}.channel-report-note{margin-bottom:11px;padding:11px 13px;border-radius:10px;background:#f5f5f7;color:#6e6e73;font-size:12px}.channel-report-table{max-height:520px}.channel-report-table table{min-width:1480px}.channel-report-table tbody td:first-child b,.channel-report-table tbody td:first-child small{display:block}.channel-report-table tbody td:first-child small{margin-top:2px;color:#86868b;font-size:11px}.channel-report-table tbody td.num{font-variant-numeric:tabular-nums}
.has-source-rule{position:relative}.source-rule-icon{display:inline-grid!important;place-items:center;width:16px;height:16px;margin-left:6px;border:1px solid #8d9a94;border-radius:50%;color:#58665f!important;background:#fff;font:700 10px/1 Arial;vertical-align:1px;cursor:help;opacity:.92}.source-rule-icon:hover,.source-rule-icon:focus{border-color:#0071e3;color:#0071e3!important;outline:2px solid #0071e322;outline-offset:1px}.table-wrap th.has-source-rule{padding-right:34px}.table-wrap th.has-source-rule .source-rule-icon{position:static;transform:none}.cashflow-grid .has-source-rule,.channel-report-kpis .has-source-rule,.dash-cards .has-source-rule,.dash-secondary .has-source-rule{display:flex!important;align-items:center;gap:2px}.cashflow-grid .source-rule-icon,.channel-report-kpis .source-rule-icon,.dash-cards .source-rule-icon,.dash-secondary .source-rule-icon{flex:0 0 16px;margin-left:3px}#sourceRuleTooltip{position:fixed;z-index:10000;padding:10px 12px;border:1px solid #cfd8d4;border-radius:9px;background:#17211e;color:#fff;box-shadow:0 10px 28px #0004;font-size:12px;font-weight:400;line-height:1.55;white-space:normal;pointer-events:none}#sourceRuleTooltip[hidden]{display:none!important}
@media(max-width:900px){.channel-report-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:520px){.channel-report-kpis{grid-template-columns:1fr}.channel-report-kpis article{min-height:0}}
.attachment-manager{display:grid;gap:8px;margin-top:10px}.managed-attachment{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;gap:10px;align-items:center;padding:9px 12px;border-radius:10px;background:#f5f5f7}.managed-attachment span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.managed-attachment a{color:#06c;text-decoration:none}.managed-attachment button{color:#c00}

/* Inventory planning */
.sale-line-metrics{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:10px 24px;padding:9px 12px;background:#f3f7fb;border:1px solid #e2e9f0;border-radius:8px;font-size:13px;color:#536477}.sale-line-metrics b{margin-left:6px;color:#172f47;font-variant-numeric:tabular-nums}.sale-profit-summary{grid-column:1/-1;padding:14px 16px;margin:10px 0;border:1px solid #b8d9cb;border-radius:10px;background:#f0faf5}.sale-profit-summary>div{display:flex;flex-wrap:wrap;gap:12px 30px;font-size:15px}.sale-profit-summary b{margin-left:8px;color:#147747;font-size:19px;font-variant-numeric:tabular-nums}.sale-profit-summary small{display:block;margin-top:10px;line-height:1.7;color:#586b62}.sale-line-metrics .profit-negative,.sale-profit-summary .profit-negative{color:#c0392b}
.restock-sub{display:block;color:#777;margin-top:4px}#restockNotice{line-height:1.8}#restock h2{margin:24px 0 14px}#restockRows td:last-child{min-width:210px}#restockRows td:nth-last-child(2){min-width:240px;white-space:normal}#restockCards{margin:18px 0}

main:has(#restock.active){min-width:0;width:100%;max-width:100%}
#restockCards{grid-template-columns:repeat(4,minmax(0,1fr))}
#restock .badge.off{background:#fff0ed;color:#bd3526}
#restockCards .restock-status-card{display:block;width:100%;min-width:0;min-height:115px;padding:20px;text-align:left;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--text);cursor:pointer;transition:background .15s,border-color .15s,box-shadow .15s}
#restockCards .restock-status-card>span{display:block;color:var(--muted);font-size:14px}
#restockCards .restock-status-card>strong{display:block;font-size:28px;margin:8px 0 0;font-weight:700;line-height:1.25}
#restockCards .restock-status-card>small{display:block;margin-top:5px;color:var(--muted)}
#restockCards .restock-status-card:first-child strong,#restockCards .restock-status-card:nth-child(2) strong{color:#bd3526}
#restockCards .restock-status-card:nth-child(3) strong{color:#a76600}
#restockCards .restock-status-card:hover{border-color:#80b49a;box-shadow:0 3px 14px #155a3920}
#restockCards .restock-status-card:focus-visible{outline:3px solid #248961;outline-offset:3px}
#restockCards .restock-status-card.is-active{background:#eef8f2;border:2px solid var(--green);padding:19px;box-shadow:0 0 0 2px #17745b14}
#restockCards .restock-status-card.is-active>span{color:var(--green);font-weight:700}
@media(max-width:800px){#restockCards{grid-template-columns:repeat(2,minmax(0,1fr))}#restockCards .restock-status-card{min-height:108px;padding:16px}#restockCards .restock-status-card.is-active{padding:15px}}
.sku-auto-switch{display:flex!important;flex-direction:row!important;align-items:center;gap:10px;background:#f4f7ff;padding:12px;border-radius:10px}.sku-auto-switch input{width:auto}.sku-composer{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:14px;border:1px solid #cfd8ef;border-radius:12px;background:#f9fbff}.sku-composer label{display:flex;flex-direction:column;gap:6px}.sku-composer small{align-self:center;color:#64748b}.sku-composer small.bad{color:#b42318}.sku-rule-help{margin-bottom:12px;color:#475569}.sku-rule-add,.sku-rule-row{display:grid;grid-template-columns:100px 1fr 120px 90px;gap:8px;align-items:center;margin-bottom:8px}.sku-rule-row{grid-template-columns:70px 1fr 120px 90px 64px}.sku-rule-list{max-height:55vh;overflow:auto;padding-right:4px}@media(max-width:700px){.sku-composer{grid-template-columns:1fr}.sku-rule-add,.sku-rule-row{grid-template-columns:1fr}}

/* Batch restock editor: scoped layout so global 100%-width input rules do not stretch checkboxes. */
dialog:has(#restockBatchProducts){width:min(1040px,96vw);max-width:none}
.restock-batch-intro{margin:0 0 16px;line-height:1.7;color:#4b5b54}
.restock-batch-toolbar{display:grid;grid-template-columns:190px minmax(200px,1fr) auto auto;align-items:end;gap:10px;margin:12px 0}
.restock-batch-toolbar label{display:grid;gap:6px;min-width:0;font-size:13px;font-weight:600}
.restock-batch-toolbar input,.restock-batch-toolbar select{width:100%;min-width:0}
.restock-batch-toolbar button{height:42px;white-space:nowrap;padding:8px 12px}
.restock-batch-count{margin:12px 0 8px;font-weight:600;font-size:13px;color:#27634f}
.restock-batch-products{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 8px;max-height:240px;min-height:84px;overflow-x:hidden;overflow-y:auto;border:1px solid #dce4e0;border-radius:12px;padding:8px;background:#fafbfa}
.restock-batch-products>p{grid-column:1/-1;margin:12px}
.restock-batch-item{display:flex;gap:10px;align-items:flex-start;min-width:0;padding:11px 10px;border:1px solid transparent;border-radius:8px;cursor:pointer;line-height:1.45;overflow:hidden}
.restock-batch-item:hover{background:#eff5f1}
.restock-batch-item.is-selected{background:#ebf5ef;border-color:#c3ddcf}
.restock-batch-item>span{display:block;flex:1;min-width:0;overflow-wrap:anywhere;word-break:break-word}
.restock-batch-item small{display:block;color:#65736d;margin-top:4px;font-size:12px}
.restock-batch-item>input[type="checkbox"],.restock-batch-field-label>input[type="checkbox"]{width:18px;height:18px;min-width:18px;min-height:18px;flex:0 0 18px;margin:2px 0 0;padding:0;border-radius:4px;accent-color:var(--green)}
.restock-batch-heading{margin:19px 0 7px;font-size:16px}
.restock-batch-template{display:grid;grid-template-columns:auto minmax(180px,1fr);align-items:center;gap:12px;margin:12px 0 14px;font-weight:600}
.restock-batch-template select{min-width:0;width:100%;font-weight:400}
.restock-batch-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:11px}
.restock-batch-field{display:flex;flex-direction:column;gap:9px;min-width:0;min-height:132px;background:#f7f9f8;border:1px solid #e0e8e3;border-radius:11px;padding:13px}
.restock-batch-field.is-enabled{background:#f1f9f4;border-color:#a9d4bd}
.restock-batch-field-label{display:flex;gap:9px;align-items:center;min-width:0;cursor:pointer;font-size:14px;font-weight:600;line-height:1.4}
.restock-batch-field-label span{flex:1;min-width:0;overflow-wrap:anywhere}
.restock-batch-field input[type="number"]{width:100%;min-width:0;height:40px}
.restock-batch-field input[type="number"]:disabled{background:#edf0ee;color:#87928a;cursor:not-allowed}
.restock-batch-field small{font-size:12px;line-height:1.45;color:#6b7870}
@media(max-width:900px){.restock-batch-toolbar{grid-template-columns:180px minmax(160px,1fr)}.restock-batch-toolbar button{width:100%}.restock-batch-fields{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){dialog:has(#restockBatchProducts){width:97vw}.restock-batch-toolbar{grid-template-columns:minmax(0,1fr)}.restock-batch-products{grid-template-columns:minmax(0,1fr);max-height:230px}.restock-batch-template{grid-template-columns:minmax(0,1fr)}.restock-batch-fields{grid-template-columns:minmax(0,1fr)}.restock-batch-field{min-height:0}}

/* Weekly stocktake draft, discrepancy review, approval and trend report. */
dialog:has(.stocktake-review-table){width:min(1220px,97vw);max-width:none}
.stocktake-work-toolbar{display:flex;align-items:end;gap:9px;flex-wrap:wrap;margin:14px 0;padding:10px;background:#f6f8f7;border:1px solid #e2e8e4;border-radius:11px}
.stocktake-work-toolbar label{display:grid;gap:5px;min-width:175px;flex:1}
.stocktake-work-toolbar input[type="search"]{min-width:170px}
.stocktake-work-toolbar input[type="number"]{width:140px}
.stocktake-work-toolbar select{max-width:270px;min-width:130px}
.stocktake-alert{padding:11px 13px;background:#f5f7fc;border-left:3px solid #5883ba;border-radius:6px}
.stocktake-kpis{display:flex;gap:10px 18px;flex-wrap:wrap;margin:12px 0}
.stocktake-kpis>span{background:#f1f4f2;border-radius:8px;padding:7px 12px}
.stocktake-kpis b{font-variant-numeric:tabular-nums;font-size:17px}
.stocktake-review-table{overflow:auto;max-height:50vh;border:1px solid #dfe5e2;border-radius:10px;margin:12px 0}
.stocktake-review-table table{border-collapse:collapse;width:100%;min-width:930px}
.stocktake-review-table th{position:sticky;top:0;background:#f1f4f2;z-index:2}
.stocktake-review-table th,.stocktake-review-table td{padding:10px;border-bottom:1px solid #e8ece9;vertical-align:middle}
.stocktake-review-table input.stocktake-actual{width:100px;min-width:0}
.stocktake-review-table input.stocktake-reason{min-width:150px;width:100%}
.stocktake-review-table .num{text-align:right;white-space:nowrap}
.stocktake-mini{display:block;color:#68756d;margin-top:3px;font-weight:400}
@media(max-width:720px){.stocktake-work-toolbar>*{flex:1 1 100%}.stocktake-work-toolbar input[type="number"],.stocktake-work-toolbar select{width:100%;max-width:none}}

/* Purchase and stock-sale Excel SKU/quantity import preview. */
.order-excel-import{margin:14px 0 4px;padding:14px;border:1px solid #dce5ef;border-radius:12px;background:#f6f9fe}
.order-excel-import>label{display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:13px;font-weight:600;color:var(--text)}
.order-excel-import .order-excel-file{max-width:440px;min-width:0;flex:1 1 250px;font-size:13px;background:#fff}
.order-excel-import>small{display:block;margin-top:8px;color:#5e6b78;line-height:1.6}
.order-excel-preview{margin-top:12px;padding:12px;background:#fff;border:1px solid #dce5ef;border-radius:10px;min-width:0}
.order-excel-preview p{margin:0 0 10px;line-height:1.65}
.order-excel-preview .order-excel-count{color:#224d71}
.order-excel-preview .order-excel-error{color:#b42318;margin:0}
.order-excel-table-wrap{max-height:260px;overflow:auto;border:1px solid #e5e9ef;border-radius:8px}
.order-excel-table-wrap table{min-width:520px;width:100%}
.order-excel-table-wrap th,.order-excel-table-wrap td{white-space:normal;padding:7px 9px}
.order-excel-actions{display:flex;gap:10px;margin-top:12px;flex-wrap:wrap}
@media(max-width:650px){.order-excel-import{padding:10px}.order-excel-import .order-excel-file{width:100%;flex:1 1 100%}.order-excel-actions button{flex:1 1 100%}}

/* Purchase order: per-SKU extended cost and net payable, matching the sale summary. */
.inv-line .inv-line-amount{grid-column:1/-1;display:flex;justify-content:flex-start;align-items:center;gap:10px;padding:8px 11px;border:1px solid #e1e9f1;border-radius:7px;background:#f3f7fb;color:#526274;font-size:13px}
.inv-line .inv-line-amount b{font-variant-numeric:tabular-nums;color:#203b57;font-size:14px}
.purchase-total-summary{grid-column:1/-1;margin:12px 0 14px;padding:14px 16px;border:1px solid #b8d9cb;border-radius:10px;background:#f0faf5}
.purchase-total-fields{display:flex;gap:10px 28px;flex-wrap:wrap;align-items:center}
.purchase-total-fields>span{display:flex;gap:9px;align-items:center;font-size:14px}
.purchase-total-fields b{color:#147747;font-size:18px;font-variant-numeric:tabular-nums}
.purchase-total-fields>span:last-child b{font-size:22px}
.purchase-total-summary small{display:block;margin-top:9px;line-height:1.6;color:#586b62}
.purchase-amount-warning{margin:9px 0 0;color:#ad3129;font-weight:600}
.sale-line-metrics .sale-profit-estimate-note,.sale-line-metrics .sale-profit-missing-note{flex-basis:100%;font-size:12px;line-height:1.55}
.sale-line-metrics .sale-profit-estimate-note{color:#885604}
.sale-line-metrics .sale-profit-missing-note{color:#b42318}
@media(max-width:650px){.purchase-total-fields{display:grid;gap:8px}.purchase-total-fields>span{justify-content:space-between}.purchase-total-fields>span:last-child b{font-size:20px}}

/* Company expense and incidental-income ledger. */
.company-cash-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:13px 0}
.company-cash-summary>span{display:flex;flex-direction:column;gap:7px;border:1px solid #dbe6e1;border-radius:10px;padding:13px 16px;background:#f8fbf9;color:#51625a}
.company-cash-summary b{font-size:22px;font-variant-numeric:tabular-nums;color:#147747}
.company-cash-summary>span:nth-child(2) b{color:#af3d35}
.company-cash-controls{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.company-cash-controls label{display:flex;align-items:center;gap:10px;font-weight:600}
.company-cash-controls select{width:180px}
.company-cash-controls small{color:#68756d}
.company-income-amount{color:#0d7a43;font-weight:700}
@media(max-width:700px){.company-cash-summary{grid-template-columns:1fr}.company-cash-summary>span{flex-direction:row;justify-content:space-between;align-items:center}}

.product-delete-btn{color:#b42318;background:#fff;border:1px solid #efcac5}
.product-delete-btn:hover{background:#fff2f0;border-color:#d85043}
.product-delete-help{font-size:12px;color:#667085;margin:4px 0 10px;line-height:1.6}


/* Product bulk operation toolbar and explicit per-field patch controls. */
.product-bulk-toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin:10px 0;padding:10px 12px;border:1px solid #dce5e8;border-radius:12px;background:#f8fafb}
.product-bulk-toolbar #productSelectionCount{font-size:13px;font-weight:650;min-width:175px;margin-right:auto;color:#344054}
.product-bulk-toolbar button:disabled{opacity:.45;cursor:not-allowed}
.product-select-cell{width:45px!important;min-width:45px!important;max-width:45px!important;text-align:center!important}
.product-select-cell input{height:17px;width:17px;vertical-align:middle;cursor:pointer}
.product-bulk-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.product-bulk-field{padding:10px;border:1px solid #dee4ea;border-radius:9px;display:flex;flex-direction:column;gap:8px}
.product-bulk-field label{display:flex;align-items:center;gap:8px;margin:0;font-size:13px}
.product-bulk-field label input{width:16px;height:16px}
.product-bulk-field>input{width:100%;min-width:0}
.product-bulk-field>input:disabled{opacity:.5;background:#f3f4f6}
@media(max-width:680px){.product-bulk-fields{grid-template-columns:1fr}.product-bulk-toolbar #productSelectionCount{min-width:100%;margin-right:0}}

/* Click-through inventory ledger numbers for purchase/sales source documents. */
.inv-document-link{color:#1460aa;font-weight:650;text-decoration:underline;text-underline-offset:3px;cursor:pointer;white-space:nowrap}
.inv-document-link:hover,.inv-document-link:focus-visible{color:#084179;text-decoration-thickness:2px}

/* Pre-purchase editor: full product descriptions, current stock and responsive lines. */
dialog.prepurchase-dialog{width:min(1640px,calc(100vw - 24px));max-width:none}
.prepurchase-dialog #modalBody{overflow-x:hidden;overflow-y:auto}
.prepurchase-dialog .form-grid,.prepurchase-dialog .span2{min-width:0}
.prepurchase-line-head,.prepurchase-line{display:grid;grid-template-columns:minmax(94px,.92fr) minmax(110px,1fr) minmax(186px,1.92fr) minmax(74px,.69fr) minmax(84px,.79fr) minmax(88px,.83fr) minmax(110px,1.02fr) minmax(86px,.81fr) minmax(87px,.82fr) minmax(100px,.92fr) 36px;gap:7px;align-items:center;min-width:0}
.prepurchase-line-head{padding:4px 10px 8px;color:#667085;font-size:12px;font-weight:600;line-height:1.35;overflow-wrap:anywhere}
.prepurchase-line{padding:12px 10px;margin-bottom:8px;border:1px solid #e2e8ec;border-radius:11px;background:#fbfcfe}
.prepurchase-line input,.prepurchase-line select{min-width:0;width:100%;font-size:13px;box-sizing:border-box}
.prepurchase-line .prep-sku{max-width:100%;text-overflow:ellipsis}
.prep-product-info{min-width:0;line-height:1.45;overflow-wrap:anywhere;word-break:break-word}
.prep-product-name,.prep-product-spec{display:block;white-space:normal}
.prep-product-name{color:#263348;font-weight:650}
.prep-product-spec{font-size:12px;color:#687588;margin-top:3px}
.prep-stock,.prep-metric{display:flex;align-items:baseline;justify-content:center;gap:3px;white-space:nowrap;font-variant-numeric:tabular-nums;min-width:0}
.prep-stock-number{font-size:15px;font-weight:700;color:#126b4b}
.prep-daily-number,.prep-coverage-number{font-size:14px;font-weight:650;color:#334155}
.prep-projected-number{font-size:15px;font-weight:750;color:#155fa0}
.prep-projected.is-short .prep-projected-number{color:#ba4b24}
.prep-projected{background:#eef5ff;padding:6px 5px;border-radius:7px}
.prep-coverage.is-short .prep-coverage-number{color:#ba4b24;font-weight:750}
.prep-metric small{font-size:11px;color:#778297}
.prep-stock.is-negative .prep-stock-number{color:#c03433}
.prep-stock.is-zero .prep-stock-number{color:#b76f1b}
.prep-stock-unit{font-size:11px;color:#778297}
.prep-number-field{display:block;min-width:0!important;margin:0!important}
.prep-number-field input{width:100%;margin:0!important;text-align:right;font-variant-numeric:tabular-nums}
.prep-line-total{display:block;text-align:right;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap}
.prep-total-box{min-width:0}
.prep-field-label{display:none}
/* Form-grid label span defaults are more specific than .prep-field-label. Keep row labels hidden when the column header is shown. */
.prepurchase-dialog .form-grid .prepurchase-line label.prep-number-field > span.prep-field-label{display:none}
.prep-remove{padding:7px!important;width:36px;min-width:0;color:#b42318!important}
.prepurchase-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:12px 0}
.prep-stock-updated{font-size:12px;color:#667085;margin-left:auto}
#prepurchaseLines{min-width:0;overflow-x:hidden}
@media(max-width:1180px){
 .prepurchase-line-head{display:none}
 .prepurchase-line{position:relative;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:15px}
 .prepurchase-line .prep-search{grid-column:span 1}
 .prepurchase-line .prep-sku{grid-column:span 1}
 .prepurchase-line .prep-product-info{grid-column:span 2;padding-right:38px}
 .prepurchase-line .prep-stock,.prepurchase-line .prep-metric,.prepurchase-line .prep-number-field,.prepurchase-line .prep-total-box{justify-content:flex-start}
 .prep-field-label{display:block;font-size:11px;color:#718096;margin-bottom:4px}
 /* Mobile/tablet hides the column header; restore per-row field captions there only. */
 .prepurchase-dialog .form-grid .prepurchase-line label.prep-number-field > span.prep-field-label{display:block}
 .prep-stock,.prep-metric{display:flex;flex-wrap:wrap}
 .prep-stock .prep-field-label,.prep-metric .prep-field-label{flex-basis:100%}
 .prep-total-box .prep-line-total{text-align:left}
 .prep-remove{position:absolute;top:13px;right:12px}
}
@media(max-width:700px){
 dialog.prepurchase-dialog{width:calc(100vw - 12px);max-height:96vh}
 .prepurchase-dialog #modalBody{padding:12px;max-height:77vh}
 .prepurchase-line{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .prepurchase-line .prep-search,.prepurchase-line .prep-sku{grid-column:span 1}
 .prepurchase-line .prep-product-info{grid-column:1/-1;padding-right:36px}
 .prepurchase-line .prep-stock,.prepurchase-line .prep-metric{grid-column:span 1}
 .prepurchase-line .prep-number-field{grid-column:span 1}
 .prepurchase-line .prep-total-box{grid-column:1/-1}
 .prepurchase-actions button{flex:1 1 auto}
 .prep-stock-updated{margin-left:0;flex-basis:100%}
}

/* 售后退货：与采购录入一致的紧凑横向 SKU 明细，所有商品共享表头。 */
dialog.return-entry-dialog{width:min(1270px,calc(100vw - 28px));max-width:none}
.return-goods-panel{min-width:0;border:1px solid #e2e8f0;border-radius:12px;padding:13px;background:#fbfcfe}
.return-goods-note{margin:0 0 12px;font-size:12px;color:#64748b;line-height:1.6}
.return-line-head,.return-manual-line,.return-linked-line{display:grid;grid-template-columns:minmax(120px,1.1fr) minmax(155px,1.45fr) minmax(230px,2.3fr) minmax(104px,.82fr) minmax(110px,1fr) 38px;gap:9px;align-items:center;min-width:0}
.return-line-head{padding:0 9px 9px;font-size:12px;font-weight:600;color:#687687}
.return-lines{display:grid;gap:6px;min-width:0}
.return-lines .return-line{box-sizing:border-box;min-width:0;padding:9px;border:1px solid #e4eaf0;border-radius:9px;background:#fff;margin:0}
.return-lines .return-line input,.return-lines .return-line select{box-sizing:border-box;width:100%;min-width:0;height:36px;margin:0}
.return-lines .return-line .rs,.return-lines .return-line .rp{font-size:13px}
.return-line-product,.return-source-product{min-width:0;line-height:1.4;overflow-wrap:anywhere}
.return-line-product strong,.return-source-product strong{display:block;color:#273647;font-size:13px}
.return-line-product small{display:block;margin-top:2px;font-size:11px;color:#66788e;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.return-line-product .rh{color:#6a7786}
.return-goods-panel .return-line label{display:block;min-width:0;margin:0}
.return-goods-panel .return-line label>span{display:none}
.return-qty-field input,.return-cost-field input{text-align:right;font-variant-numeric:tabular-nums}
.return-goods-panel .return-line .remove{width:36px;min-width:0;padding:7px;color:#b42318;font-size:16px}
.return-line-tools{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin:11px 0 13px}
.return-line-tools span{font-size:12px;color:#475569;font-variant-numeric:tabular-nums}
.return-goods-panel.return-linked .return-line-head,.return-goods-panel.return-linked .return-linked-line{grid-template-columns:minmax(250px,3fr) minmax(145px,1fr) minmax(140px,1fr)}
.return-source-product{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap;font-size:13px}
.return-source-product strong{flex:none}
.return-source-product span{min-width:0;overflow-wrap:anywhere}
.return-remaining{font-size:13px;color:#4a6075;font-variant-numeric:tabular-nums}
@media(max-width:1000px){
 .return-goods-panel .return-line-head{display:none}
 .return-goods-panel .return-manual-line{grid-template-columns:repeat(4,minmax(0,1fr));gap:9px}
 .return-manual-line .rs,.return-manual-line .rp{grid-column:span 2}
 .return-manual-line .return-line-product{grid-column:1/-1}
 .return-goods-panel .return-line label>span{display:block;margin-bottom:4px;font-size:11px;color:#708098}
 .return-manual-line .return-qty-field,.return-manual-line .return-cost-field{grid-column:span 2}
 .return-manual-line .remove{grid-column:4;justify-self:end}
 .return-goods-panel.return-linked .return-linked-line{grid-template-columns:minmax(0,2fr) minmax(120px,1fr) minmax(120px,1fr)}
}
@media(max-width:600px){
 dialog.return-entry-dialog{width:calc(100vw - 12px);max-height:96vh}
 dialog.return-entry-dialog #modalBody{padding:11px;max-height:74vh}
 .return-goods-panel{padding:9px}
 .return-goods-panel .return-manual-line{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .return-manual-line .rs,.return-manual-line .rp{grid-column:span 1}
 .return-manual-line .return-line-product{grid-column:1/-1}
 .return-manual-line .return-qty-field,.return-manual-line .return-cost-field{grid-column:span 1}
 .return-manual-line .remove{grid-column:2}
 .return-goods-panel.return-linked .return-linked-line{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
 .return-linked-line .return-source-product{grid-column:1/-1}
 .return-linked-line .return-remaining{grid-column:1}
 .return-linked-line .return-qty-field{grid-column:2}
 .return-line-tools button{width:100%}
}

/* Stocktake selection, per-unit live totals and editable draft dates. */
.stocktake-review-table .stocktake-select{width:42px;min-width:42px;text-align:center}
.stocktake-review-table .stocktake-select input,.stocktake-check-label input{width:18px;height:18px;min-height:18px;padding:0;margin:0;flex:none}
.stocktake-check-label{display:flex!important;flex-direction:row!important;align-items:center;gap:8px;white-space:nowrap}
.stocktake-bulk-reasons{align-items:center;gap:10px;flex-wrap:wrap}
.stocktake-bulk-reasons label:not(.stocktake-check-label){flex:1;min-width:220px}
.stocktake-date-toolbar{align-items:end;gap:12px;flex-wrap:wrap}
.stocktake-date-toolbar label{max-width:240px}
.stocktake-date-toolbar small{flex:1;min-width:230px;color:var(--muted,#697680)}
#stocktakeLiveSummary .stocktake-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
#stocktakeLiveSummary .stocktake-kpis span{display:flex;flex-direction:column;gap:3px;padding:8px;background:#f4f8f7;border:1px solid #dce6e3;border-radius:8px;font-size:12px}
#stocktakeLiveSummary .stocktake-kpis b{font-size:15px;overflow-wrap:anywhere}
#stocktakeTotalsFoot{position:sticky;bottom:0;background:#edf5f2;z-index:2;font-weight:700}
#stocktakeTotalsFoot td,#stocktakeTotalsFoot th{border-top:2px solid #c5dbd1;background:#edf5f2}
@media(max-width:1100px){#stocktakeLiveSummary .stocktake-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:700px){#stocktakeLiveSummary .stocktake-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.stocktake-bulk-reasons label:not(.stocktake-check-label){min-width:160px}.stocktake-date-toolbar label{max-width:none}}


/* Phone-sized editing surfaces for ALL modules.  Keep the document/receipt
   previews scrollable, but let business forms fit the viewport without zooming. */
@media screen and (max-width:800px){
 dialog#modal{
  box-sizing:border-box;width:calc(100vw - 12px);max-width:calc(100vw - 12px);
  min-width:0;max-height:calc(100dvh - 12px);margin:auto;overflow:hidden;
 }
 #modal>form{box-sizing:border-box;width:100%;min-width:0;max-height:calc(100dvh - 12px);}
 #modal>form>header{min-width:0;gap:8px;padding:12px 14px;}
 #modal>form>header h2{min-width:0;flex:1;font-size:17px;line-height:1.35;overflow-wrap:anywhere;}
 #modal>form>header button{flex:0 0 auto;min-width:40px;min-height:40px;margin-left:0;}
 #modal>form>footer{gap:8px;flex-wrap:wrap;padding:10px 12px env(safe-area-inset-bottom,0px);}
 #modal>form>footer button{min-height:42px;}
 #modalBody{box-sizing:border-box;min-width:0;width:100%;min-height:0;max-height:none;
  flex:1 1 auto;padding:12px;overflow-x:auto;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
 #modalBody .form-grid{width:100%;min-width:0;grid-template-columns:minmax(0,1fr);gap:12px;}
 #modalBody .form-grid>*{min-width:0;max-width:100%;grid-column:auto;}
 #modalBody .form-grid label{min-width:0;max-width:100%;}
 #modalBody :is(input,select,textarea){box-sizing:border-box;max-width:100%;min-width:0;font-size:16px;}
 #modalBody input[type="file"]{width:100%;white-space:normal;}
 #modalBody :is(.table-wrap,.order-excel-table-wrap,.stocktake-review-table,.conversion-table-wrap){
  max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;
 }
 #modalBody :is(.direct-supplier-fields,.party-fields,.partner-grid,.product-bulk-fields){
  grid-template-columns:minmax(0,1fr);min-width:0;
 }
 #modalBody .direct-ocr-actions{flex-wrap:wrap;}
 #modalBody :is(.sale-edit-section,.purchase-edit-section,.direct-lines){min-width:0;max-width:100%;overflow-x:visible;padding:10px;}
 #modalBody :is(.sale-line-metrics,.sale-profit-summary,.purchase-total-summary,.order-excel-import){min-width:0;max-width:100%;overflow-wrap:anywhere;}
 #modalBody .sale-profit-summary>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
 #modalBody .sale-line-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
 #modalBody .sale-total{font-size:16px;overflow-wrap:anywhere;}
 #modalBody .managed-attachment{min-width:0;flex-wrap:wrap;overflow-wrap:anywhere;}
}
@media screen and (max-width:700px){
 /* Multi-SKU entry and secondary editors: full-width product fields, then
    editable quantities/prices in a two-column card, never 900px-wide rows. */
 #modalBody :is(.line-head.inv-line-head,.line-head.sale-line-head,.sale-edit-head,.purchase-edit-head,.direct-line-head){display:none;}
 #modalBody :is(.inv-line,.sale-line,.sale-edit-line,.purchase-edit-line,.direct-sale-line){
  box-sizing:border-box;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;width:100%;min-width:0;max-width:100%;margin:10px 0;padding:12px;
  border:1px solid #e2e7ee;border-radius:12px;background:#fbfcfe;align-items:center;
 }
 #modalBody :is(.inv-line,.sale-line,.sale-edit-line,.purchase-edit-line,.direct-sale-line)>*{
  box-sizing:border-box;min-width:0;max-width:100%;
 }
 #modalBody :is(.inv-line,.sale-line,.sale-edit-line,.purchase-edit-line,.direct-sale-line)>:is(input,select){
  width:100%;min-height:42px;
 }
 #modalBody :is(.inv-line,.sale-line,.sale-edit-line,.purchase-edit-line,.direct-sale-line)>:is(button){
  grid-column:2;justify-self:end;min-width:42px;min-height:42px;
 }
 #modalBody :is(.inv-line,.sale-line,.sale-edit-line,.purchase-edit-line)>:is(
  .line-search,.ses,.pes,.lineSearch,.ip,.lp,.sep,.pep,.lineProduct){
  grid-column:1/-1;
 }
 #modalBody :is(.sale-line,.sale-edit-line,.purchase-edit-line)>:is(.ln,.sen,.pen,.lineNote){
  grid-column:1/-1;
 }
 #modalBody .direct-sale-line>.dn,
 #modalBody .direct-sale-line>.dn-note{grid-column:1/-1;}
 #modalBody .inv-line>.inv-line-amount,
 #modalBody :is(.inv-line,.sale-line,.sale-edit-line,.purchase-edit-line,.direct-sale-line)>.sale-line-metrics{
  grid-column:1/-1;max-width:100%;flex-wrap:wrap;
 }
 #modalBody .sale-line-metrics{font-size:12px;}
 #modalBody .sale-profit-summary>div{grid-template-columns:minmax(0,1fr);}
 #modalBody .sale-edit-total,#modalBody .purchase-edit-total{text-align:left;}
 #modalBody .sale-edit-total b,#modalBody .purchase-edit-total b{display:inline-block;margin-left:4px;}
 #modalBody .return-goods-panel,#modalBody .prepurchase-dialog{min-width:0;}
}
