:root{font-family:Inter,"Microsoft YaHei",system-ui,sans-serif;color:#203b3c;background:#f4f6f3;font-size:14px;line-height:1.55}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button{cursor:pointer;border:1px solid #ccd8d2;border-radius:8px;padding:9px 15px;background:white;color:#23484a;white-space:nowrap}button:hover{background:#edf3ee;border-color:#7fa396}button:disabled{opacity:.45;cursor:not-allowed}.primary{background:#176250;color:white;border-color:#176250}.primary:hover{background:#104f40}.danger{color:#ad4337}.quiet{background:transparent;border-color:transparent;padding:5px 9px}input,select,textarea{width:100%;border:1px solid #cbd6d0;border-radius:7px;background:white;padding:9px 11px;color:#1e3c3c}input:focus,select:focus,textarea:focus,button:focus-visible{outline:3px solid #a5cdbd;outline-offset:1px}input[type=checkbox]{width:auto;accent-color:#176250}textarea{min-height:78px;resize:vertical}label{display:flex;flex-direction:column;gap:5px;font-weight:500}label.check{flex-direction:row;align-items:center;font-weight:400}small,.muted{color:#6c807a;font-size:12px}h1,h2,h3,p{margin-top:0}h1{font-size:26px;letter-spacing:.02em;margin-bottom:6px}h2{font-size:21px}h3{font-size:16px;margin-bottom:10px}.layout{display:grid;grid-template-columns:220px 1fr;min-height:100vh}.sidebar{background:#143f3c;color:#e8f1e8;padding:30px 20px;display:flex;flex-direction:column;position:sticky;top:0;height:100vh}.brand{font-size:22px;font-weight:700;letter-spacing:3px;margin-bottom:3px}.brand-note{font-size:11px;letter-spacing:2px;color:#9dc0b4;margin-bottom:32px}.nav{display:grid;gap:6px}.nav button{text-align:left;color:#bfd7cf;border:0;background:transparent;padding:11px 14px}.nav button.active{background:#285751;color:white}.nav button:hover{background:#204d47}.sidebar .foot{margin-top:auto;font-size:12px;color:#9dc0b4;padding:22px 12px 0}.main{min-width:0}.topbar{display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid #dce4dd;padding:18px 36px;background:#ffffffb8}.topbar select{max-width:400px}.topbar .identity{display:flex;align-items:center;gap:10px;white-space:nowrap}.content{padding:30px 36px;max-width:1800px;margin:auto}.heading{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:24px}.eyebrow{font-size:11px;letter-spacing:2px;color:#73948b;font-weight:700;margin-bottom:7px}.card{background:white;border:1px solid #dce5dc;border-radius:12px;padding:22px;margin-bottom:20px}.toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:end;margin-bottom:18px}.toolbar label{min-width:130px;flex:1;font-size:12px}.toolbar .search{flex:2;min-width:200px}.tablewrap{overflow:auto;background:white;border:1px solid #dce5dc;border-radius:10px}table{width:100%;border-collapse:collapse;text-align:left;font-size:13px}th{color:#71877e;background:#f8faf6;font-size:12px;font-weight:500;white-space:nowrap}th,td{padding:13px 14px;border-bottom:1px solid #e8eee6;vertical-align:middle}td{max-width:360px}tbody tr:hover{background:#fafcf9}tr:last-child td{border-bottom:0}.money{font-variant-numeric:tabular-nums;white-space:nowrap}.badge{display:inline-block;padding:3px 8px;border-radius:5px;font-size:11px;background:#edf4ee;color:#357259;white-space:nowrap}.badge.warn{background:#fff0d9;color:#9d692b}.badge.red{background:#fbe6e1;color:#a74d43}.badge.gray{background:#eef0ef;color:#6d7a76}.empty{text-align:center;padding:65px 15px;color:#71877e}.pager{display:flex;align-items:center;justify-content:space-between;margin-top:16px}.actions{display:flex;flex-wrap:wrap;gap:8px}.notice{background:#f4f7ef;border-left:3px solid #8daf86;padding:13px 16px;margin:12px 0 20px;font-size:13px;color:#4f6b55}.notice.warn{background:#fff6e9;border-color:#d6a55a;color:#896638}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.full{grid-column:1/-1}.login{max-width:440px;margin:10vh auto;padding:38px;background:white;border:1px solid #dce5dc;border-radius:16px;box-shadow:0 20px 60px #234b3610}.login .brand{color:#174e44;margin-bottom:22px}.login form{display:grid;gap:18px}.login p{color:#7b8c82}dialog{width:min(1040px,95vw);max-height:90vh;border:1px solid #d9e4dc;border-radius:14px;padding:26px;color:inherit;box-shadow:0 20px 90px #002d2d40}dialog::backdrop{background:#0e2c2b77}.modalhead{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.modalhead h2{margin:0}.modalfoot{display:flex;justify-content:flex-end;gap:10px;border-top:1px solid #e4ebe1;padding-top:18px;margin-top:22px}.line{border:1px solid #dce5dc;border-radius:9px;padding:14px;margin-top:10px}.linehead{display:flex;justify-content:space-between;align-items:start;margin-bottom:10px}.results{max-height:190px;overflow:auto;border:1px solid #dbe4de;border-radius:8px;margin:8px 0}.results button{display:block;text-align:left;width:100%;white-space:normal;border-radius:0;border:0;border-bottom:1px solid #edf0e9}.results button span{display:block;font-size:12px;color:#7e9288}.details{white-space:pre-wrap;word-break:break-word;font-size:12px;max-height:280px;overflow:auto;background:#f4f7f3;padding:12px;border-radius:8px}#toast{position:fixed;z-index:100;bottom:24px;left:50%;transform:translateX(-50%);background:#193f37;color:white;padding:12px 20px;border-radius:9px;max-width:90vw;display:none;box-shadow:0 6px 25px #16352a25}.loading{padding:100px;text-align:center;color:#71877e}.statrow{display:flex;gap:14px;margin-bottom:20px}.statrow .card{flex:1;margin:0}.statrow strong{display:block;font-size:25px;margin-top:4px}.danger-text{color:#ac5143}.inline{display:flex;gap:10px;align-items:center}.divider{height:1px;background:#e6ece3;margin:20px 0}@media(max-width:850px){.layout{grid-template-columns:1fr}.sidebar{position:static;height:auto;padding:16px 18px}.brand-note,.sidebar .foot{display:none}.brand{font-size:19px;margin-bottom:12px}.nav{display:flex;overflow:auto}.nav button{white-space:nowrap}.topbar{padding:14px 18px}.content{padding:20px 18px}.topbar .identity>span{display:none}.grid.three{grid-template-columns:repeat(2,minmax(0,1fr))}.heading{gap:10px}h1{font-size:23px}.login{margin:6vh 18px}.statrow{flex-wrap:wrap}}@media(max-width:520px){.grid,.grid.three{grid-template-columns:1fr}.heading{display:block}.heading .actions{margin-top:15px}.topbar select{max-width:65%}dialog{padding:18px}.statrow .card{min-width:120px}}

/* Let narrow layouts scroll tables and navigation internally. */
.sidebar{min-width:0}.topbar select{min-width:0}@media(max-width:850px){.layout{grid-template-columns:minmax(0,1fr)}}@media(max-width:520px){.topbar{gap:8px}.topbar .identity{gap:0}.topbar select{flex:1;max-width:65%}.toolbar label{min-width:125px}}

@media(max-width:680px){.heading{display:block}.heading .actions{margin-top:15px}.toolbar label{min-width:130px;flex-basis:calc(50% - 10px)}.toolbar .search{flex-basis:100%}.nav::-webkit-scrollbar{height:5px}.nav::-webkit-scrollbar-track{background:#164b43}.nav::-webkit-scrollbar-thumb{background:#507e69;border-radius:4px}}

.selection-summary{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 0 12px;color:#6c807a;font-size:12px}.delete-preview{max-height:280px;overflow:auto}.delete-preview thead{position:sticky;top:0}
.order-total{position:sticky;bottom:0;background:#f4f7f3;padding:14px;margin-top:18px;border-radius:8px;font-size:18px;font-weight:600;color:#176250}.line-amount{margin:10px 0 0;color:#176250}

.company-internal-id{margin-top:16px;color:#6c807a;font-size:12px}.company-internal-id summary{cursor:pointer}.company-internal-id p{margin-top:8px;word-break:break-all}
.company-choice-panel{min-width:0}.company-choice-panel .inline{align-items:end;flex-wrap:wrap}.company-choice-input{flex:1;min-width:180px}.company-option-list{margin-top:18px}.company-option{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-top:1px solid #e8eee6}.company-option>span{overflow-wrap:anywhere}.company-option .actions{flex-shrink:0}@media(max-width:520px){.company-option{align-items:flex-start;flex-direction:column}.company-option .actions{width:100%}}
.order-list{display:grid;gap:10px}.order-card{background:#fff;border:1px solid #dce5dc;border-radius:10px;padding:10px 14px;min-width:0}.order-card-head,.order-card-title,.order-card-meta,.order-material{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.order-card-head{justify-content:space-between;gap:6px 12px}.order-card-head .actions{gap:4px}.order-card-head .actions button{padding:4px 8px;font-size:13px}.order-card-title{min-width:0}.order-card-title input[type=checkbox]{flex-shrink:0}.order-number{border:0;background:transparent;padding:3px 0;color:#174e44;font-weight:700;white-space:normal;text-align:left}.order-number:hover{background:transparent;text-decoration:underline}.order-card-meta{margin:4px 0 6px;gap:4px 12px;color:#536a61;font-size:13px}.order-card-meta .quiet{white-space:normal;text-align:left;padding:2px 4px}.order-card-meta .order-material-toggle{color:#176250;white-space:nowrap;font-size:12px}.order-card-meta>strong{margin-left:auto;color:#203b3c}.order-materials{border-top:1px solid #e8eee6}.order-material{padding:6px 0;border-bottom:1px solid #e8eee6;justify-content:space-between}.order-material>div{min-width:200px;flex:2}.order-material>div small{display:block}.order-material>span{flex:1;min-width:180px}.order-material>strong{margin-left:auto;white-space:nowrap}.order-remark{margin:6px 0 0}.order-bip-fields{margin-top:8px;padding:8px 10px;border-radius:7px;background:#f6f9f5}.order-bip-title{font-size:12px;font-weight:700;margin-bottom:5px}.order-bip-title small{font-size:11px;font-weight:400;margin-left:8px}.order-bip-grid{grid-template-columns:repeat(5,minmax(130px,1fr));gap:6px 10px}.order-bip-grid label{font-size:12px;gap:2px;min-width:0}.order-bip-grid input,.order-bip-grid select{min-width:0;min-height:32px;padding:4px 8px;font-size:13px;line-height:1.4}.order-quick-edit{border-top:1px solid #e8eee6;padding-top:16px}.order-quick-lines{display:grid;gap:10px;margin-top:14px}.order-quick-lines .line{margin:0}.order-quick-lines small{display:block}.quick-line-grid{grid-template-columns:repeat(4,minmax(140px,1fr));margin-top:10px}.reexport-check{margin:0 0 14px}@media(max-width:1200px){.order-bip-grid{grid-template-columns:repeat(3,minmax(140px,1fr))}.quick-line-grid{grid-template-columns:repeat(2,minmax(140px,1fr))}}@media(max-width:680px){.order-card{padding:10px}.order-bip-fields{padding:8px}.order-bip-title small{display:block;margin-left:0}.order-card-head .actions button{min-height:36px}.order-bip-grid,.quick-line-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.order-card-meta>strong{margin-left:0}.order-material>div,.order-material>span{min-width:0;flex-basis:100%}}@media(max-width:420px){.order-bip-grid,.quick-line-grid{grid-template-columns:1fr}}

/* Shared compact editor for inline and dialog order corrections. */
.compact-order-editor{border-top:1px solid #e8eee6;padding-top:8px;min-width:0}
.compact-order-editor label{font-size:12px;gap:2px;min-width:0}
.compact-order-editor input,.compact-order-editor select{padding:4px 7px;min-height:32px;min-width:0;font-size:13px;line-height:1.4}
.compact-order-editor button{padding:4px 8px;font-size:12px;min-height:30px}
.order-editor-head{display:grid;grid-template-columns:150px minmax(250px,1.6fr) minmax(140px,1fr) minmax(150px,1fr);gap:8px}
.editor-customer{display:flex;gap:4px}.editor-customer input{width:40%}.editor-customer select{width:60%}
.editor-material-tools{display:flex;align-items:end;gap:8px;flex-wrap:wrap;margin:8px 0}
.editor-material-tools>strong{font-size:13px;padding:5px 0}.editor-material-search{flex:1;max-width:420px}
.editor-material-tools>small{font-size:11px;padding-bottom:5px}.editor-results{max-height:160px;margin:4px 0 8px}
.order-editor-table{max-height: min(54vh,480px);overflow:auto;scrollbar-gutter:stable}
.order-editor-table table{min-width:850px;table-layout:fixed}
.order-editor-table th,.order-editor-table td{padding:5px 6px}
.order-editor-table thead{position:sticky;top:0;z-index:1}
.order-editor-table th:first-child{width:30%}.order-editor-table th:last-child{width:66px}
.order-editor-table .editor-material-cell>small{display:block;font-size:11px;overflow-wrap:anywhere}
.order-editor-table .editor-material-name{display:block;width:100%;border:0;background:transparent;font-weight:600;text-align:left;padding:0;white-space:normal;line-height:1.4;overflow-wrap:anywhere}
.editor-material-name span{color:#176250;font-size:11px;font-weight:400;white-space:nowrap}
.order-editor-table td label small{font-size:11px;line-height:1.2}
.order-editor-table .money{font-size:12px;white-space:normal;overflow-wrap:anywhere}
.editor-row-actions button{display:block;min-height:25px;padding:2px 5px}.editor-line-info{display:flex;flex-wrap:wrap;align-items:center;gap:6px 16px;background:#f6f9f5;padding:5px;font-size:12px}
.order-editor-footer{position:sticky;bottom:0;z-index:2;display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:#fff;padding:8px 0;border-top:1px solid #e4ebe1;margin-top:8px}
.order-editor-footer>strong{color:#176250;font-size:14px}.order-editor-footer>label{flex:1;min-width:180px}.order-editor-footer .actions{flex-shrink:0;gap:5px}
@media(max-width:1200px){.order-editor-head{grid-template-columns:repeat(2,minmax(0,1fr))}.order-editor-table table{min-width:800px}}
@media(max-width:680px){.order-editor-head{grid-template-columns:1fr}.editor-material-search{min-width:160px}.order-editor-footer{gap:6px}.order-editor-footer>strong{flex-basis:100%}.order-editor-footer>label{min-width:130px}.order-editor-table{max-height:52vh}.compact-order-editor button{min-height:32px}}
