:root{--ink:#243b36;--muted:#75817b;--green:#28584b;--soft:#eef4ef;--line:#e2e7e1;--paper:#fff;--bg:#f6f7f3;--gold:#b57d32;--danger:#a83338}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.6 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif}button,input,select,textarea{font:inherit}button{cursor:pointer;border:1px solid var(--line);border-radius:8px;padding:9px 16px;background:white;color:var(--ink);transition:.15s}button:hover{border-color:#7e9e8d;background:var(--soft)}button:disabled{opacity:.5;cursor:wait}.primary{background:var(--green);color:white;border-color:var(--green)}.primary:hover{background:#194636;color:white}.danger{color:var(--danger);border-color:#e1b5b5}.quiet{background:none;border-color:transparent;padding:5px 10px;color:var(--green)}input,select,textarea{padding:9px 11px;border:1px solid #dbe2db;border-radius:7px;background:white;color:var(--ink);max-width:100%}input:focus,select:focus,textarea:focus{outline:2px solid #b6d4c3;outline-offset:1px}input[type=number]{font-variant-numeric:tabular-nums}textarea{width:100%;resize:vertical}.sidebar{position:fixed;inset:0 auto 0 0;width:224px;background:#183d33;color:#e5eee8;padding:32px 20px;display:flex;flex-direction:column}.brand{display:flex;align-items:center;gap:12px;font-weight:650;font-size:18px;letter-spacing:1px;margin-bottom:44px}.brandmark{background:#e5d5a7;color:#254d3f;border-radius:14px 14px 4px 14px;padding:5px 12px;font-family:serif;font-size:25px}.brand small{display:block;font-size:9px;letter-spacing:2px;color:#a7c1b3;margin-top:5px}.navlabel{font-size:11px;color:#a1b5aa;margin-left:14px;margin-bottom:12px;letter-spacing:2px}nav{display:flex;flex-direction:column;gap:6px}nav button{text-align:left;background:transparent;color:#b7cbc0;border:0;padding:12px 14px;font-weight:500}nav button span{display:inline-block;width:29px;font-size:12px;color:#8cab99}nav button:hover,nav button.active{background:#315b4d;color:white}.localnote{margin-top:auto;font-size:12px;color:#c0d0c6}.localnote i{display:inline-block;width:6px;height:6px;background:#aecb7e;border-radius:50%;margin-right:4px}.localnote span{display:block;color:#8ead9c;font-size:11px;margin-top:9px;line-height:1.9}main{margin-left:224px;padding:30px 40px;max-width:1650px}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px}.eyebrow{font-size:11px;letter-spacing:2px;color:var(--muted)}h1{margin:5px 0 0;font-size:27px;font-weight:650;letter-spacing:.5px}.monthswitch{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:12px}.monthswitch input{font-size:14px;font-weight:600}.card{background:var(--paper);border:1px solid var(--line);border-radius:12px;margin-bottom:20px;overflow:hidden}.cardhead{padding:20px 23px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:16px}.cardhead h2{font-size:16px;margin:0}.hint{font-size:12px;color:var(--muted);margin:4px 0 0}.body{padding:24px}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-bottom:20px}.stat{background:white;border:1px solid var(--line);border-radius:12px;padding:18px 23px}.stat .label{color:var(--muted);font-size:12px}.stat strong{display:block;font-size:27px;line-height:1.2;margin-top:8px;font-weight:600}.stat small{font-size:12px;font-weight:400;margin-left:7px;color:var(--muted)}.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.toolbar label{color:var(--muted);font-size:12px}.scroll{max-height:56vh;overflow:auto}table{width:100%;border-collapse:collapse}th{background:#f2f5f0;color:#6b7e71;font-weight:500;font-size:12px;text-align:left;padding:12px 22px;position:sticky;top:0;z-index:1;white-space:nowrap}td{padding:11px 22px;border-bottom:1px solid #edf0ea}tbody tr:hover{background:#fbfcf8}td input[type=number]{width:100px;padding:6px 9px}.num{text-align:right;font-variant-numeric:tabular-nums}.code{font-family:ui-monospace,SFMono-Regular,monospace;color:#8d978f;font-size:11px}.tag{display:inline-block;padding:3px 9px;font-size:11px;border-radius:5px;background:var(--soft);color:var(--green)}.tag.warn{background:#fbf0d9;color:#9a6e22}.tag.off{background:#f0f1ee;color:#879287}.savebar{padding:15px 23px;display:flex;justify-content:space-between;align-items:center;background:#fbfcf8;border-top:1px solid var(--line);gap:15px}.savebar span{color:var(--muted);font-size:12px}.fields{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.field{display:flex;flex-direction:column;gap:7px}.field label{font-size:12px;color:var(--muted)}.field input,.field select{width:100%}.wide{grid-column:1/-1}.empty{padding:40px;text-align:center;color:var(--muted)}.calendar{display:flex;flex-wrap:wrap;gap:7px;padding:16px 23px}.daychip{width:39px;height:39px;padding:0;color:#79877b;font-size:12px}.daychip.done{background:#e7f0e8;color:#2c624a;border-color:#caddc9}.daychip.off{background:#f0eddf;color:#978149}.daychip.selected{box-shadow:0 0 0 2px var(--green);border-color:white}.subnote{padding:12px 23px;color:var(--muted);font-size:12px;border-top:1px solid var(--line)}.error{color:var(--danger)}#notice:not(:empty){padding:12px 16px;background:#fff2ee;border:1px solid #efc7bc;border-radius:8px;margin-bottom:16px;color:#9d3931}.errorrow{background:#fff2ee!important}.split{display:grid;grid-template-columns:1fr 1fr;gap:20px}.backup-note{line-height:1.9;font-size:13px;color:#627469}.filepicker{display:block;width:100%;margin:15px 0}dialog{border:1px solid var(--line);border-radius:15px;padding:0;width:min(820px,94vw);max-height:90vh;color:var(--ink);box-shadow:0 20px 80px #102f3340}dialog::backdrop{background:#132c3860}dialog .scroll{max-height:35vh}.modalhead{padding:20px 24px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}.modalhead h2{margin:0;font-size:19px}.modalbody{padding:24px}.modalfoot{padding:15px 24px;background:#f8faf5;display:flex;gap:10px;justify-content:flex-end}.modalerror{color:var(--danger);font-size:13px;margin:10px 0}footer{font-size:11px;color:#94a095;margin:25px 0}#toast{position:fixed;bottom:28px;left:50%;transform:translateX(-50%);padding:12px 22px;background:#213f34;color:white;border-radius:9px;box-shadow:0 5px 22px #0002;display:none;z-index:10}.saved-dot{color:var(--green)}.inline-note{font-size:12px;color:#8b7760;margin:12px 0}.previewrow select{min-width:210px}.selection label{margin-right:18px}.badge-count{font-size:12px;color:#8b958a;font-weight:400;margin-left:8px}@media(max-width:1050px){main{padding:24px}.sidebar{width:190px}main{margin-left:190px}.fields{grid-template-columns:repeat(2,1fr)}td,th{padding:10px 14px}}@media(max-width:760px){.sidebar{position:static;width:100%;padding:15px}.brand{margin-bottom:12px}.navlabel,.localnote{display:none}nav{flex-direction:row;overflow:auto}nav button{white-space:nowrap;padding:8px}nav button span{display:none}main{margin:0;padding:16px}.topbar{align-items:flex-start}.monthswitch{flex-direction:column;gap:2px}.stats{gap:8px}.stat{padding:14px}.stat strong{font-size:22px}.split,.fields{grid-template-columns:1fr}.cardhead{align-items:flex-start;flex-direction:column}.scroll{max-height:60vh}}
.brand .brandmark{display:block;width:50px;height:55px;object-fit:contain;flex-shrink:0;padding:3px;background:transparent;border-radius:0}
.stats.production-stats{grid-template-columns:repeat(4,minmax(0,1fr))}@media(max-width:1050px){.stats.production-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}
.scroll td:first-child{min-width:180px}.sidebar{overflow-y:auto}
#nav{gap:16px}.nav-section{flex-shrink:0;min-width:0}.nav-section-heading{font-size:11px;font-weight:500;color:#8faf9d;letter-spacing:1.5px;margin:0 14px 7px;padding-top:4px}.nav-section-links{display:flex;flex-direction:column;gap:3px}.nav-section-links button{width:100%}
@media(max-width:760px){.sidebar #nav{flex-direction:column;gap:12px;max-height:44vh;overflow-y:auto}.nav-section-heading{margin-left:8px}.nav-section-links{flex-direction:row;overflow-x:auto;padding-bottom:3px}.nav-section-links button{width:auto;flex-shrink:0}}
@media(min-width:761px){.sidebar nav{min-height:0;overflow-y:auto;flex:1}.sidebar nav button{flex-shrink:0}.sidebar .brand,.sidebar .navlabel,.sidebar .localnote{flex-shrink:0}.sidebar .localnote{padding-top:12px}}
.stock-warning-half{background:#fff3ce;color:#795000;padding:12px;border-left:4px solid #d9a300}
.np-section{border:1px solid var(--line);border-radius:8px;margin:18px 0;padding:16px}.np-section legend{font-weight:600}#modal:has(#np-form){width:min(1080px,96vw)}#np-print-frame{width:100%;height:65vh;border:1px solid var(--line)}.np-print{background:white;padding:20px;color:black}.np-print th{position:static;width:30%;white-space:normal}.np-print td{white-space:pre-wrap}.np-print h2{font-size:16px;margin-top:24px}@media print{.np-print{padding:0}.np-print tr{break-inside:avoid}.np-print h2{break-after:avoid}}
.stock-warning-urgent{background:#ffe3df;color:#97291d;padding:12px;border-left:4px solid #c23c2b}
.stock-expired-status{color:#b42318;font-weight:600}
.sales-stat-card>.cardhead{padding:22px 24px}
.sales-stat-card>.cardhead .hint{margin-top:8px;line-height:1.8}
.sales-stat-filters{display:grid;grid-template-columns:minmax(150px,200px) minmax(150px,220px) minmax(360px,1fr);gap:20px;align-items:end;padding:20px 24px 24px}
.sales-stat-filters>.field,.sales-stat-filters>label,.sales-stat-shop{display:flex;flex-direction:column;gap:8px;min-width:0;margin:0;color:var(--muted);font-size:12px}
.sales-stat-filters label{margin:0;font-size:12px;color:var(--muted)}
.sales-stat-shop-controls{display:grid;grid-template-columns:minmax(0,1fr) minmax(150px,220px);gap:12px;min-width:0;align-items:start}
.sales-stat-shop-controls>.shop-search-control{display:block;width:100%;max-width:none;min-width:0;margin:0}
.sales-stat-filters :is(input,select){width:100%;max-width:none;min-width:0;height:42px;margin:0;font-size:14px}
.sales-stat-card>.sales-stat-summary{grid-template-columns:repeat(2,minmax(0,1fr));margin:0;padding:0 24px 24px;gap:20px}
.sales-stat-summary .stat{padding:20px 24px}
.sales-stat-summary strong{font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.sales-stat-summary .sales-stat-loss-card{display:flex;flex-wrap:wrap;align-items:flex-start;gap:12px 32px}
.sales-stat-loss-card>div{min-width:0;max-width:100%}
.sales-stat-table{min-width:1080px}
.sales-stat-table :is(th,td){padding:13px 20px;line-height:1.7}
.sales-stat-table th:first-child{width:24%}
.sales-stat-table th:not(:first-child),.sales-stat-table td:not(:first-child){text-align:right;font-variant-numeric:tabular-nums}
.sales-stat-card>.subnote{margin:0;line-height:1.8;padding:16px 24px}
@media(max-width:1100px){.sales-stat-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.sales-stat-shop{grid-column:1/-1}}
@media(max-width:600px){.sales-stat-filters{grid-template-columns:minmax(0,1fr);padding:18px;gap:16px}.sales-stat-shop-controls{grid-template-columns:minmax(0,1fr);gap:8px}.sales-stat-card>.sales-stat-summary{grid-template-columns:minmax(0,1fr);padding:0 18px 18px;gap:12px}.sales-stat-card>.cardhead{padding:18px}}
.trade-account-card>.body{padding:20px 24px}
.trade-account-card>.body>p{font-size:13px;line-height:1.8;color:var(--muted)}
.trade-account-filters{display:grid;grid-template-columns:minmax(240px,2fr) minmax(170px,1fr) repeat(2,minmax(150px,1fr)) auto;gap:16px;align-items:end}
.trade-account-filters>label,.trade-account-customer-field{display:flex;flex-direction:column;gap:8px;min-width:0;margin:0;font-size:12px;color:var(--muted)}
.trade-account-filters :is(input,select){width:100%;max-width:none;min-width:0;height:42px;margin:0;font-size:14px}
.trade-account-customer-field{grid-column:1/-1}
.trade-account-customer-picker{display:grid;grid-template-columns:minmax(220px,360px) minmax(240px,480px);gap:12px}
.trade-account-filters button{height:42px;white-space:nowrap}
#trade-account-filter-error:empty{display:none}
#trade-account-filter-error{color:#b42318}
.trade-account-table{width:100%;min-width:1060px;table-layout:fixed}
.trade-account-table :is(th,td){padding:16px;vertical-align:top;line-height:1.7;overflow-wrap:anywhere}
.trade-account-table th:first-child{width:11%}.trade-account-table th:nth-child(2){width:21%}
.trade-account-table .trade-account-source{display:block;font-size:12px;color:var(--muted);margin-top:5px}
.trade-account-table button{white-space:nowrap;padding:8px 10px}
.trade-account-product-table{min-width:880px}
.trade-account-product-table :is(th,td){padding:14px 10px;white-space:normal;vertical-align:top;overflow-wrap:anywhere}
.trade-account-product-table th:first-child{width:10%}
.trade-account-product-table td:first-child{min-width:0}
.trade-account-product-table th:nth-child(2){width:13%}
.trade-account-product-table th:nth-child(3){width:44%}
.trade-account-product-table th:nth-child(4){width:13%}
.trade-account-product-table th:nth-child(5){width:8%}
.trade-account-product-table th:nth-child(6){width:12%}
.trade-account-product-table small{display:block;color:var(--muted);font-size:12px;margin-top:6px;line-height:1.6}
.trade-account-product-lines{min-width:0;font-size:13px}
.trade-account-product-head,.trade-account-product-line{display:grid;grid-template-columns:minmax(0,1fr) 54px 66px 72px;gap:8px;align-items:start}
.trade-account-product-head{color:var(--muted);font-size:11px;padding:0 0 8px;border-bottom:1px solid var(--line)}
.trade-account-product-line{padding:9px 0;border-bottom:1px solid #edf0ea;line-height:1.7}
.trade-account-product-line:last-child{border-bottom:0;padding-bottom:0}
.trade-account-product-line>div{min-width:0;overflow-wrap:anywhere}
.trade-account-product-head>span:not(:first-child),.trade-account-product-line>span{text-align:right;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.trade-account-product-line small{margin-top:3px}
.trade-account-product-line.is-void{color:var(--muted);opacity:.75}
.trade-account-product-line.is-return{color:#a33b36}
.trade-account-row-actions{display:flex;flex-direction:column;gap:8px;align-items:stretch}
.trade-account-row-actions button{white-space:normal;line-height:1.6;width:100%;font-size:12px;padding:8px}
.trade-account-row-actions button:disabled{cursor:not-allowed}
.trade-account-dialog-products{margin:16px 0;max-height:44vh;overflow:auto;border:1px solid var(--line);border-radius:8px;padding:14px}
#modal:has(.trade-account-dialog-products){width:min(1100px,96vw)}
@media(max-width:1100px){.trade-account-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.trade-account-filters>label:first-of-type{grid-column:1/-1}}
@media(max-width:760px){.trade-account-card>.body{padding:18px}.trade-account-customer-picker{grid-template-columns:minmax(0,1fr)}.trade-account-filters{gap:12px}}
.trade-supplier-page>.cardhead{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:20px 24px}
.trade-supplier-page>.body{padding:20px 24px}
.trade-supplier-page>.body>p{font-size:13px;line-height:1.8;color:var(--muted)}
.trade-supplier-search{display:flex;flex-direction:column;gap:8px;max-width:520px}
.trade-supplier-search input{width:100%;max-width:none;margin:0}
.trade-supplier-page .trade-supplier-list-scroll{max-height:none;overflow-x:auto}
.trade-supplier-table{width:100%;min-width:1100px;table-layout:fixed}
.trade-supplier-table :is(th,td){padding:16px;vertical-align:top;line-height:1.7;overflow-wrap:anywhere}
.trade-supplier-table small{display:block;color:var(--muted);margin-top:5px}
.trade-supplier-table button{white-space:nowrap;font-size:13px;padding:8px 10px}
.trade-supplier-details{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 32px;padding:0 24px 24px}
.trade-supplier-field{padding:16px 0;border-bottom:1px solid var(--line);min-width:0}
.trade-supplier-field>div{color:var(--muted);font-size:12px}
.trade-supplier-field>p{margin:7px 0 0;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7}
.supplier-field-wide{grid-column:1/-1}
@media(max-width:760px){.trade-supplier-details{grid-template-columns:minmax(0,1fr);gap:0}.trade-supplier-page>.cardhead,.trade-supplier-page>.body{padding:18px}.trade-supplier-page>.cardhead h2{flex-basis:100%}}
.stock-expiry-label{display:inline-block;padding:3px 7px;border-radius:5px;font-size:12px;line-height:1.6}
.stock-expiry-label.stock-expiry-expired{background:#fee4e2;color:#b42318;font-weight:600}
.stock-expiry-label.stock-expiry-soon{background:#fff0c2;color:#854d0e;font-weight:600}
.stock-expiry-label.stock-expiry-half{background:#fff8df;color:#795000}
.stock-expiry-label.stock-expiry-missing{background:#fff0c2;color:#854d0e;font-weight:600}
tr.stock-expiry-missing>td{background:#fffdf4}
.trade-expiry-stock-table{width:100%;min-width:960px;table-layout:fixed}
.trade-expiry-stock-table th:first-child{width:25%}
.trade-expiry-stock-table th:nth-child(2){width:27%}
.trade-expiry-stock-table th:nth-child(3),.trade-expiry-stock-table th:nth-child(4){width:12%}
.trade-expiry-stock-table th:nth-child(5){width:24%}
.trade-expiry-stock-table :is(th,td){padding:14px 16px;vertical-align:top;overflow-wrap:anywhere;white-space:normal}
.trade-expiry-stock-table td:nth-child(3),.trade-expiry-stock-table td:nth-child(4){font-variant-numeric:tabular-nums}
.trade-stock-expiry>small,.trade-expiry-lots li small{display:block;color:var(--muted);font-size:12px;line-height:1.7;margin-top:4px}
.trade-expiry-empty{color:var(--muted);font-size:12px}
.trade-expiry-lots{margin-top:8px;font-size:12px}
.trade-expiry-lots summary{cursor:pointer;color:var(--green)}
.trade-expiry-lots ul{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:8px}
.trade-expiry-lots li{padding:8px 10px;border-left:3px solid var(--line);background:var(--soft);border-radius:4px}
.trade-expiry-lots li.stock-expiry-expired{border-color:#b42318;background:#fff0ed}
.trade-expiry-lots li:is(.stock-expiry-soon,.stock-expiry-half,.stock-expiry-missing){border-color:#c58a24;background:#fff9e8}
tr.stock-expiry-expired>td{background:#fff0ed}
tr.stock-expiry-soon>td{background:#fff9e8}
tr.stock-expiry-half>td{background:#fffdf4}
.stock-expiry-summary{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:14px 0;line-height:1.7}
.stock-expiry-summary>small{flex-basis:100%;color:var(--muted);font-size:12px}
#inventory-shortage .toolbar{flex-wrap:wrap;gap:10px}
#inventory-shortage td button{margin:3px 6px 3px 0;white-space:nowrap}
#inventory-shortage .scroll{overflow-x:auto}
#sales-print-frame{width:100%;height:60vh;border:1px solid #ccc;background:white}#sales-print-button:disabled{cursor:not-allowed}
#modal:has(#stock-receipt){width:min(1000px,96vw);overflow:hidden}
#modal:has(#stock-receipt) .modalbody{padding:16px 22px;max-height:76vh;overflow:auto}
#modal:has(#st-return-frame),#modal:has(#st-summary-frame){width:min(1240px,96vw);max-width:96vw;max-height:94vh}
#modal:has(#st-return-frame) .modalbody,#modal:has(#st-summary-frame) .modalbody{max-height:calc(94vh - 150px);overflow:auto;padding:16px 24px}
#st-return-frame,#st-summary-frame{display:block;width:100%;height:64vh;min-height:280px;border:1px solid var(--line);background:white}
#modal:has(#st-return-frame) .modalfoot,#modal:has(#st-summary-frame) .modalfoot{flex-wrap:wrap}
#st-return-frame{display:block;width:100%;height:62vh;border:1px solid #ccc;background:#fff}
.receipt-header{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
#stock-receipt label{display:flex;flex-direction:column;gap:4px;font-size:12px}
#stock-receipt input,#stock-receipt select{width:100%;min-width:0;padding:7px 9px}
#stock-receipt-rows details{border:1px solid var(--line);border-radius:8px;margin:10px 0;background:white}
#stock-receipt-rows summary{padding:12px;cursor:pointer;background:var(--soft);font-size:13px;overflow-wrap:anywhere}
#stock-receipt-rows fieldset{border:0;padding:12px;margin:0;min-width:0}
#stock-receipt-rows legend{position:absolute;clip-path:inset(50%);width:1px;height:1px;overflow:hidden}
.receipt-picker{display:grid;grid-template-columns:1fr 2fr;gap:12px;margin-bottom:12px}
#stock-receipt .fields{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:12px}
.receipt-actions{position:sticky;bottom:-16px;z-index:2;border-top:1px solid var(--line);flex-wrap:wrap;margin:12px -22px -16px;padding:12px 22px;background:#f8faf5}
#receipt-count{margin-right:auto;align-self:center;font-size:13px}
@media(max-width:650px){.receipt-header,.receipt-picker{grid-template-columns:1fr}#stock-receipt .fields{grid-template-columns:repeat(2,minmax(0,1fr))}}
[hidden]{display:none!important}
#modal:has(#stock-document-detail){width:min(1250px,96vw)}
#modal:has(#task-refresh){width:min(1400px,96vw);max-height:92vh;overflow:hidden}
#modal:has(#task-refresh) .modalbody{max-height:calc(92vh - 165px);overflow:auto;padding:18px 24px}
#modal:has(#task-refresh) .scroll{max-height:none;overflow-x:auto;overflow-y:visible}
#modal:has(#task-refresh) table{width:100%;min-width:900px;table-layout:fixed}
#modal:has(#task-refresh) th,#modal:has(#task-refresh) td{padding:12px 10px;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
#modal:has(#task-refresh) th:first-child{width:22%}
#modal:has(#task-refresh) th:last-child{width:34%}
#modal:has(#task-refresh) select{display:block;width:100%;min-width:0;margin-bottom:8px}
#modal:has(#task-refresh) .modalfoot{flex-wrap:wrap}
#modal:has(#task-refresh) .task-batch-description{font-size:12px;white-space:normal;overflow-wrap:anywhere;margin:4px 0 8px}
#modal:has(#task-refresh) .task-collapsed-group{margin:14px 0;border:1px solid var(--line);border-radius:8px}
#modal:has(#task-refresh) .task-collapsed-group>summary{padding:12px;cursor:pointer;background:var(--soft);font-weight:600}
#stock-document-detail .scroll{max-height:65vh;overflow:auto}
.stock-document-table{min-width:1000px}
.stock-document-table td,.stock-document-table th{padding:12px 16px}
.stock-document-table td:first-child{min-width:210px}
.stock-document-table .stock-document-batch{min-width:180px;max-width:280px;overflow-wrap:anywhere}
.stock-document-nowrap,.stock-document-table button{white-space:nowrap}
.stock-document-table td:last-child{vertical-align:middle}
.stock-receipt-row-actions{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
#stock-document-detail .stock-correction-cell{position:sticky;right:0;min-width:150px;width:150px;background:var(--paper);z-index:2}
#stock-document-detail .stock-void-cell{position:sticky;right:150px;min-width:190px;width:190px;background:var(--paper);z-index:2;box-shadow:-3px 0 4px #00000008}
#stock-document-detail thead .stock-correction-cell{background:var(--soft)}
#modal:has(#semi-form){width:min(960px,96vw)}
#modal:has(#semi-form) .modalbody{max-height:78vh;overflow:auto;padding:18px 24px}
.semi-sections{display:grid;gap:16px;margin-bottom:14px}
.semi-section{border:1px solid var(--line);border-radius:10px;padding:14px 16px}
.semi-section h3{font-size:14px;margin:0 0 12px;color:var(--green)}
.semi-grid{display:grid;gap:12px 16px;align-items:start}
.semi-grid+.semi-grid{margin-top:12px}
.semi-grid-three{grid-template-columns:1.5fr 1fr 1fr}
.semi-grid-two{grid-template-columns:1fr 1.5fr}
.semi-grid-four{grid-template-columns:1.3fr .8fr .8fr 1.3fr}
#semi-form label{display:flex;flex-direction:column;gap:6px;min-width:0;font-size:12px;color:var(--muted)}
#semi-form input,#semi-form select{width:100%;min-width:0;height:40px;color:var(--ink)}
#semi-expires{background:var(--soft)}
#semi-conversion{margin-top:10px;color:var(--green);font-weight:600}
@media(max-width:700px){.semi-grid-three,.semi-grid-four{grid-template-columns:repeat(2,minmax(0,1fr))}.semi-grid-three>label:first-child{grid-column:1/-1}.semi-grid-two{grid-template-columns:1fr 1fr}}
@media(max-width:440px){.semi-grid-three,.semi-grid-four,.semi-grid-two{grid-template-columns:1fr}.semi-section{padding:12px}}
.inventory-tabs{margin-bottom:20px;gap:12px}
.inventory-tabs button{padding:12px 20px}
.inventory-directory{display:flex;flex-direction:row;flex-wrap:nowrap;overflow-x:auto;gap:8px;padding:8px 0;align-items:center}
.inventory-directory button{flex:0 0 auto;white-space:nowrap;padding:11px 16px}
.inventory-directory button[hidden]{display:none}
.stock-search-tools{display:flex;flex-direction:row;align-items:flex-end;gap:12px;flex-wrap:wrap;margin-bottom:8px}
.stock-search-tools button[hidden]{display:none}
#order-plan-print-frame{width:100%;height:65vh;border:1px solid #aaa;background:white}
#label-print-frame{width:100%;height:55vh;border:1px solid #aaa}
#label-profile-form label{display:block;margin:8px 0}
#label-profile-form textarea{width:100%;min-height:65px}
 .label-print-explanation{flex:0 0 100%;max-width:100%;white-space:normal;color:#8a3b22;font-size:14px;line-height:1.5;margin:0 0 10px}
#modal:has(#label-print-frame){width:min(1000px,96vw)}
#modal:has(#label-print-frame) .modalfoot{flex-wrap:wrap;align-items:flex-start;min-width:0}
#modal:has(#label-print-frame) .label-print-explanation{width:100%;min-width:0;overflow-wrap:anywhere;white-space:pre-wrap;text-align:left}
#modal:has(#label-print-frame) .modalfoot button{flex:0 0 auto;white-space:nowrap;max-width:100%}
#modal:has(#label-print-frame) [data-label-edit]{white-space:nowrap;min-width:88px}
#modal:has(#label-print-frame) td{overflow-wrap:anywhere}
.settlement-toolbar{display:flex;align-items:center;flex-wrap:nowrap;gap:12px;overflow-x:auto;padding:4px 0 12px}
.settlement-toolbar>button,.settlement-toolbar>label{flex:0 0 auto;white-space:nowrap;margin:0}
.settlement-toolbar>label{display:flex;align-items:center;gap:8px}
.settlement-toolbar select{width:auto;min-width:130px;max-width:260px;margin:0}
#ci-packaging .package-equation{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;gap:10px;flex-wrap:nowrap;margin:4px 0;font-size:16px;min-width:0}
#ci-packaging .package-equation input{width:110px;min-width:60px;height:40px;margin:0;flex:0 1 110px;padding:8px}
#ci-packaging .package-equation select{width:100px;min-width:65px;height:40px;margin:0;flex:0 1 100px;padding:8px}
#ci-packaging #ci-weight-unit{display:none}
#ci-package-fields{row-gap:12px}
#modal:has(#cost-item-form) .modalbody{padding:16px 24px}
#cost-item-form>.fields{max-height:calc(90vh - 260px);overflow-y:auto;padding:4px 8px 12px 0}
#cost-item-form>.modalfoot{margin-top:12px;border-top:1px solid var(--line)}
#ci-packaging .package-weight-equation>label,#ci-packaging .package-weight-equation>p{display:none}
#ci-packaging .equation-prefix{white-space:nowrap}
#ci-packaging [hidden]{display:none!important}
#ci-packaging details>summary{cursor:pointer;margin-bottom:10px}
.product-catalog-actions{white-space:nowrap;width:1%;vertical-align:middle}
.product-catalog-actions>button{display:inline-block;white-space:nowrap;vertical-align:middle;margin:0 0 0 6px;padding:9px 12px;min-height:40px}
.product-catalog-actions>button:first-child{margin-left:0}
.product-catalog-table th,.product-catalog-table td{padding-left:12px;padding-right:12px}
.product-catalog-table td:nth-child(2){min-width:200px;max-width:300px;white-space:normal;overflow-wrap:anywhere}
.product-catalog-table td:nth-child(3){min-width:100px;max-width:180px;white-space:normal;overflow-wrap:anywhere}
.product-catalog-table td:nth-child(4){min-width:70px;white-space:nowrap}
.product-catalog-table td:nth-child(4) .tag{white-space:nowrap}
#ci-price-row{display:flex;align-items:flex-end;gap:20px;min-width:0}
#ci-price-row>.field{flex:1 1 0;min-width:0}
#ci-price-row input,#ci-price-row select{height:42px;width:100%;margin:0}
#ci-price-row label{margin:0;line-height:1.5}
/* Full picking preview: class rules work with the application's CSP. */
#modal:has(#replenishment-print-frame){width:min(1400px,96vw);max-width:96vw;max-height:94vh}
#modal:has(#replenishment-print-frame) .modalbody{padding:16px;max-height:calc(94vh - 150px);overflow:auto}
#replenishment-print-frame{display:block;width:100%;height:65vh;min-height:260px;border:1px solid var(--line);background:white}
#inventory-supply>.cardhead{flex-wrap:wrap}
#inventory-supply table{table-layout:fixed;min-width:900px}
#inventory-supply th,#inventory-supply td{padding:10px 8px;vertical-align:top;overflow-wrap:anywhere}
#inventory-supply th{white-space:normal}
#inventory-supply th:nth-child(1){width:8%}
#inventory-supply th:nth-child(2){width:18%}
#inventory-supply th:nth-child(3){width:5%}
#inventory-supply th:nth-child(4),#inventory-supply th:nth-child(5),#inventory-supply th:nth-child(6){width:9%}
#inventory-supply th:nth-child(7){width:12%}
#inventory-supply th:nth-child(8){width:30%}
#inventory-supply td:nth-child(n+4):nth-child(-n+6){font-variant-numeric:tabular-nums}
#inventory-supply td:last-child select{width:100%;min-width:0;margin-bottom:6px}
#inventory-supply td:last-child button{white-space:nowrap;padding:8px 10px}
@media(max-width:1100px){
 #inventory-supply th:last-child,#inventory-supply td:last-child{position:sticky;right:0;background:var(--paper);box-shadow:-2px 0 4px #0001}
 #inventory-supply th:last-child{z-index:3;background:var(--soft)}
}
.st-reconcile-summary{padding:16px;background:var(--soft);border-radius:8px;margin-bottom:16px}
.st-reconcile-summary h3{margin:0 0 10px}
#st-details summary{cursor:pointer;padding:12px 0;font-weight:600}
.st-reconcile-footer{position:sticky;bottom:0;background:var(--paper,#fff);padding:14px 0;border-top:1px solid #ddd;z-index:5}
.st-reconcile-footer .toolbar{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
#fees-form .expense-groups{overflow-x:auto;max-height:none}
#fees-form .expense-groups th{position:static}
#fees-form .expense-groups table{min-width:900px}
#fees-form .cardhead>.tag{white-space:nowrap;flex-shrink:0}
.np-steps {display:flex;flex-direction:row;gap:8px;flex-wrap:wrap;margin-bottom:20px}
.np-steps button {color:var(--ink);border:1px solid var(--line);background:white;padding:8px 12px}
.np-steps button.primary {color:white;background:var(--green)}
#modal:has(#np-wizard) {width:min(1120px,96vw)}
.np-composition {border-left:3px solid #d5e3dc;padding:12px;margin:8px 0}
.np-recipe-line {border-bottom:1px solid #e3e9e4;padding:12px 0}
#np-wizard {max-width:1080px}
#np-wizard .toolbar {flex-wrap:wrap}
#np-wizard .toolbar input,#np-wizard .toolbar select {max-width:280px}
#np-wizard .fields {display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px}
#np-wizard .wide {grid-column:1/-1}
.scroll.warehouse-shortage-expanded{max-height:none;overflow:visible}
.warehouse-shortage-expanded th{position:static}
#product-profit .scroll { overflow-x: auto; }
#product-profit th, #product-profit td { white-space: nowrap; }
.shop-search-control{display:inline-flex;position:relative;flex-direction:column;vertical-align:middle;width:100%;max-width:320px;margin:3px 0}
.shop-search-control>input{width:100%;min-width:120px}
.shop-search-results{display:block;width:100%;max-height:260px;overflow:auto;background:var(--paper);border:1px solid var(--line);border-radius:8px;box-shadow:0 5px 18px #243b3626;padding:5px}
.shop-search-results[hidden]{display:none}
#sales-print-shops label[hidden],#label-shop label[hidden]{display:none!important}
.shop-search-count{display:block;padding:5px 8px;font-size:12px;color:var(--muted)}
.shop-search-option{display:block;width:100%;border:0;border-radius:4px;text-align:left;white-space:normal;overflow-wrap:anywhere}
@media print{.shop-search-control,[data-shop-print-search]{display:none}}
.payroll-scroll{width:100%;max-width:100%;overflow:auto;position:relative;isolation:isolate}
.payroll-table{min-width:1800px;border-collapse:separate;border-spacing:0}
.payroll-table .payroll-action{position:sticky;right:0;z-index:2;min-width:110px;white-space:nowrap;text-align:right;background:var(--paper);box-shadow:-5px 0 7px -5px #243b3660}
.payroll-table thead .payroll-action{z-index:4;background:var(--soft)}
.payroll-table tfoot .payroll-action{background:var(--soft)}
.payroll-table .payroll-action button{white-space:nowrap}
@media print{.payroll-scroll{overflow:visible}.payroll-table{min-width:0}.payroll-table .payroll-action{position:static;box-shadow:none}}

/* Consistent warehouse pages and raw / semi / finished stock dialogs. */
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.cardhead{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:10px;padding:18px 22px}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.cardhead h2{order:-1;margin:0 auto 0 0;min-width:200px}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.cardhead button{white-space:nowrap;margin:0}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.body{padding:18px 22px}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.body label{display:inline-flex;flex-direction:column;gap:6px;max-width:100%;min-width:min(300px,100%)}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.body p{margin:0 0 12px;line-height:1.8}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.scroll>table{min-width:980px;font-variant-numeric:tabular-nums}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.scroll>table :is(th,td){padding:14px 16px;vertical-align:middle}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.scroll>table :is(th,td):first-child{min-width:180px;max-width:300px;overflow-wrap:anywhere}
:is(#inventory-purchased,#inventory-semi,#inventory-finished)>.scroll>table :is(th,td):last-child{white-space:nowrap;text-align:right}
:is(#inventory-purchased,#inventory-semi,#inventory-finished) td button+button{margin-left:8px}
#modal:has(:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)){width:min(960px,96vw);max-height:92vh}
#modal:has(:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)) .modalbody{padding:22px 26px}
#modal:has(:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)) .modalhead{position:sticky;top:0;z-index:6;background:var(--paper)}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;align-items:start}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)>.fields{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;padding:0;align-items:start}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form) label:not([hidden]){display:flex;flex-direction:column;gap:6px;min-width:0;line-height:1.6}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form) :is(input:not([type=checkbox]),select,textarea){width:100%;min-height:42px;min-width:0;max-width:100%;margin:0}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form) .shop-search-control{max-width:none;margin:0}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form) label:has(input[type=checkbox]){grid-column:1/-1;display:flex;flex-direction:row;align-items:flex-start;gap:8px}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form) input[type=checkbox]{flex:none;margin:5px 0 0}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)>:is(p,details,.modalfoot,.toolbar){grid-column:1/-1;margin:0;line-height:1.8}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)>p:first-child{padding:12px 14px;background:var(--soft);border-radius:8px;color:var(--muted);font-size:13px}
:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)>button[type=submit]{grid-column:1/-1;justify-self:end;min-width:148px;margin:4px 0 0;position:sticky;bottom:0;z-index:5;box-shadow:0 0 0 8px var(--paper)}
#stock-sale-form>label:has([name=note]){grid-column:1/-1}
#stock-sale-form :is(#stock-sale-lot,#stock-sale-cost,#stock-sale-margin,#stock-sale-preview){padding:10px 14px;border-radius:7px;background:var(--soft)}
#stock-sale-form #stock-sale-preview{font-weight:600;color:var(--green);border:1px solid var(--line)}
/* Multi-line stock sales must not let an intrinsic table width pan the dialog. */
#modal:has(#stock-sale-form){width:min(1040px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:hidden}
#modal:has(#stock-sale-form) #modal-content{display:flex;flex-direction:column;min-width:0;max-height:calc(100dvh - 34px)}
#modal:has(#stock-sale-form) .modalhead{flex:none;position:static;gap:16px}
#modal:has(#stock-sale-form) .modalhead h2{min-width:0;overflow-wrap:anywhere}
#modal:has(#stock-sale-form) .modalhead button{flex:none;white-space:nowrap}
#modal:has(#stock-sale-form) .modalbody{flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}
#stock-sale-form,#stock-sale-form>*{min-width:0}
#stock-sale-form>p{overflow-wrap:anywhere}
#stock-sale-form>#stock-sale-add-line{grid-column:1/-1;justify-self:start;min-width:160px}
#stock-sale-form>button[type=submit]{position:static;box-shadow:none}
#stock-sale-form>#stock-sale-lines{grid-column:1/-1;width:100%;min-width:0;max-width:100%}
#stock-sale-lines:empty{display:none}
#stock-sale-lines table{width:100%;max-width:100%;table-layout:fixed}
#stock-sale-lines :is(th,td){padding:12px 10px;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
#stock-sale-lines th{position:static}
#stock-sale-lines th:first-child{width:44%}
#stock-sale-lines th:nth-child(2){width:13%}
#stock-sale-lines th:nth-child(3),#stock-sale-lines th:nth-child(4){width:16%}
#stock-sale-lines th:last-child{width:11%}
#stock-sale-lines td button{padding:7px 10px;white-space:nowrap}
@media(max-width:640px){
 #modal:has(#stock-sale-form){width:calc(100vw - 20px);max-width:calc(100vw - 20px);max-height:calc(100dvh - 20px)}
 #modal:has(#stock-sale-form) #modal-content{max-height:calc(100dvh - 22px)}
 #modal:has(#stock-sale-form) .modalhead{padding:16px}
 #stock-sale-lines :is(table,tbody){display:block}
 #stock-sale-lines thead{display:none}
 #stock-sale-lines tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--line);border-radius:8px;margin-bottom:12px;padding:6px}
 #stock-sale-lines td{display:block;min-width:0;border:0;padding:6px 8px}
 #stock-sale-lines td:first-child,#stock-sale-lines td:last-child{grid-column:1/-1}
 #stock-sale-lines td:first-child{font-weight:600}
 #stock-sale-lines td:last-child{text-align:right}
 #stock-sale-lines td:nth-child(2)::before{content:'数量：';color:var(--muted)}
 #stock-sale-lines td:nth-child(3)::before{content:'单价：';color:var(--muted)}
 #stock-sale-lines td:nth-child(4)::before{content:'金额：';color:var(--muted)}
}
@media(max-width:640px){
 :is(#inventory-purchased,#inventory-semi,#inventory-finished)>.cardhead h2{flex-basis:100%}
 :is(#inventory-purchased,#inventory-semi,#inventory-finished)>.cardhead button{flex:1}
 #modal:has(:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)) .modalbody{padding:16px}
 :is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form),:is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)>.fields{grid-template-columns:minmax(0,1fr);gap:14px}
 :is(#stock-sale-form,#semi-form,#finished-form,#stock-lot-form,#stock-receipt,#receipt-correct,#warehouse-waste-form)>button[type=submit]{width:100%}
}
.distribution-controls,.distribution-view-filters{display:flex;flex-wrap:wrap;align-items:flex-end;gap:14px;margin:0 0 16px}
.distribution-controls label,.distribution-view-filters label{display:flex;flex-direction:column;gap:7px;min-width:150px;font-size:13px;color:var(--muted)}
.distribution-controls :is(input,select),.distribution-view-filters :is(input,select){width:100%;min-width:0;margin:0;height:42px;color:var(--ink)}
.distribution-controls button,.distribution-view-filters button{height:42px;white-space:nowrap}
.distribution-view-filters{border-top:1px solid var(--line);padding-top:18px;margin-top:18px}
.distribution-view-filters label:nth-child(2){flex:1;max-width:420px}
.distribution-method summary{cursor:pointer;color:var(--green);font-weight:600}
.distribution-method p{font-size:13px;line-height:1.8;color:var(--muted)}
.distribution-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:18px}
.distribution-summary>div{border:1px solid var(--line);border-radius:10px;padding:16px;background:#fafbf8}
.distribution-summary span{display:block;color:var(--muted);font-size:12px}
.distribution-summary strong{display:block;font-size:24px;margin-top:8px}
.distribution-store>details>summary{cursor:pointer;padding:20px 24px;display:flex;flex-wrap:wrap;align-items:center;gap:12px 24px;list-style:none}
.distribution-store>details>summary::before{content:'▸';color:var(--muted)}
.distribution-store>details[open]>summary::before{content:'▾'}
.distribution-store>details>summary strong{font-size:17px;min-width:100px}
.distribution-store>details>summary span{font-size:13px;color:var(--muted)}
.distribution-store>details[open]>summary{border-bottom:1px solid var(--line)}
.distribution-store .distribution-preference{padding:12px 16px;background:#eff5f0;border-radius:8px;line-height:1.8;margin-top:0}
.distribution-store .distribution-warning{color:#996322;background:#fff3cf;border-radius:5px;padding:4px 8px}
.distribution-store .scroll{max-height:none}
.distribution-card-actions,.distribution-choice-list{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:14px 0}
.distribution-card-actions button{white-space:nowrap;min-height:38px}
.distribution-choice-list label{display:flex;align-items:center;gap:6px;white-space:nowrap}
.distribution-product-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:8px;max-height:300px;overflow:auto;padding:12px;border:1px solid var(--line);border-radius:8px}
.distribution-product-choices label{display:flex;gap:8px;align-items:flex-start;font-size:13px}
.distribution-product-choices input,.distribution-choice-list input{width:auto;flex:none}
.distribution-policy-table{width:100%;min-width:860px;table-layout:fixed}
.distribution-policy-table th:first-child{width:19%}.distribution-policy-table th:nth-child(2){width:8%}.distribution-policy-table th:nth-child(3){width:15%}.distribution-policy-table th:nth-child(4){width:13%}.distribution-policy-table th:nth-child(5){width:15%}.distribution-policy-table th:last-child{width:30%}
.distribution-policy-table :is(th,td){vertical-align:top;padding:14px 10px;overflow-wrap:anywhere}
.distribution-policy-table small{display:block;font-size:12px;color:var(--muted);line-height:1.7;margin-top:6px}
.distribution-policy-table input{width:86px;max-width:100%;margin:0}
.distribution-policy-table details{margin-top:8px;font-size:12px;line-height:1.8}
.distribution-policy-table summary,.distribution-feedback>summary{cursor:pointer;color:var(--green)}
.distribution-new-row{background:#f1f7ef}
.distribution-feedback{margin-top:20px;border-top:1px solid var(--line);padding-top:16px}
.distribution-policy-status p{margin:8px 0;line-height:1.8}
#modal:has([id^="distribution-"]){width:min(960px,calc(100vw - 40px));max-height:calc(100dvh - 40px);overflow:hidden}
#modal:has([id^="distribution-"]) #modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 42px);min-width:0}
#modal:has([id^="distribution-"]) :is(.modalhead,.modalfoot){flex:none}
#modal:has([id^="distribution-"]) .modalbody{flex:1 1 auto;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain}
#modal:has([id^="distribution-"]) .modalbody>label[for]{display:flex;flex-direction:column;gap:7px;margin:0 0 14px;min-width:0}
#modal:has([id^="distribution-"]) .modalbody>label[for]>:is(input,select){width:100%;min-width:0;margin:0;box-sizing:border-box}
#modal:has(#distribution-new-product) .modalbody{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 18px}
#modal:has(#distribution-new-product) .modalbody>label[for]{margin:0}
#modal:has(#distribution-new-product) .modalbody>label:first-child,#modal:has(#distribution-new-product) .modalbody>:is(p,.distribution-product-choices),#modal:has(#distribution-new-product) .modalbody>label:not([for]){grid-column:1/-1}
#modal:has([id^="distribution-"]) .modalbody>label:not([for]){display:flex;gap:8px;align-items:center}
#modal:has([id^="distribution-"]) .modalbody>label:not([for]) input[type=checkbox]{width:auto;flex:none}
@media(max-width:600px){#modal:has(#distribution-new-product) .modalbody{grid-template-columns:1fr}}
.distribution-table{width:100%;min-width:760px;table-layout:fixed}
.distribution-table th:first-child{width:24%}.distribution-table th:nth-child(2){width:11%}.distribution-table th:nth-child(3){width:14%}.distribution-table th:nth-child(4){width:15%}.distribution-table th:last-child{width:36%}
.distribution-table :is(th,td){vertical-align:top;padding:14px 12px;overflow-wrap:anywhere}
.distribution-table td>small{display:block;color:var(--muted);font-size:12px;line-height:1.6;margin-top:6px}
.distribution-table td>p{margin:0 0 8px;font-size:13px;line-height:1.7}
.distribution-table input{width:90px;max-width:100%;margin:0}.distribution-table input:invalid{border-color:#b64b43}
.distribution-table details{font-size:12px;line-height:1.8}.distribution-table summary{cursor:pointer;color:#28594b}
.distribution-table ul{padding-left:16px;margin:8px 0}
#distribution-message{color:#28594b;line-height:1.8}
#distribution-draft textarea{width:100%;font-family:monospace;white-space:pre;overflow:auto}
@media(max-width:700px){.distribution-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.distribution-controls label,.distribution-view-filters label{flex:1;min-width:140px}.distribution-controls button,.distribution-view-filters button{width:100%}.distribution-store>details>summary{padding:16px;gap:10px}.distribution-store .body{padding:16px}}
.trade-store-toolbar{justify-content:space-between;margin-bottom:14px;align-items:center;gap:12px}
.trade-store-picker{display:flex;flex-wrap:wrap;gap:8px}
.trade-store-toolbar #trade-store-new{margin-left:auto}
.trade-store-search-tools{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:16px 0 0}
.trade-store-search-tools label{display:flex;align-items:center;gap:10px}
.trade-store-search-tools input{width:min(360px,70vw)}
.trade-store-search-tools span,.trade-store-search-tools p{font-size:12px;color:var(--muted)}
.trade-store-search-tools p{flex-basis:100%;margin:0}
/* Scoped batch sale form: preserve other stock and financial dialogs. */
#modal:has(.trade-batch-sale){width:min(1280px,calc(100vw - 40px));max-width:none;max-height:94vh;overflow:hidden}
#modal:has(.trade-batch-sale) #modal-content{display:flex;flex-direction:column;max-height:calc(94vh - 2px);min-width:0}
#modal:has(.trade-batch-sale) .modalhead{flex:none}
#modal:has(.trade-batch-sale) .modalbody{min-height:0;overflow:auto;padding:18px 24px}
.trade-batch-sale{display:grid;gap:14px;min-width:0}
.trade-batch-sale .batch-sale-intro{margin:0;padding:14px 16px;background:var(--soft);border-radius:8px;line-height:1.8;color:var(--muted);font-size:13px}
.trade-batch-sale .batch-sale-details{display:grid;grid-template-columns:180px minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:end}
.trade-batch-sale .batch-sale-details textarea{height:42px;min-height:42px;padding:8px 11px;resize:vertical}
.trade-batch-sale label{display:flex;flex-direction:column;gap:8px;align-items:stretch;min-width:0;margin:0;font-size:13px}
.trade-batch-sale input,.trade-batch-sale select{width:100%;min-width:0;max-width:none;height:42px;margin:0}
.trade-batch-sale .batch-sale-picker{display:grid;grid-template-columns:minmax(180px,240px) minmax(0,1fr) auto;gap:14px;align-items:end;padding:12px 14px;background:#f8faf7;border:1px solid var(--line);border-radius:8px}
.trade-batch-sale .batch-sale-picker button{height:42px;white-space:nowrap}
.trade-batch-sale .batch-sale-table{max-height:42vh;border:1px solid var(--line);border-radius:8px}
.trade-batch-sale table{width:100%;min-width:980px;table-layout:fixed}
.trade-batch-sale th,.trade-batch-sale td{padding:10px;vertical-align:top;line-height:1.6}
.trade-batch-sale td:first-child{vertical-align:middle}
.trade-batch-sale td .hint{display:block;max-width:100%;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:4px}
.trade-batch-sale [data-sale-price-unit]{display:none}
.trade-batch-sale th{font-size:12px;white-space:nowrap}
.trade-batch-sale td:first-child{overflow-wrap:anywhere}
.trade-batch-sale td:first-child small{display:inline-block;margin-top:4px;color:var(--muted)}
.trade-batch-sale .batch-sale-price{display:flex;align-items:center;gap:8px}
.trade-batch-sale .batch-sale-price input{flex:1;width:0}
.trade-batch-sale .batch-sale-price small{flex:none;white-space:nowrap;color:var(--muted)}
.trade-batch-sale td:nth-child(6),.trade-batch-sale th:nth-child(6){text-align:right;font-variant-numeric:tabular-nums}
.trade-batch-sale td:last-child,.trade-batch-sale th:last-child{text-align:center}
.trade-batch-sale td:last-child button{padding:8px 12px;white-space:nowrap}
.trade-batch-sale #trade-error{margin:0}
.trade-batch-sale #trade-error:empty{display:none}
.trade-batch-sale .batch-sale-footer{display:flex;align-items:center;justify-content:space-between;gap:20px;padding-top:18px;border-top:1px solid var(--line)}
.trade-batch-sale #batch-sale-total{margin:0;font-weight:600;line-height:1.8}
.trade-batch-sale .batch-sale-footer button{flex-shrink:0;white-space:nowrap}
@media(max-width:760px){#modal:has(.trade-batch-sale){width:calc(100vw - 24px)}.trade-batch-sale .batch-sale-details{grid-template-columns:1fr}.trade-batch-sale .batch-sale-picker{grid-template-columns:minmax(0,1fr) auto}.trade-batch-sale .batch-sale-picker label:first-child{grid-column:1/-1}.trade-batch-sale .batch-sale-footer{align-items:stretch;flex-direction:column}}
/* Shared transactional dialogs: scoped to marked forms, never global labels. */
#modal:has(.business-dialog-form){width:min(1040px,calc(100vw - 48px));max-width:none}
.business-dialog-form{display:flex;flex-direction:column;gap:18px;min-width:0}
.business-dialog-form>p,.business-dialog-form>h3{margin:0;line-height:1.8}
.business-dialog-form>p:first-child{padding:14px 16px;background:var(--soft);border-radius:8px;color:var(--muted);font-size:13px}
.business-dialog-form label{display:flex;flex-direction:column;align-items:stretch;gap:8px;margin:0;min-width:0;font-size:13px}
.business-dialog-form :is(input:not([type=checkbox]):not([type=radio]),select,textarea){min-width:0;max-width:none;width:100%;margin:0}
.business-dialog-form :is(input:not([type=checkbox]):not([type=radio]),select){height:42px}
.business-dialog-form :is(input[type=checkbox],input[type=radio]){width:auto;align-self:flex-start}
.business-dialog-form .fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;align-items:start;margin:0}
.business-dialog-form .fields .wide{grid-column:1/-1}
.business-dialog-form .toolbar{gap:12px;align-items:end;margin:0}
.business-dialog-form .toolbar:has(input[type=search]):has(select),.business-dialog-form .business-picker{display:grid;grid-template-columns:minmax(180px,250px) minmax(0,1fr) auto;gap:14px;align-items:end}
.business-dialog-form .toolbar:has(input[type=search]):has(select)>select{width:100%;grid-column:2;grid-row:1}
.business-dialog-form .toolbar:has(input[type=search]):has(select)>button{grid-column:3;grid-row:1;white-space:nowrap;height:42px}
.business-dialog-form .toolbar:has(input[type=search]):has(select)>label:has(input[type=checkbox]){grid-column:1/-1;flex-direction:row;align-items:center}
.business-dialog-form .business-picker{padding:16px;background:#f8faf7;border:1px solid var(--line);border-radius:8px}
.business-dialog-form .business-picker button{height:42px;white-space:nowrap}
.business-dialog-form .business-details{display:grid;grid-template-columns:200px minmax(0,1fr);gap:20px;align-items:start}
.business-dialog-form .business-recipient{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}
.business-dialog-form .business-recipient>span:not(.shop-search-control){grid-column:1/-1}
.business-dialog-form .shop-search-control{max-width:none;margin:0}
.business-dialog-form [hidden]{display:none!important}
.business-dialog-form .business-recipient-wrap>p{margin:8px 0 0;font-size:12px;color:var(--muted);line-height:1.7}
.business-dialog-form .business-table{border:1px solid var(--line);border-radius:8px;max-height:42vh}
.business-dialog-form .business-table table{width:100%;min-width:700px;table-layout:fixed}
.business-dialog-form th,.business-dialog-form td{padding:12px;vertical-align:middle;line-height:1.6}
.business-dialog-form th{font-size:12px}
.business-dialog-form td:first-child{overflow-wrap:anywhere}
.business-dialog-form td button{white-space:nowrap}
.business-dialog-form .business-table td:last-child,.business-dialog-form .business-table th:last-child{text-align:center}
.business-dialog-form>.error:empty,.business-dialog-form>.modalerror:empty{display:none}
.business-dialog-form>.error,.business-dialog-form>.modalerror{margin:0}
.business-dialog-form>button[type=submit]{align-self:flex-end;white-space:nowrap}
.business-dialog-form>.modalfoot,.business-dialog-form .business-footer{display:flex;align-items:center;justify-content:flex-end;gap:16px;padding:16px 0 0;border-top:1px solid var(--line);margin:0;background:transparent}
.business-dialog-form .business-footer{justify-content:space-between}
.business-dialog-form .business-footer>span{color:var(--muted);font-size:13px}
.business-dialog-form .business-footer>button{white-space:nowrap}
@media(max-width:760px){#modal:has(.business-dialog-form){width:calc(100vw - 24px)}.business-dialog-form .fields,.business-dialog-form .business-details{grid-template-columns:minmax(0,1fr)}.business-dialog-form .business-picker,.business-dialog-form .toolbar:has(input[type=search]):has(select){grid-template-columns:minmax(0,1fr) auto}.business-dialog-form .business-picker>label:first-child,.business-dialog-form .toolbar:has(input[type=search]):has(select)>label:first-child{grid-column:1/-1}.business-dialog-form .toolbar:has(input[type=search]):has(select)>select{grid-column:1;grid-row:2}.business-dialog-form .toolbar:has(input[type=search]):has(select)>button{grid-column:2;grid-row:2}.business-dialog-form .business-footer{align-items:stretch;flex-direction:column}}
.trade-documents-card>.body{padding:20px 24px}.trade-documents-card>.body>p{font-size:12px;line-height:1.8;color:var(--muted);margin:0 0 16px}.trade-doc-filters{display:grid;grid-template-columns:minmax(240px,2fr) repeat(4,minmax(130px,1fr)) auto;gap:14px;align-items:end}.trade-doc-filters label{display:flex;flex-direction:column;gap:7px;min-width:0;margin:0;font-size:12px;color:var(--muted)}.trade-doc-filters input,.trade-doc-filters select{margin:0;width:100%;min-width:0;max-width:none;height:40px}.trade-doc-filters button{height:40px;white-space:nowrap}.trade-documents-table{table-layout:fixed;min-width:1280px}.trade-documents-table th,.trade-documents-table td{padding:16px;vertical-align:top;line-height:1.65;overflow-wrap:anywhere}.trade-documents-table th:nth-child(1){width:14%}.trade-documents-table th:nth-child(2){width:8%}.trade-documents-table th:nth-child(3){width:17%}.trade-documents-table th:nth-child(4){width:26%}.trade-documents-table th:nth-child(5){width:11%;text-align:right}.trade-documents-table th:nth-child(6){width:24%}.trade-doc-date{font-weight:600;font-variant-numeric:tabular-nums}.trade-doc-kind{white-space:nowrap;font-size:12px}.trade-doc-count{font-size:12px;color:var(--muted);margin-bottom:4px}.trade-doc-products{font-size:12px}.trade-doc-products span{white-space:nowrap;font-weight:600}.trade-doc-products small{color:var(--muted)}.trade-doc-money{text-align:right;font-weight:600;white-space:nowrap;font-variant-numeric:tabular-nums}.trade-doc-money small{display:block;white-space:normal;font-weight:400}.trade-doc-actions{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:12px}.trade-doc-actions>div{display:flex;flex:0 0 auto;gap:8px;flex-wrap:nowrap}.trade-doc-actions button{padding:7px 10px;font-size:12px;white-space:nowrap}.trade-doc-status{flex:0 0 auto;font-size:12px;color:var(--green);white-space:nowrap}#modal:has(#trade-order-print-frame){width:min(1120px,calc(100vw - 40px));max-width:none}.trade-print-options p{font-size:12px;color:var(--muted);line-height:1.7;margin:0 0 12px}.trade-print-options>div{display:flex;gap:20px;margin-bottom:12px}.trade-print-options label{display:flex;align-items:center;gap:10px;font-size:13px}.trade-print-options input{width:110px;margin:0}#trade-order-print-frame{width:100%;height:62vh;border:1px solid var(--line);background:#f5f5f5}@media(max-width:1200px){.trade-doc-filters{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:760px){.trade-doc-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.trade-doc-filters .trade-doc-search{grid-column:1/-1}.trade-print-options>div{flex-wrap:wrap;gap:12px}}
#modal:has(#trade-order-print-frame) .modalbody{max-height:calc(90vh - 150px);overflow:auto}#trade-order-print-frame{height:50vh;min-height:300px}
.trade-print-options .trade-print-heading{display:flex;flex-wrap:wrap;margin:0 0 14px}.trade-print-options #trade-paper-heading{flex:1 1 260px;width:auto;min-width:0;max-width:100%}
.purchase-order-card>.cardhead{flex-direction:row;align-items:center;flex-wrap:wrap;padding:20px 24px}
.purchase-order-card>.cardhead h2{margin-right:auto}
.purchase-header-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:10px}
.purchase-header-actions button{margin:0;white-space:nowrap;min-height:42px}
.purchase-order-list .purchase-list-controls{padding:20px 24px}
.purchase-list-filters{display:grid;grid-template-columns:minmax(180px,240px) minmax(260px,1fr) minmax(180px,240px);gap:20px;align-items:end}
.purchase-list-filters:not(:has(#po-business)){grid-template-columns:minmax(0,1fr);max-width:680px}
.purchase-list-filters label{display:flex;flex-direction:column;gap:7px;margin:0;min-width:0;font-size:12px;color:var(--muted)}
.purchase-list-filters :is(input,select){width:100%;max-width:none;min-width:0;height:42px;margin:0;font-size:14px}
.purchase-order-list .purchase-list-help{margin:16px 0 0;padding:11px 14px;border-radius:7px;background:var(--soft);color:var(--muted);font-size:12px;line-height:1.8}
.purchase-order-list table{min-width:980px}
.purchase-order-list :is(th,td){vertical-align:top;line-height:1.75;padding:13px 20px}
.purchase-order-list td:first-child{white-space:nowrap;font-variant-numeric:tabular-nums}
.purchase-order-list td:nth-child(4){font-variant-numeric:tabular-nums;white-space:nowrap}
.purchase-order-list td:last-child{white-space:nowrap}
.purchase-order-list td button+button{margin-left:8px}
.purchase-order-list .savebar{flex-wrap:wrap;padding:15px 24px}
.purchase-order-list #po-page-info{flex:1;min-width:220px;line-height:1.8}
.purchase-order-list .savebar .toolbar{margin-left:auto;gap:10px}
.purchase-order-list .savebar label{display:inline-flex;align-items:center;gap:8px}
.purchase-order-list .savebar select{height:38px;padding-top:6px;padding-bottom:6px}
.purchase-order-list .savebar button{min-height:38px}
.purchase-arrival-list table{table-layout:fixed;min-width:960px}
.purchase-arrival-list th:nth-child(1){width:16%}.purchase-arrival-list th:nth-child(2){width:14%}.purchase-arrival-list th:nth-child(3){width:25%}.purchase-arrival-list th:nth-child(4){width:19%}.purchase-arrival-list th:nth-child(5){width:9%}.purchase-arrival-list th:nth-child(6){width:17%}
.purchase-arrival-list .po-arrival-product{min-height:3.7em;padding:0 0 10px;overflow-wrap:anywhere;white-space:normal}
.purchase-arrival-list .po-arrival-product small{display:block;color:var(--muted);font-size:12px}
.purchase-arrival-list tr.po-arrival-warning-red > td{background:#fff0ee}
.purchase-arrival-list tr.po-arrival-warning-yellow > td{background:#fff8e3}
.purchase-arrival-list .po-arrival-warning-badge{display:table;margin-top:5px;padding:2px 6px;border-radius:4px;font-size:12px;font-weight:700;white-space:nowrap}
.purchase-arrival-list .po-arrival-warning-red .po-arrival-warning-badge{background:#fddbd7;color:#9d2721}
.purchase-arrival-list .po-arrival-warning-yellow .po-arrival-warning-badge{background:#ffedb7;color:#754308}
.purchase-arrival-list .po-arrival-actions{display:flex;flex-wrap:wrap;gap:8px;white-space:normal}
.purchase-arrival-list .po-arrival-actions button{margin:0;padding:8px 10px;white-space:nowrap;font-size:12px}
#modal:has(.po-batch-arrival){width:min(1080px,calc(100vw - 32px))}
#modal:has(.po-batch-arrival) .modalbody{max-height:calc(92vh - 90px);overflow:auto}
.po-batch-arrival .po-arrival-cards{display:flex;flex-direction:column;gap:16px}
.po-receipt-batch{border:1px solid var(--line);border-radius:8px;background:white;padding:14px;margin:12px 0}.po-receipt-batchhead,.po-receipt-batchfooter{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.po-receipt-batchhead{margin-bottom:12px}.po-receipt-batchhead button{font-size:12px;padding:6px 10px}.po-receipt-batchfooter span{font-size:12px;color:var(--muted)}
.po-batch-arrival .po-arrival-card{padding:16px;border:1px solid var(--line);border-radius:9px;background:var(--soft)}
.po-batch-arrival .po-arrival-cardhead{display:flex;flex-wrap:wrap;align-items:center;gap:10px 18px;margin-bottom:14px}
.po-batch-arrival .po-arrival-cardhead label{display:flex;flex-direction:row;align-items:center;gap:8px;margin:0;white-space:nowrap;font-size:13px}
.po-batch-arrival .po-arrival-cardhead input[type=checkbox]{width:16px;height:16px;margin:0}
.po-batch-arrival .po-arrival-cardhead strong{font-size:15px;min-width:0;overflow-wrap:anywhere}
.po-batch-arrival .po-arrival-cardhead small{color:var(--muted);font-size:12px}
.po-batch-arrival .po-arrival-card .fields{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 16px}
.po-batch-arrival .po-shelf-life{display:flex;gap:8px;min-width:0}
.po-batch-arrival .po-shelf-life input{flex:1;min-width:0}.business-dialog-form.po-batch-arrival .po-shelf-life select{width:76px;max-width:76px;flex:0 0 76px}
.po-batch-arrival input:disabled,.po-batch-arrival select:disabled{opacity:.55}
@media(max-width:760px){#modal:has(.po-batch-arrival){width:calc(100vw - 20px)}.po-batch-arrival .po-arrival-card .fields{grid-template-columns:minmax(0,1fr)}.po-batch-arrival .po-arrival-card{padding:12px}.po-batch-arrival .po-arrival-cardhead small{flex-basis:100%}.po-batch-arrival .business-footer{flex-direction:column;align-items:stretch}}
@media(max-width:1050px){.purchase-list-filters:has(#po-business){grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.purchase-list-filters:has(#po-business) .purchase-filter-search{grid-column:1/-1;grid-row:2}}
@media(max-width:760px){.purchase-order-card>.cardhead{padding:18px}.purchase-order-card>.cardhead h2{flex-basis:100%}.purchase-header-actions{width:100%}.purchase-header-actions button{flex:1}.purchase-order-list .purchase-list-controls{padding:18px}.purchase-order-list .savebar{padding:14px 18px}.purchase-order-list #po-page-info{flex-basis:100%}.purchase-order-list .savebar .toolbar{margin:0;justify-content:space-between;width:100%;gap:6px}}
@media(max-width:480px){.purchase-list-filters:has(#po-business){grid-template-columns:minmax(0,1fr)}.purchase-list-filters:has(#po-business) .purchase-filter-search{grid-column:auto;grid-row:auto}.purchase-header-actions{flex-direction:column;align-items:stretch}.purchase-header-actions button{width:100%}}
/* Self-operated store fields remain compact and aligned with existing forms. */
.own-store-settings-entry{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 0;border-top:1px solid #e1e7e2}
.own-history-box{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:16px 0;padding:16px;background:#f3f6f2;border-radius:8px}
.own-history-box h3,.own-history-box p{grid-column:1/-1;margin:0}
.own-history-box label{display:flex;flex-direction:column;gap:6px}
.own-fee-allocation input[type=number]{width:140px;max-width:100%;text-align:right}
/* The full dated turnover ledger is edited together; one atomic month save. */
#modal:has(#own-month-turnover){width:min(1540px,calc(100vw - 32px));max-height:94vh}
#modal:has(#own-month-turnover) .modalbody{max-height:calc(94vh - 90px);overflow:auto;padding:20px 24px}
#own-month-turnover .own-month-controls{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap}
#own-month-turnover .own-month-controls label{display:flex;flex-direction:column;gap:6px;min-width:180px}
#own-month-turnover .own-month-controls input,#own-month-turnover .own-month-controls select{width:100%}
#own-month-turnover .own-month-guide{font-size:13px;line-height:1.7;margin:14px 0}
#own-month-turnover .own-month-scroll{overflow:auto;max-height:min(42vh,520px);border:1px solid var(--line);border-radius:8px}
#own-month-turnover .own-month-grid{width:max-content;min-width:100%;border-collapse:separate;border-spacing:0}
#own-month-turnover .own-month-grid :is(th,td){padding:10px 12px;vertical-align:top;white-space:nowrap}
#own-month-turnover .own-month-grid thead th{position:sticky;top:0;z-index:2;background:#f0f4ed}
#own-month-turnover .own-month-grid :is(th,td):first-child{position:sticky;left:0;z-index:1;background:#f8faf6;min-width:110px}
#own-month-turnover .own-month-grid thead th:first-child{z-index:3;background:#f0f4ed}
#own-month-turnover small{display:block;font-size:12px;color:var(--muted);font-weight:400;line-height:1.6}
#own-month-turnover .own-month-pair{display:flex;gap:6px}
#own-month-turnover .own-month-pair input{width:88px;min-width:88px;box-sizing:border-box;padding:7px 8px;font-size:13px}
#own-month-turnover .own-month-refund-date{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--muted);margin-top:6px}
#own-month-turnover .own-month-refund-date input{width:182px;padding:5px 8px;font-size:12px}
#own-month-turnover [data-month-note]{width:190px;padding:7px 8px;font-size:13px}
#own-month-turnover .own-month-unavailable{color:#9ba69e;text-align:center}
#own-month-turnover .own-month-target>td{background:#eef5eb}
#own-month-turnover .own-month-footer{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding-top:14px}
#own-month-turnover .own-month-footer>div{flex-basis:100%;font-weight:600}
#own-month-turnover .own-month-footer>label{display:flex;gap:7px;align-items:center;font-size:13px}
#own-month-turnover .own-month-footer input{width:auto}
#own-month-turnover .own-error{color:#b43c32}
@media(max-width:650px){#modal:has(#own-month-turnover){width:calc(100vw - 16px)}#modal:has(#own-month-turnover) .modalbody{padding:16px}#own-month-turnover .own-month-controls{gap:10px}#own-month-turnover .own-month-controls label{min-width:130px;flex:1}#own-month-turnover .own-month-footer button{width:100%}}
/* Receipt channel settings use an explicit custom-name field and safe layout. */
#modal:has(#own-settings){width:min(1080px,calc(100vw - 40px))}
#own-settings .own-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px}
#own-settings .own-form-grid>label{display:flex;flex-direction:column;gap:6px;min-width:0}
#own-settings .own-wide{grid-column:1/-1}
#own-settings :is(select,input:not([type=checkbox])){width:100%;min-width:0;box-sizing:border-box}
#own-settings .own-checks{display:flex;gap:10px 20px;flex-wrap:wrap;padding:4px 0}
#own-settings .own-checks label{display:flex;align-items:center;gap:6px}
#own-settings .own-checks input{width:auto;min-width:0}
#own-settings .own-custom-channels{padding:14px 16px;margin-top:12px;border:1px solid var(--line);border-radius:8px;background:#f5f8f3}
#own-settings .own-custom-channels>label{display:block;margin-bottom:8px}
#own-settings .own-custom-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center}
#own-settings .own-custom-row button{white-space:nowrap}
#own-settings .own-custom-channels p{margin:8px 0 0;line-height:1.6}
#own-settings #own-channel-feedback:empty{display:none}
#own-settings .own-footer{display:flex;gap:10px;align-items:center;justify-content:flex-end;flex-wrap:wrap;margin-top:18px}
#own-settings .own-summary{padding:12px;background:#eef4f0;border-radius:8px;line-height:1.65}
#own-settings .own-error{color:#b43c32}
@media(max-width:700px){#own-settings .own-form-grid{grid-template-columns:1fr}#own-settings .own-custom-row{grid-template-columns:1fr}#own-settings .own-custom-row button{justify-self:start}}
/* Management is organized by company, group and store; no inline styles. */
#own-hierarchy .own-h-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:16px 0}
#own-hierarchy .own-h-kpi{background:#f1f5ef;border:1px solid var(--line);border-radius:10px;padding:16px}
#own-hierarchy .own-h-kpi strong{display:block;font-size:23px;margin:8px 0}
#own-hierarchy small{display:block;font-size:12px;line-height:1.65;color:var(--muted,#708078);margin-top:4px}
#own-hierarchy .own-h-result{font-weight:700;white-space:nowrap}
#own-hierarchy .gain{color:#236b54}#own-hierarchy .loss{color:#b34336}
#own-hierarchy .own-h-group-title{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
#own-hierarchy .own-h-group-title span{font-size:14px;font-weight:400;color:var(--muted,#708078)}
#own-hierarchy th,#own-hierarchy td{vertical-align:top}
#own-hierarchy .own-h-summary td{vertical-align:middle}
#own-hierarchy>.card>.body>.scroll{max-height:none;overflow-x:auto}
#own-hierarchy a{color:#215b4d;text-decoration:underline;text-underline-offset:3px}
#own-hierarchy .own-h-actions{display:flex;gap:8px;flex-wrap:wrap}
#own-hierarchy .own-h-actions button{white-space:nowrap}
#own-hierarchy .own-h-note{padding:12px 16px;background:#f1f5ef;border-radius:8px;line-height:1.7}
#own-hierarchy .own-h-details{border-top:1px solid var(--line);padding-top:14px;margin-top:16px}
#own-hierarchy summary{cursor:pointer;font-weight:600;padding:4px 0}
#own-hierarchy .own-h-group-total{font-weight:700;background:#f1f5ef}
#own-hierarchy .own-h-subrow td{font-size:13px}
#own-hierarchy .cardhead h2{margin:0}
#own-hierarchy .own-h-guide{font-size:13px;margin:0;color:var(--muted,#708078)}
#own-hierarchy .own-h-gap-link{display:block;font-size:12px;margin-top:5px}
#own-hierarchy .own-h-cost-gaps{scroll-margin-top:20px}
#own-hierarchy .own-h-gap-product{margin:10px 0;padding:10px 14px;background:#fafbf8;border:1px solid var(--line);border-radius:8px}
#own-hierarchy .own-h-gap-product .scroll{max-height:320px;margin-top:10px}
#own-hierarchy .own-h-gap-product table{min-width:720px;table-layout:fixed}
#own-hierarchy .own-h-gap-product :is(th,td){padding:10px;min-width:0;white-space:normal;overflow-wrap:anywhere}
#own-hierarchy .own-h-gap-product th:first-child{width:13%}
#own-hierarchy .own-h-gap-product th:nth-child(2){width:17%}
#own-hierarchy .own-h-gap-product th:nth-child(3){width:10%}
#own-hierarchy .own-h-gap-product th:nth-child(4){width:32%}
#own-hierarchy .own-h-gap-product th:nth-child(5){width:28%}
#own-hierarchy .own-h-supply-table{table-layout:fixed;min-width:850px;font-variant-numeric:tabular-nums}
#own-hierarchy .own-h-supply-table :is(th,td){padding:12px 10px;min-width:0;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
#own-hierarchy .own-h-supply-table th:first-child{width:13%}
#own-hierarchy .own-h-supply-table th:nth-child(2){width:11%}
#own-hierarchy .own-h-supply-table th:nth-child(3){width:11%}
#own-hierarchy .own-h-supply-table th:nth-child(4){width:15%}
#own-hierarchy .own-h-supply-table th:nth-child(5){width:12%}
#own-hierarchy .own-h-supply-table th:nth-child(6){width:15%}
#own-hierarchy .own-h-supply-table th:nth-child(7){width:10%}
#own-hierarchy .own-h-supply-table th:nth-child(8){width:13%}
#own-hierarchy .own-h-supply-table .own-h-cost-issues{max-height:180px;overflow:auto;overflow-wrap:anywhere}
@media(max-width:900px){#own-hierarchy .own-h-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}#own-hierarchy .own-h-kpi strong{font-size:20px}}
@media(max-width:520px){#own-hierarchy .own-h-kpis{grid-template-columns:1fr}}
@media(max-width:650px){.own-history-box{grid-template-columns:1fr}.own-store-settings-entry{align-items:stretch;flex-direction:column}}
#modal:has(#trade-document-detail){width:min(1320px,calc(100vw - 32px));overflow:hidden}
#modal:has(#trade-document-detail) .modalhead{gap:16px}
#modal:has(#trade-document-detail) .modalhead h2{min-width:0;overflow-wrap:anywhere}
#modal:has(#trade-document-detail) .modalhead button{flex:none;white-space:nowrap}
#modal:has(#trade-document-detail) .modalbody{max-height:calc(90vh - 90px);overflow:auto;padding:24px}
#trade-document-detail .trade-detail-summary{display:flex;align-items:center;flex-wrap:wrap;gap:8px 20px;margin-bottom:20px}
#trade-document-detail .trade-detail-summary>strong{font-size:16px;overflow-wrap:anywhere}
#trade-document-detail .trade-detail-summary>span{color:var(--muted);font-size:13px}
#trade-document-detail .trade-detail-summary>p{flex-basis:100%;margin:0;color:var(--muted);overflow-wrap:anywhere}
#trade-document-detail .scroll{max-height:none;overflow:visible}
#trade-document-detail table{table-layout:fixed;width:100%}
#trade-document-detail .detail-product{width:23%}
#trade-document-detail .detail-kind{width:9%}
#trade-document-detail .detail-quantity{width:9%}
#trade-document-detail .detail-base{width:10%}
#trade-document-detail .detail-source{width:29%}
#trade-document-detail .detail-actions{width:20%}
#trade-document-detail :is(th,td){padding:14px 12px;vertical-align:top;line-height:1.7;overflow-wrap:anywhere}
#trade-document-detail th{position:static}
#trade-document-detail td>strong{display:block;font-weight:600}
#trade-document-detail .trade-stocktake-gain{color:#187047}
#trade-document-detail .trade-stocktake-loss{color:#b42318}
#trade-document-detail td>small{display:block;color:var(--muted);margin-top:6px}
#trade-document-detail .trade-detail-info{display:grid;grid-template-columns:64px minmax(0,1fr);gap:6px;margin-top:6px;font-size:13px}
#trade-document-detail .trade-detail-info>span:first-child{color:var(--muted)}
#trade-document-detail .trade-detail-actions{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px}
#trade-document-detail button{white-space:nowrap;padding:8px 12px;font-size:13px}
#trade-detail-footer:not(:empty){display:flex;justify-content:flex-end;margin-top:20px;padding-top:16px;border-top:1px solid var(--line)}
@media(max-width:800px){#modal:has(#trade-document-detail){width:calc(100vw - 24px)}#modal:has(#trade-document-detail) .modalbody{padding:16px}#trade-document-detail table,#trade-document-detail tbody,#trade-document-detail tr,#trade-document-detail td{display:block;width:100%}#trade-document-detail thead,#trade-document-detail colgroup{display:none}#trade-document-detail tr{padding:8px 0;border-bottom:1px solid var(--line)}#trade-document-detail td{padding:8px 0;border:0}#trade-document-detail td::before{content:attr(data-label);display:block;color:var(--muted);font-size:12px;margin-bottom:4px}#trade-document-detail td>small{margin:0}#trade-document-detail .trade-detail-summary{margin-bottom:12px}}
/* Production is a cost center; its metrics are not another profit total. */
#own-hierarchy .own-h-kpis.own-production-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
.own-production-kpis .own-h-kpi strong{font-size:1.25rem}
@media(max-width:900px){#own-hierarchy .own-h-kpis.own-production-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){#own-hierarchy .own-h-kpis.own-production-kpis{grid-template-columns:minmax(0,1fr)}}
.payroll-table.payroll-compact{min-width:820px;width:100%;table-layout:auto}
.payroll-compact td,.payroll-compact th{padding:14px 12px;white-space:normal;vertical-align:top}
.payroll-compact small,#overtime-settlement small,#overtime-monthly small{display:block;color:var(--muted);font-size:12px;line-height:1.6;margin-top:4px}
.payroll-compact .payroll-action{min-width:100px}
#overtime-settlement{margin-bottom:20px}
/* Account visibility and actual-payment registration; no new accounting rules. */
.purchase-account-table{min-width:920px;table-layout:fixed;width:100%}
.purchase-account-table th:nth-child(1){width:14%}.purchase-account-table th:nth-child(2){width:18%}.purchase-account-table th:nth-child(3){width:12%}.purchase-account-table th:nth-child(4){width:9%}.purchase-account-table th:nth-child(5){width:9%}.purchase-account-table th:nth-child(6){width:13%}.purchase-account-table th:nth-child(7){width:7%}.purchase-account-table th:nth-child(8){width:18%}
.purchase-account-table th,.purchase-account-table td{padding:14px 12px;vertical-align:top;overflow-wrap:anywhere;line-height:1.7;white-space:normal}
.purchase-account-table small,.purchase-payment-actions small{display:block;color:var(--muted);font-size:12px;line-height:1.6;margin-top:5px}
.purchase-payment-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start}
.purchase-payment-actions button{margin:0;padding:8px 10px;font-size:12px;white-space:normal;line-height:1.5}
.purchase-payment-actions small{flex-basis:100%}
.business-dialog-form .purchase-payment-ack{flex-direction:row;align-items:flex-start;gap:10px;line-height:1.8}
.business-dialog-form .purchase-payment-ack input[type=checkbox]{flex:none;width:16px;height:16px;margin-top:4px}
#management-accounts .cardhead>div{min-width:0}#management-accounts .cardhead p{margin:5px 0 0}
#management-accounts .body>p{font-size:13px;line-height:1.8}
.management-account-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:18px 0}
.management-account-kpis>div{padding:18px;border:1px solid var(--line);border-radius:9px;background:var(--soft);min-width:0}
.management-account-kpis span,.management-account-kpis small{display:block;font-size:12px;line-height:1.7;color:var(--muted)}
.management-account-kpis strong{display:block;font-size:24px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;margin:8px 0}
#management-account-details{border-top:1px solid var(--line);padding-top:16px}
#management-account-details>summary{cursor:pointer;font-weight:600;line-height:1.8}
.management-account-filters{display:grid;grid-template-columns:minmax(180px,2fr) repeat(3,minmax(130px,1fr));gap:14px;margin:18px 0}
.management-account-filters label{display:flex;flex-direction:column;gap:7px;font-size:12px;color:var(--muted);min-width:0;margin:0}
.management-account-filters input,.management-account-filters select{margin:0;width:100%;min-width:0;max-width:none;height:40px}
.management-accounts-table{min-width:900px;width:100%;table-layout:fixed}
.management-accounts-table th,.management-accounts-table td{padding:13px 12px;vertical-align:top;line-height:1.65;overflow-wrap:anywhere}
.management-accounts-table th:nth-child(1){width:14%}.management-accounts-table th:nth-child(2){width:15%}.management-accounts-table th:nth-child(3){width:23%}.management-accounts-table th:nth-child(4){width:14%}.management-accounts-table th:nth-child(5){width:10%}.management-accounts-table th:nth-child(6){width:12%}.management-accounts-table th:nth-child(7){width:12%}
.management-accounts-table small{display:block;font-size:12px;color:var(--muted);line-height:1.65;margin-top:4px}
#management-accounts .management-accounts-table td:nth-child(3) small{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;max-height:4.95em;overflow:hidden}
.purchase-bulk-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:14px 16px;border:1px solid var(--line);border-radius:8px;background:var(--soft)}
.purchase-bulk-toolbar>span{flex:1;min-width:220px;font-size:12px;line-height:1.8}
.purchase-bulk-toolbar button{font-size:12px;white-space:nowrap}
.purchase-account-table .purchase-bulk-choice{display:flex;flex-direction:row;align-items:center;gap:8px;margin:0 0 8px;font-size:12px}
.purchase-bulk-choice input[type=checkbox]{width:16px;height:16px;margin:0}
.purchase-bulk-paid-form .purchase-bulk-card{padding:16px;border:1px solid var(--line);border-radius:8px;background:var(--soft)}
.purchase-bulk-card h3{margin:0 0 12px;font-size:14px;line-height:1.7;overflow-wrap:anywhere}
.purchase-advance-summary{padding:12px 14px;background:var(--soft);border-radius:8px;line-height:1.9;margin:14px 0 20px;font-weight:600}
.purchase-advance-records>p{font-size:13px;line-height:1.9;margin:0}
.purchase-advance-records table{width:100%;min-width:780px;table-layout:fixed}
.purchase-advance-records td,.purchase-advance-records th{vertical-align:top;padding:12px;line-height:1.7;overflow-wrap:anywhere}
.purchase-advance-records small{display:block;color:var(--muted);font-size:12px;margin-top:5px}
.purchase-advance-records td button{font-size:12px;padding:7px 9px;margin:6px 4px 0 0;white-space:normal}
#modal:has(.purchase-advance-records){width:min(1080px,calc(100vw - 32px))}
#modal:has(.purchase-advance-records) .modalbody{max-height:calc(92vh - 90px);overflow:auto}
.purchase-order-list td:last-child{white-space:normal}
.management-advance-summary{margin:18px 0;padding:14px 16px;border:1px solid var(--line);border-radius:8px;background:var(--soft)}
.management-advance-summary>summary{cursor:pointer;font-weight:600;line-height:1.8}
.management-advance-summary .hint{font-size:12px;line-height:1.8}
.management-advance-table{min-width:860px;width:100%;table-layout:fixed}
.management-advance-table th,.management-advance-table td{padding:12px;vertical-align:top;line-height:1.7;overflow-wrap:anywhere}
.management-advance-table small{display:block;color:var(--muted);font-size:12px}
.management-advance-table button{font-size:12px;white-space:nowrap}
@media(max-width:760px){.purchase-bulk-toolbar>span{flex-basis:100%}.purchase-bulk-toolbar button{flex:1}.purchase-bulk-card{padding:12px}.management-advance-summary{padding:12px}}
.management-accounts-table button{font-size:12px;margin-top:8px;white-space:nowrap}
.account-unknown{color:#916318;font-size:13px}
.management-account-pager{display:flex;justify-content:flex-end;align-items:center;gap:14px;padding-top:14px}
.management-account-detail dl{display:grid;grid-template-columns:180px minmax(0,1fr);gap:12px;margin:0}
.management-account-detail dt{color:var(--muted)}.management-account-detail dd{margin:0;overflow-wrap:anywhere}
.management-account-detail p{font-size:13px;line-height:1.8;margin:18px 0}
.management-account-detail small{display:block;color:var(--muted)}
@media(max-width:1000px){.management-account-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.management-account-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.management-account-kpis{grid-template-columns:minmax(0,1fr)}.management-account-filters{grid-template-columns:minmax(0,1fr)}.management-account-detail dl{grid-template-columns:minmax(0,1fr);gap:6px}.management-account-detail dd{margin-bottom:10px}}
/* Reconciliation fields remain intact after regrouping the old toolbar. */
.settlement-layout-page>.reconciliation-layout{overflow:visible}
.reconciliation-layout>.recon-nav-row,.reconciliation-layout>.recon-filter-row,.reconciliation-layout>.recon-action-row{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:16px 20px;min-width:0;max-width:100%}
.reconciliation-layout>.recon-nav-row{border-bottom:1px solid var(--line)}
.reconciliation-layout>.recon-nav-row button,.reconciliation-layout>.recon-action-row button{white-space:nowrap;max-width:100%}
.reconciliation-layout>.recon-filter-row{align-items:end;gap:14px}
.recon-filter-row>label{display:flex;flex-direction:column;gap:7px;min-width:0;max-width:100%;margin:0;flex:1 1 170px;font-size:12px;color:var(--muted)}
.recon-filter-row :is(input,select){width:100%;min-width:0;max-width:100%;height:42px;margin:0}
.recon-filter-row .shop-search-control{width:100%;min-width:0;max-width:none;margin:0}
.recon-filter-row .shop-search-results{position:absolute;left:0;top:calc(100% + 6px);z-index:20}
.recon-filter-row .trade-account-filters{width:100%;min-width:0}
.reconciliation-layout>.recon-action-row{border-top:1px solid var(--line);background:#fafbf8;border-radius:0 0 12px 12px}
.reconciliation-layout>[hidden]{display:none}
.reconciliation-layout>.recon-filter-row:has(#purchase-supplier){display:grid;grid-template-columns:minmax(280px,2fr) repeat(2,minmax(130px,.8fr)) minmax(120px,.8fr) minmax(170px,1fr) minmax(180px,1.4fr);align-items:end}
.recon-filter-row>label:has(#purchase-supplier){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 10px}
.recon-filter-row>label:has(#purchase-supplier)>.shop-search-control{grid-column:1;grid-row:2}
.recon-filter-row #purchase-supplier{grid-column:2;grid-row:2}
@media(max-width:1439px){.reconciliation-layout>.recon-filter-row:has(#purchase-supplier){grid-template-columns:repeat(4,minmax(0,1fr))}.recon-filter-row>label:has(#purchase-supplier){grid-column:1/3}.recon-filter-row>label:has(#purchase-search){grid-column:3/5;grid-row:1}}
@media(max-width:1100px){.reconciliation-layout>.recon-filter-row:has(#purchase-supplier){grid-template-columns:repeat(2,minmax(0,1fr))}.recon-filter-row>label:has(#purchase-supplier){grid-column:1/-1}.recon-filter-row>label:has(#purchase-search){grid-column:1/-1;grid-row:auto}}
@media(max-width:600px){.reconciliation-layout>.recon-nav-row,.reconciliation-layout>.recon-filter-row,.reconciliation-layout>.recon-action-row{padding:14px;gap:12px}.reconciliation-layout>.recon-filter-row:has(#purchase-supplier){grid-template-columns:minmax(0,1fr)}.recon-filter-row>label{flex-basis:100%}.recon-filter-row>label:has(#purchase-supplier),.recon-filter-row>label:has(#purchase-search){grid-column:auto}.recon-filter-row>label:has(#purchase-supplier){grid-template-columns:minmax(0,1fr)}.recon-filter-row #purchase-supplier{grid-column:1;grid-row:3}.recon-nav-row button,.recon-action-row button{flex:1 1 130px}}
/* Cross-month purchase credits; isolated from existing receipt/payment layouts. */
.purchase-credit-filters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;width:100%;min-width:0;align-items:end}
.purchase-credit-filters>label{display:flex;flex-direction:column;gap:7px;min-width:0;font-size:12px;color:var(--muted)}
.purchase-credit-filters .credit-query-field{grid-column:span 2}
.purchase-credit-filters :is(input,select){width:100%;min-width:0;max-width:100%;height:42px}
.purchase-credit-filters>button{height:42px;justify-self:start;white-space:nowrap}
.purchase-credit-card #purchase-credit-summary{margin:0;line-height:1.8}
.purchase-credit-bulk{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;padding:14px 22px;background:var(--soft);border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.purchase-credit-bulk>div,.purchase-credit-row-actions,.purchase-credit-form .business-footer>div{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.purchase-credit-table{min-width:1080px;font-variant-numeric:tabular-nums}
.purchase-credit-table :is(th,td){padding:14px 16px;vertical-align:top}
.purchase-credit-table small{display:block;color:var(--muted);margin-top:5px;max-width:340px;overflow-wrap:anywhere}
.purchase-credit-table small.error{color:var(--danger)}
.purchase-credit-table .credit-choice{display:flex;gap:8px;align-items:flex-start;min-width:170px;font-weight:600}
.purchase-credit-table .credit-choice input{margin-top:6px;flex:none}
.purchase-credit-row-actions{margin-top:10px;min-width:140px}
.purchase-credit-row-actions button{font-size:12px;padding:7px 10px}
.purchase-credit-balance{padding:12px 16px;background:var(--soft);border-radius:8px;line-height:1.8}
.purchase-credit-transfer-table{width:100%;font-variant-numeric:tabular-nums}
.purchase-credit-transfer-table :is(th,td){padding:12px 14px;vertical-align:middle}
.purchase-credit-transfer-table small{display:block;color:var(--muted);margin-top:4px}
.purchase-credit-transfer-table input{width:150px;max-width:100%;text-align:right}
.purchase-credit-form #purchase-credit-transfer-total{font-weight:600;line-height:1.8;margin:12px 0}
@media(max-width:1100px){.purchase-credit-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.purchase-credit-filters{grid-template-columns:minmax(0,1fr)}.purchase-credit-filters .credit-query-field{grid-column:auto}.purchase-credit-bulk{padding:14px}.purchase-credit-bulk>div{width:100%}.purchase-credit-bulk button{flex:1 1 150px}}
#modal:has(#shortage-form){width:min(1200px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}
#modal:has(#shortage-form) #modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 34px);min-width:0}
#modal:has(#shortage-form) .modalhead{flex-shrink:0}
#modal:has(#shortage-form) .modalbody{overflow:auto;min-width:0;min-height:0}
#shortage-form>label{display:flex;flex-direction:column;gap:6px;margin:14px 0}
#shortage-form input,#shortage-form select{max-width:100%;min-width:0;width:100%;box-sizing:border-box}
#shortage-loss-date{max-width:240px}
#shortage-sources{overflow:auto;margin:12px 0}
#shortage-lines>section.card{padding:16px;margin:14px 0}
#shortage-lines>section.card>div:first-child{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#shortage-lines>section.card>div:nth-child(2){display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin-top:14px}
#shortage-lines label{display:flex;flex-direction:column;gap:6px;margin:0;align-items:stretch}
#shortage-form>.toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:end}
#shortage-form>.toolbar>input{flex:1 1 200px}
#shortage-form>.toolbar>select{flex:2 1 260px}
#shortage-form>.toolbar>button{flex:0 0 auto}
@media(max-width:600px){#shortage-lines>section.card>div:nth-child(2){grid-template-columns:1fr}#modal:has(#shortage-form){width:calc(100vw - 20px);max-width:calc(100vw - 20px)}}
/* Direct procurement fulfillment never belongs to warehouse stock or expiry. */
.po-direct-badge{display:block;width:fit-content;margin-top:6px;padding:3px 7px;border-radius:5px;background:#e8f2ed;color:#285849;font-size:12px;line-height:1.6}
.po-direct-history{margin-top:22px;padding-top:12px;border-top:1px solid var(--line)}
.po-direct-history table{width:100%;min-width:640px}.po-direct-history th,.po-direct-history td{vertical-align:top;line-height:1.7}
.po-direct-note{padding:12px 16px;background:#edf3ef;border-radius:8px;line-height:1.8}
#modal:has(.trade-direct-sale){width:min(1320px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:92vh}
#modal:has(.trade-direct-sale) #modal-content{display:flex;flex-direction:column;max-height:calc(92vh - 2px)}
#modal:has(.trade-direct-sale) .modalhead{flex:0 0 auto}
#modal:has(.trade-direct-sale) .modalbody{flex:1 1 auto;overflow:auto;max-height:none;min-width:0;min-height:0}
#modal:has(.trade-direct-sale) .trade-direct-table{max-height:none;overflow-x:auto}
.trade-direct-sale,.trade-direct-sale>*{min-width:0;max-width:100%;box-sizing:border-box}
.trade-direct-fields{display:grid;grid-template-columns:180px minmax(200px,1fr) minmax(240px,1.3fr);gap:16px;margin:16px 0}
.trade-direct-fields label{display:flex;flex-direction:column;gap:7px;margin:0}
.trade-direct-fields input,.trade-direct-fields select{width:100%;min-width:0;box-sizing:border-box}
.trade-direct-table{overflow:auto;margin:16px 0}.trade-direct-table table{min-width:1120px;width:100%;table-layout:fixed}
.trade-direct-table th:first-child{width:28%}.trade-direct-table th:nth-child(2){width:10%}.trade-direct-table th:nth-child(3){width:8%}.trade-direct-table th:nth-child(4){width:12%}.trade-direct-table th:nth-child(5){width:12%}.trade-direct-table th:nth-child(6){width:18%}.trade-direct-table th:last-child{width:12%}
.trade-direct-table th,.trade-direct-table td{padding:12px 10px;vertical-align:top;overflow-wrap:anywhere;line-height:1.7}
.trade-direct-table td small{display:block;color:var(--muted);margin-top:5px}.trade-direct-table input,.trade-direct-table select{width:100%;min-width:0;box-sizing:border-box}.trade-direct-table button{white-space:nowrap;padding:9px}
.trade-direct-table .direct-customer-label{display:flex;flex-direction:column;gap:5px;margin:10px 0 0;font-size:13px}.trade-direct-table .direct-row-actions{display:flex;flex-direction:column;align-items:stretch;gap:10px}.trade-direct-table small.error{color:var(--danger,#b73535)}
.po-batch-arrival [data-po-expiry][hidden]{display:none!important}
@media(max-width:700px){.trade-direct-fields{grid-template-columns:1fr}.trade-direct-sale .business-footer{display:flex;flex-direction:column;align-items:stretch;gap:12px}#modal:has(.trade-direct-sale){width:calc(100vw - 16px);max-width:calc(100vw - 16px)}#modal:has(.trade-direct-sale) .modalbody{padding:16px}}
/* The ordinary shipment-exception editor only; returns and shortage workflows are unchanged. */
#modal:has(.wf-ticket-form){width:min(1040px,calc(100vw - 40px));max-width:calc(100vw - 40px);max-height:calc(100dvh - 32px);overflow:hidden}
#modal:has(.wf-ticket-form) #modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 34px);min-width:0}
#modal:has(.wf-ticket-form) .modalhead{flex:none;gap:16px}
#modal:has(.wf-ticket-form) .modalhead h2{min-width:0;overflow-wrap:anywhere}
#modal:has(.wf-ticket-form) .modalhead button{flex:none;white-space:nowrap}
#modal:has(.wf-ticket-form) .modalbody{flex:1 1 auto;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;padding:20px 24px}
.wf-ticket-form{display:flex;flex-direction:column;gap:16px;min-width:0}
.wf-ticket-form>p{margin:0;line-height:1.7}
.wf-ticket-number{color:var(--muted);font-size:12px;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.wf-ticket-form label{display:flex;flex-direction:column;align-items:stretch;gap:7px;margin:0;min-width:0;color:var(--muted);font-size:12px}
.wf-ticket-form :is(input,select){min-width:0;max-width:none;width:100%;height:42px;margin:0}
.wf-ticket-form .wf-ticket-details{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:14px 24px;align-items:start}
.wf-ticket-shop{grid-column:1;grid-row:1/3}
.wf-ticket-date{grid-column:2;grid-row:1}
.wf-ticket-source{grid-column:2;grid-row:2}
.wf-ticket-form .shop-search-control{width:100%;max-width:none;margin:0;min-width:0}
.wf-ticket-help{grid-column:1/-1;margin:0;padding:12px 14px;border-radius:8px;background:var(--soft);font-size:12px;line-height:1.8;color:var(--ink)}
.wf-ticket-form .wf-ticket-picker{display:grid;grid-template-columns:minmax(180px,1fr) minmax(0,1.7fr) auto;align-items:end;gap:12px;padding:16px;border:1px solid var(--line);border-radius:8px;background:#f8faf7}
.wf-ticket-picker button{height:42px;white-space:nowrap}
.wf-ticket-line-head,.wf-ticket-form .wf-ticket-lines>.toolbar{display:grid;grid-template-columns:minmax(0,1fr) 150px 72px;gap:16px;align-items:center}
.wf-ticket-line-head{padding:10px 14px;background:var(--soft);border:1px solid var(--line);border-radius:8px 8px 0 0;font-size:12px;color:var(--muted);margin-bottom:-16px}
.wf-ticket-lines{border:1px solid var(--line);border-top:0;border-radius:0 0 8px 8px;min-width:0}
.wf-ticket-lines:empty::before{content:'尚未添加商品，请从上方选择后添加。';display:block;padding:18px 14px;color:var(--muted);font-size:13px}
.wf-ticket-form .wf-ticket-lines>.toolbar{padding:12px 14px;margin:0;border-bottom:1px solid var(--line)}
.wf-ticket-form .wf-ticket-lines>.toolbar:last-child{border-bottom:0}
.wf-ticket-lines>.toolbar>span{overflow-wrap:anywhere;min-width:0}
.wf-ticket-lines button{white-space:nowrap;padding:8px 12px}
.wf-ticket-form :is(#wf-duplicate,#wf-preview,#wf-error):empty{display:none}
.wf-ticket-form #wf-preview:not(:empty){padding:12px 14px;background:var(--soft);border-radius:8px;line-height:1.8}
.wf-ticket-form .wf-ticket-confirm-note{font-size:12px;line-height:1.8;color:var(--muted)}
.wf-ticket-form .wf-ticket-actions{position:sticky;bottom:-20px;z-index:3;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:10px;margin:0;padding:16px 0 20px;border-top:1px solid var(--line);background:white;box-shadow:0 -8px 12px white}
.wf-ticket-actions button{white-space:nowrap;min-height:42px}
@media(max-width:700px){#modal:has(.wf-ticket-form){width:calc(100vw - 20px);max-width:calc(100vw - 20px);max-height:calc(100dvh - 20px)}#modal:has(.wf-ticket-form) #modal-content{max-height:calc(100dvh - 22px)}#modal:has(.wf-ticket-form) .modalbody{padding:16px}.wf-ticket-form .wf-ticket-details{grid-template-columns:minmax(0,1fr);gap:14px}.wf-ticket-form .wf-ticket-details>label{grid-column:1;grid-row:auto}.wf-ticket-form .wf-ticket-picker{grid-template-columns:minmax(0,1fr) auto;padding:12px}.wf-ticket-picker>label:first-child{grid-column:1/-1}.wf-ticket-line-head,.wf-ticket-form .wf-ticket-lines>.toolbar{grid-template-columns:minmax(0,1fr) 100px 64px;gap:10px}.wf-ticket-form .wf-ticket-actions{bottom:-16px;padding-bottom:16px}.wf-ticket-actions button{flex:1 1 140px}}
@media(max-width:430px){.wf-ticket-line-head{display:none}.wf-ticket-lines{border-top:1px solid var(--line);border-radius:8px}.wf-ticket-form .wf-ticket-lines>.toolbar{grid-template-columns:minmax(0,1fr) 72px}.wf-ticket-lines>.toolbar>span{grid-column:1/-1}.wf-ticket-form .wf-ticket-lines input{max-width:180px}}

/* Return registration shares the ticket grid, without changing other workflows. */
.wf-return-form .wf-return-handling{grid-column:2;grid-row:2}
.wf-return-form .wf-ticket-actions>button:first-child{margin-right:auto}
@media(max-width:700px){.wf-return-form .wf-return-handling{grid-column:1;grid-row:auto}.wf-return-form .wf-ticket-actions>button:first-child{margin-right:0}}

/* Planning header: keep the print action to the right of the collapsed title. */
#preorder-planning-summary{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:16px;padding:20px 24px}
#preorder-planning-summary>.body{min-width:0;padding:0}
#preorder-planning-summary .preorder-planning-details>summary{padding:8px 0}
#preorder-planning-summary>#preorder-planning-print{justify-self:end;align-self:start;white-space:nowrap;margin:0}
@media(max-width:700px){#preorder-planning-summary{grid-template-columns:minmax(0,1fr);padding:18px;gap:12px}#preorder-planning-summary>#preorder-planning-print{justify-self:end}}

/* Invoice review: own layout, no changes to other reconciliation forms. */
.invoice-page .cardhead{gap:16px;flex-wrap:wrap}
.invoice-filters{display:grid;grid-template-columns:minmax(230px,2fr) repeat(3,minmax(140px,1fr));gap:16px;align-items:end;margin:18px 0}
.invoice-filters label,.invoice-form label{display:flex;flex-direction:column;align-items:stretch;gap:8px;min-width:0;font-size:13px;color:var(--muted)}
.invoice-filters :is(input,select),.invoice-form :is(input,select){width:100%;min-width:0;max-width:100%;margin:0}
.invoice-actions,.invoice-row-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.invoice-row-actions button{white-space:nowrap}
.invoice-note{background:var(--soft);padding:14px 16px;border-radius:8px;line-height:1.8}
.invoice-table{min-width:900px;width:100%;table-layout:fixed}
.invoice-table th:nth-child(1){width:17%}.invoice-table th:nth-child(2){width:14%}.invoice-table th:nth-child(3){width:29%}.invoice-table th:nth-child(4){width:14%}.invoice-table th:nth-child(5){width:15%}.invoice-table th:nth-child(6){width:11%}
.invoice-table td{vertical-align:top;overflow-wrap:anywhere;line-height:1.7}
.invoice-table small,.invoice-edit-table small{display:block;color:var(--muted);font-size:12px;line-height:1.7}
.invoice-table td>div+div{margin-top:8px}
.invoice-line-preview>.invoice-line-item+.invoice-line-item,.invoice-lines-rest>.invoice-line-item+.invoice-line-item{margin-top:8px}
.invoice-lines-more{margin-top:10px}
.invoice-lines-more>summary{cursor:pointer;color:var(--green);font-size:13px;padding:4px 0}
.invoice-lines-rest{margin-top:8px}
.invoice-lines-more:not([open]) .invoice-lines-collapse,.invoice-lines-more[open] .invoice-lines-expand{display:none}
.invoice-summary{margin-top:24px;border-top:1px solid var(--line);padding-top:18px}
.invoice-summary h3{margin-top:0}
.invoice-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px}
.invoice-kpis>div{background:var(--soft);border:1px solid var(--line);border-radius:8px;padding:16px}
.invoice-kpis span{display:block;color:var(--muted);font-size:13px;margin-bottom:12px}
.invoice-kpis strong{display:block;font-size:22px;overflow-wrap:anywhere}
#modal:has(.invoice-form){width:min(1060px,calc(100vw - 40px));max-width:calc(100vw - 40px);max-height:calc(100dvh - 32px);overflow:hidden}
#modal:has(.invoice-form) #modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 34px);min-width:0}
#modal:has(.invoice-form) .modalhead{flex:none;gap:16px}
#modal:has(.invoice-form) .modalhead h2{min-width:0;overflow-wrap:anywhere}
#modal:has(.invoice-form) .modalbody{flex:1 1 auto;overflow:auto;min-width:0;min-height:0;padding:22px 24px}
.invoice-form{display:flex;flex-direction:column;gap:18px;min-width:0}
.invoice-form p{margin:0;line-height:1.8}
.invoice-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.invoice-edit-table{min-width:580px;table-layout:fixed;width:100%}
.invoice-edit-table th:first-child{width:40%}
.invoice-edit-table th:nth-child(2){width:24%}
.invoice-edit-table th:nth-child(3){width:16%}
.invoice-form .business-footer{position:sticky;bottom:-22px;padding:18px 0 22px;background:white;border-top:1px solid var(--line);display:flex;gap:14px;flex-wrap:wrap;justify-content:space-between;align-items:center}
.invoice-form [readonly]{background:var(--soft)}
.production-stats .production-quantity-breakdown{font-size:15px;line-height:1.65;font-weight:500}
.production-stats .production-quantity-breakdown>span{display:block;white-space:nowrap}
.production-stats .production-quantity-breakdown b{font-size:22px;font-weight:600;font-variant-numeric:tabular-nums}
@media(max-width:950px){.invoice-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.invoice-filters,.invoice-fields{grid-template-columns:minmax(0,1fr)}#modal:has(.invoice-form){width:calc(100vw - 20px);max-width:calc(100vw - 20px)}#modal:has(.invoice-form) .modalbody{padding:16px}.invoice-form .business-footer{bottom:-16px;padding-bottom:16px}.invoice-actions button{flex:1 1 150px}}
/* Raw direct deliveries: one body scroll, with the title/close always visible. */
#modal:has(#raw-direct-form){width:min(1080px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:hidden}
#modal:has(#raw-direct-form) #modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 34px);min-width:0}
#modal:has(#raw-direct-form) .modalhead{flex:none}
#modal:has(#raw-direct-form) .modalbody{flex:1 1 auto;overflow:auto;min-width:0;min-height:0}
#raw-direct-form .po-arrival-card{padding:16px;margin:16px 0;border:1px solid var(--line);border-radius:12px}
#raw-direct-form .fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
#raw-direct-form .fields input,#raw-direct-form .fields select{min-width:0;width:100%;box-sizing:border-box}
#raw-direct-form>label:has(input[type=checkbox]){display:flex;flex-direction:row;align-items:flex-start;gap:10px}
#raw-direct-form>label input[type=checkbox]{width:16px;flex:none;margin-top:4px}
@media(max-width:600px){#raw-direct-form .fields{grid-template-columns:minmax(0,1fr)}}

/* Finished goods: separate selection and review; keep confirmation in view. */
#modal:has(#finished-sales-out){width:min(940px,calc(100vw - 28px));max-width:calc(100vw - 28px);max-height:calc(100dvh - 28px);overflow:hidden}
#modal:has(#finished-sales-out) #modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 30px);min-width:0}
#modal:has(#finished-sales-out) :is(.modalhead,.modalfoot){flex:none;position:static}
#modal:has(#finished-sales-out) .modalbody{min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain}
#modal:has(#finished-sales-out) .modalfoot{padding:12px 22px;border-top:1px solid var(--line);background:var(--bg)}
#finished-sales-out{display:grid;gap:16px}
#finished-sales-out section{min-width:0;padding:16px;border:1px solid var(--line);border-radius:10px}
#finished-sales-out :is(h3,p){margin:0}
#finished-sales-out h3{font-size:15px;margin-bottom:10px}
#finished-sales-out .fo-fields{display:grid;grid-template-columns:minmax(0,2fr) repeat(2,minmax(0,1fr));align-items:start;gap:12px}
#finished-sales-out :is(.fo-fields>label,.fo-shop-field,#fo-reason-field:not([hidden])){display:grid;gap:5px;min-width:0}
#finished-sales-out :is(input,select,.shop-search-control){min-width:0;width:100%;max-width:none;margin:0}
#finished-sales-out .shop-search-results{position:absolute;top:calc(100% + 4px);left:0;z-index:2}
#finished-sales-out .fo-load-row,.fo-footer-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px}
#finished-sales-out .fo-load-row{margin-top:12px}
#finished-sales-out .fo-lines{margin-top:10px}
#finished-sales-out .fo-empty{padding:16px;border:1px dashed #cad7cf;border-radius:8px;background:var(--bg);color:var(--muted);text-align:center}
#finished-sales-out .fo-lines:not(.fo-empty){border:1px solid var(--line);border-radius:8px;overflow:hidden}
#finished-sales-out table{width:100%;table-layout:fixed}
#finished-sales-out :is(th,td){padding:8px 10px;position:static;white-space:normal;overflow-wrap:anywhere;vertical-align:middle}
#finished-sales-out :is(th,td):first-child{width:43%}
#finished-sales-out :is(th,td):not(:first-child){text-align:right}
#finished-sales-out [data-fo-quantity]{max-width:112px;text-align:right}
#finished-sales-out small{display:block;color:var(--muted)}
#finished-sales-out .fo-short{background:#fff2ef}
#finished-sales-out .fo-short-note:not([hidden]){color:var(--danger);font-weight:600}
#finished-sales-out [hidden]{display:none}
#finished-sales-out #fo-reason-field{margin-top:12px}
#finished-sales-out #fo-reason-field label small{display:inline;margin-left:5px}
#finished-sales-out .fo-rules{color:var(--muted);font-size:13px}
#finished-sales-out .fo-rules p{margin-top:6px}
.fo-footer{width:100%;min-width:0}
.fo-footer p{margin:0}
#fo-error:not(:empty){margin:0 0 8px;color:var(--danger);overflow-wrap:anywhere;max-height:24dvh;overflow:auto}
#fo-summary{font-size:13px;color:var(--muted)}
@media(max-width:600px){
 #modal:has(#finished-sales-out) :is(.modalhead,.modalbody,.modalfoot){padding:12px}
 #finished-sales-out{gap:12px}
 #finished-sales-out section{padding:12px}
 #finished-sales-out .fo-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
 #finished-sales-out .fo-shop-field{grid-column:1/-1}
 #finished-sales-out :is(table,tbody){display:block}
 #finished-sales-out thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 #finished-sales-out tbody tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:8px;border-bottom:1px solid var(--line)}
 #finished-sales-out tbody tr:last-child{border-bottom:0}
 #finished-sales-out td,#finished-sales-out td:first-child{display:block;width:auto;padding:2px;border:0;text-align:left}
 #finished-sales-out td:not(:first-child){text-align:left}
 #finished-sales-out td:first-child{grid-column:1/-1}
 #finished-sales-out td[data-label]::before{content:attr(data-label);display:block;color:var(--muted);font-size:12px}
 #finished-sales-out td [data-fo-quantity]{padding:6px}
 .fo-footer-row>button{flex:1 1 auto}
}

/* Coffee single-batch issue/waste dialog: scoped layout only. */
#modal:has(#cf-single-out){width:min(760px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:hidden}
#modal:has(#cf-single-out) #modal-content{display:flex;flex-direction:column;max-height:calc(100dvh - 34px);min-width:0}
#modal:has(#cf-single-out) .modalhead{flex:none;gap:16px}
#modal:has(#cf-single-out) .modalbody{flex:1 1 auto;min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;padding:22px 24px}
#cf-single-out{display:flex;flex-direction:column;gap:18px;min-width:0;margin:0}
#cf-single-out .cf-out-stock{border:1px solid var(--line);border-radius:10px;padding:16px;background:var(--soft)}
#cf-single-out .cf-out-stock-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:18px}
#cf-single-out .cf-out-stock-heading>div{min-width:0}
#cf-single-out .cf-out-eyebrow,#cf-single-out .cf-out-available>span{display:block;color:var(--muted);font-size:12px;line-height:1.5}
#cf-single-out .cf-out-stock h3{font-size:17px;line-height:1.5;margin:6px 0 0;overflow-wrap:anywhere}
#cf-single-out .cf-out-available{text-align:right;flex-shrink:0}
#cf-single-out .cf-out-available strong{display:block;color:var(--green);font-size:23px;line-height:1.4;margin-top:5px}
#cf-single-out .cf-out-available small{font-size:13px;font-weight:normal}
#cf-single-out .cf-out-batch{margin-top:12px;font-size:12px;color:var(--muted)}
#cf-single-out .cf-out-batch summary{cursor:pointer;width:fit-content}
#cf-single-out .cf-out-batch p{margin:8px 0 0;overflow-wrap:anywhere;line-height:1.6}
#cf-single-out .cf-out-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
#cf-single-out .cf-out-fields[hidden]{display:none}
#cf-single-out label{display:flex;flex-direction:column;gap:8px;min-width:0;font-size:13px;font-weight:600;line-height:1.5}
#cf-single-out :is(input,select,textarea){width:100%;min-width:0;max-width:100%;box-sizing:border-box;margin:0;font-weight:normal}
#cf-single-out textarea{resize:vertical;min-height:76px}
#cf-single-out .cf-out-note{margin:0;color:var(--muted);font-size:12px;line-height:1.8}
#cf-single-out #coffee-error{margin:0}
#cf-single-out #coffee-error:empty{display:none}
#cf-single-out .cost-effects{margin:0!important}
#cf-single-out .cost-effects p{font-size:13px;line-height:1.7;overflow-wrap:anywhere}
#cf-single-out .cost-effects table{min-width:0!important;width:100%;table-layout:fixed}
#cf-single-out .cost-effects :is(th,td){padding:10px 8px;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
#cf-single-out .cost-effects th:first-child{width:45%}
#cf-single-out .cost-effects th:nth-child(2){width:25%}
#cf-single-out .cost-effects th:last-child{width:30%}
#cf-single-out .cf-out-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;position:sticky;bottom:-22px;z-index:2;margin:0 -24px -22px;padding:16px 24px;border-top:1px solid var(--line);background:var(--paper)}
#cf-single-out .cf-out-footer>span{font-size:12px;color:var(--muted);line-height:1.6}
#cf-single-out .cf-out-footer button{white-space:nowrap;margin:0;min-width:112px}
@media(max-width:600px){
 #modal:has(#cf-single-out){width:calc(100vw - 20px);max-width:calc(100vw - 20px);max-height:calc(100dvh - 20px)}
 #modal:has(#cf-single-out) #modal-content{max-height:calc(100dvh - 22px)}
 #modal:has(#cf-single-out) .modalbody{padding:16px}
 #cf-single-out{gap:16px}
 #cf-single-out .cf-out-fields{grid-template-columns:minmax(0,1fr);gap:16px}
 #cf-single-out .cf-out-stock{padding:14px}
 #cf-single-out .cf-out-stock-heading{gap:12px;flex-wrap:wrap}
 #cf-single-out .cf-out-available{margin-left:auto}
 #cf-single-out .cf-out-available strong{font-size:21px}
 #cf-single-out .cf-out-footer{bottom:-16px;margin:0 -16px -16px;padding:14px 16px}
 #cf-single-out .cf-out-footer>span{flex:1 1 130px}
 #cf-single-out .cf-out-footer button{flex:0 1 auto}
 #cf-single-out .cost-effects>button{width:100%}
}

/* Current-archive product margin estimates: keep the primary results visible. */
#product-profit .product-profit-table{width:100%;table-layout:fixed;min-width:660px;font-size:12px}
#product-profit .product-profit-table :is(th,td){padding:10px 8px;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
#profit-sales .scroll:nth-of-type(2) .product-profit-table{min-width:1100px}
#profit-sales .scroll:nth-of-type(2) .product-profit-table :is(th,td):first-child{width:160px}
#product-profit .product-profit-table details summary{cursor:pointer;color:var(--green)}

/* The four production cards keep finished pieces and semi-finished slices apart. */
.production-four-cards .production-card-secondary{display:block;margin-top:8px;font-size:15px;font-weight:600;overflow-wrap:anywhere}
.production-four-cards strong{font-size:27px;font-variant-numeric:tabular-nums;line-height:1.6;overflow-wrap:anywhere}
.production-four-cards strong small{font-size:12px;font-weight:400;margin-left:4px}
.production-four-cards .hint{display:block;margin-top:8px;white-space:normal}
@media(max-width:600px){.stats.production-four-cards{grid-template-columns:1fr}.production-four-cards strong{font-size:25px}}

/* Coffee ledger filtering is separate from the operation date used by plans. */
.coffee-ledger-filters{display:grid;grid-template-columns:minmax(220px,2fr) repeat(4,minmax(130px,1fr)) auto;gap:12px;align-items:end}
.coffee-ledger-filters label{display:flex;flex-direction:column;gap:8px;min-width:0;margin:0;font-size:13px;color:var(--muted)}
.coffee-ledger-filters :is(input,select){width:100%;min-width:0;max-width:100%;margin:0}
.coffee-ledger-filters button{min-height:42px;white-space:nowrap}
@media(max-width:1350px){.coffee-ledger-filters{grid-template-columns:repeat(3,minmax(0,1fr))}.coffee-ledger-query{grid-column:span 2}}
@media(max-width:800px){.coffee-ledger-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.coffee-ledger-filters{grid-template-columns:minmax(0,1fr)}.coffee-ledger-query{grid-column:auto}}

/* Rest controls replace editable notes; old notes remain readable. */
#own-month-turnover .own-month-rest{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}
#own-month-turnover [data-month-rest]{width:18px;height:18px;margin:0}
#own-month-turnover #own-month-analysis{margin:16px 0}
#own-month-turnover #own-month-analysis-body{white-space:normal;line-height:1.7}

/* Keep trade warehouse auxiliary actions together without spreading buttons. */
.cardhead.trade-warehouse-cardhead{flex-wrap:wrap}
.trade-warehouse-secondary-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;min-width:0;max-width:100%;margin-left:auto}
.trade-warehouse-secondary-actions[hidden]{display:none}
.trade-warehouse-secondary-actions>button{margin:0;white-space:nowrap}
@media(max-width:900px){.trade-warehouse-secondary-actions{flex-basis:100%;margin-left:0;justify-content:flex-start}}

/* Completed roast corrections keep green inputs beside roasted output. */
#cf-roast-correction fieldset{min-width:0;margin:14px 0;padding:14px;border:1px solid var(--line);border-radius:8px}
#cf-roast-correction legend{max-width:100%;overflow-wrap:anywhere}
.coffee-roast-correction-weights{display:grid;grid-template-columns:minmax(0,2fr) minmax(200px,1fr);gap:18px;align-items:start}
#cf-roast-correction .coffee-roast-batch-row{display:grid;grid-template-columns:minmax(0,2fr) minmax(110px,1fr) auto;gap:10px;align-items:end;margin:8px 0}
#cf-roast-correction :is(.field,select,input){min-width:0;max-width:100%}
#cf-roast-correction .coffee-roast-batch-row>button{min-height:42px;white-space:nowrap}
#cf-roast-impact small{display:block;overflow-wrap:anywhere;color:var(--muted);font-size:11px}
#modal:has(#cf-roast-correction) .modalhead button{white-space:nowrap;flex-shrink:0}
@media(max-width:800px){.coffee-roast-correction-weights{grid-template-columns:minmax(0,1fr)}}
@media(max-width:520px){#cf-roast-correction .coffee-roast-batch-row{grid-template-columns:minmax(0,1fr) auto}#cf-roast-correction .coffee-roast-batch-row>.field:first-child{grid-column:1/-1}}

/* Multi-store calendar: select dates, then matching stores. */
#modal:has(#own-calendar){width:min(1150px,calc(100vw - 32px))}
#own-calendar h3{font-size:15px;margin:18px 0 8px}
#own-calendar fieldset{min-width:0;margin:16px 0;padding:12px;border:1px solid var(--line);border-radius:8px}
#own-calendar legend{font-weight:600}
#own-calendar .own-calendar-month label,#own-calendar-action .toolbar>label{display:flex;flex-direction:column;gap:6px}
#own-calendar .own-calendar-sites{display:flex;gap:12px 24px;flex-wrap:wrap}
#own-calendar .own-calendar-sites label,#own-calendar .own-calendar-matrix label{display:inline-flex;align-items:center;gap:8px}
#own-calendar input[type=checkbox]{width:18px;height:18px;margin:0;flex-shrink:0}
#own-calendar .own-calendar-matrix{max-height:36vh;border:1px solid var(--line);border-radius:8px}
#own-calendar .own-calendar-matrix table{min-width:650px}
#own-calendar .own-calendar-matrix :is(th,td):first-child{position:sticky;left:0;background:#f8faf6;white-space:nowrap;z-index:1}
#own-calendar .own-calendar-matrix thead th:first-child{z-index:3;background:#f0f4ed}
#own-calendar small{display:block;font-size:11px;color:var(--muted);overflow-wrap:anywhere}
#own-calendar .own-calendar-note-label{flex:1;min-width:200px}
#own-calendar #own-calendar-selection{margin:12px 0}
@media(max-width:520px){#own-calendar-action .toolbar>label{width:100%}#own-calendar .own-calendar-month{align-items:end}#own-calendar .own-calendar-matrix :is(th,td){padding:10px 12px}}

/* Part-time labor records share one monthly cost source. */
#part-time-records>.cardhead{gap:16px;flex-wrap:wrap}
#part-time-records>.cardhead>div{flex:1;min-width:240px}
#part-time-records>.cardhead>button{flex-shrink:0}
#part-time-records td{vertical-align:top;overflow-wrap:anywhere}
#part-time-records td:last-child{min-width:150px}
#part-time-records td button{margin:0 6px 6px 0}
#part-time-records details{max-width:400px;min-width:170px}
#part-time-records details p{font-size:12px;margin:10px 0;line-height:1.7}
@media(max-width:760px){
 #part-time-records>.scroll{max-height:none;overflow:visible}
 #part-time-records table,#part-time-records tbody,#part-time-records tr{display:block;width:100%}
 #part-time-records thead{display:none}
 #part-time-records tbody tr{padding:12px 18px;border-top:1px solid var(--line)}
 #part-time-records td{display:grid;grid-template-columns:86px minmax(0,1fr);gap:8px;padding:8px 0;border:0;min-width:0!important}
 #part-time-records td::before{content:attr(data-label);color:var(--muted);font-size:12px}
 #part-time-records details{min-width:0;max-width:100%;grid-column:2}
 #part-time-records td:last-child{display:flex;flex-wrap:wrap;gap:8px}
 #part-time-records td:last-child::before{flex-basis:86px}
}

.purchase-payment-channels{margin:16px 0;padding:14px;border:1px solid var(--line);border-radius:8px;min-width:0}
.purchase-payment-channels legend{font-weight:600;padding:0 6px}
.purchase-channel-rows{display:grid;gap:12px}
.purchase-channel-row{display:grid;grid-template-columns:minmax(180px,1.4fr) minmax(130px,1fr) auto;gap:12px;align-items:end}
.purchase-channel-row label{display:flex;flex-direction:column;gap:6px;min-width:0}
.purchase-channel-row select,.purchase-channel-row input{width:100%;max-width:100%}
.purchase-channel-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:14px}
@media(max-width:650px){.purchase-channel-row{grid-template-columns:minmax(0,1fr) auto}.purchase-channel-row label:first-child{grid-column:1/-1}.purchase-payment-channels{padding:12px}}

.warehouse-movement-detail{margin-top:.25rem;font-size:.82rem;font-weight:400;white-space:normal;color:var(--ink)}
.warehouse-movement-detail>summary{cursor:pointer;color:var(--green,#255a49);width:fit-content}
.warehouse-movement-detail>.warehouse-movement-rows{max-height:22rem;overflow:auto;width:min(18rem,66vw);min-width:0;max-width:100%;box-sizing:border-box;padding:.5rem .6rem;margin-top:.3rem;border:1px solid var(--line,#dbe4df);border-radius:.4rem;background:#fbfcfa;text-align:left}
.warehouse-movement-rows p{margin:.15rem 0 .45rem}
.warehouse-movement-rows .movement-period,.warehouse-movement-rows small,.warehouse-movement-rows time{font-size:.76rem;color:var(--muted)}
.warehouse-movement-rows ol{list-style:none;padding:0;margin:0}
.warehouse-movement-rows li{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;gap:.12rem .4rem;padding:.4rem 0;border-top:1px solid var(--line,#dbe4df)}
.warehouse-movement-rows li time,.warehouse-movement-rows li small{grid-column:1/-1;overflow-wrap:anywhere;white-space:normal}
.warehouse-movement-rows li strong{white-space:nowrap;font-variant-numeric:tabular-nums}
.warehouse-movement-rows .movement-in{color:#285746}.warehouse-movement-rows .movement-out{color:#944332}
@media print{.warehouse-movement-detail{display:none!important}}

#content table:has(.warehouse-movement-detail[open]){table-layout:auto}
#content td:has(> .warehouse-movement-detail[open]){min-width:min(19.5rem,74vw);white-space:normal}
.warehouse-movement-rows li .movement-source{grid-column:1/-1;min-width:0;line-height:1.35}
.movement-source>summary{cursor:pointer;font-size:.73rem;color:var(--muted)}
.warehouse-movement-rows li .movement-source small{display:block;white-space:normal;overflow-wrap:anywhere}
