:root{--ink:#17212b;--muted:#78818b;--line:#e7e9e8;--paper:#fff;--wash:#f7f8f6;--lime:#cdf25b;--green:#287959}*{box-sizing:border-box}body{margin:0;background:var(--wash);color:var(--ink);font:14px Manrope,Arial,sans-serif}.app-shell{min-height:100vh;display:flex}.sidebar{width:254px;background:#19232e;color:#eef3ed;padding:29px 18px 20px;display:flex;flex-direction:column}.brand{color:white;text-decoration:none;font-weight:800;font-size:23px;letter-spacing:-1.3px;display:flex;align-items:center;gap:9px;margin:0 10px 42px}.brand-mark{display:grid;place-items:center;width:27px;height:27px;background:var(--lime);color:#203028;border-radius:8px;font:800 17px Georgia}.dot{color:var(--lime)}nav{display:grid;gap:6px}.nav-link{color:#aeb8bf;text-decoration:none;padding:12px 12px;border-radius:7px;font-weight:600;display:flex;gap:13px;align-items:center}.nav-link span{font-size:20px;width:17px;text-align:center}.nav-link.active,.nav-link:hover{color:white;background:#2a3642}.sidebar-bottom{margin-top:auto}.storage{border-top:1px solid #35414c;border-bottom:1px solid #35414c;padding:19px 8px 17px}.storage-label{display:flex;justify-content:space-between;color:#b5bdc4;font-size:11px}.storage-label b{color:#e9f4cd}.progress{height:4px;border-radius:3px;background:#3b4650;margin:10px 0 8px}.progress i{display:block;width:64%;height:100%;border-radius:inherit;background:var(--lime)}.storage small{font:10px 'DM Mono';color:#7e8992}.profile{border:0;background:transparent;color:white;width:100%;text-align:left;padding:19px 8px 0;display:flex;align-items:center;gap:10px;cursor:pointer}.avatar{height:32px;width:32px;display:grid;place-items:center;background:#dd9165;border-radius:50%;font:11px 'DM Mono';color:#392719}.profile b,.profile small{display:block;font-size:11px}.profile small{color:#9eabb4;font-size:10px;margin-top:2px}.profile em{margin-left:auto;font-style:normal;color:#94a2ad}main{min-width:0;flex:1;padding:37px 54px 48px;max-width:1500px}.topbar{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:31px}.eyebrow{font:10px 'DM Mono';letter-spacing:1px;color:#89918d;margin:0 0 9px}h1,h2,h3,p{margin-top:0}h1{font-size:28px;letter-spacing:-1.15px;margin-bottom:0}h2{font-size:26px;letter-spacing:-1px;margin-bottom:12px}.button{border:0;border-radius:6px;padding:12px 16px;font:700 12px Manrope;cursor:pointer;transition:.2s}.button.primary{background:var(--lime);color:#24302b}.button.primary:hover{background:#bce64e}.button.dark{background:#22313a;color:white}.button.ghost{background:#edf0ed;color:#4f5b60}.summary{display:grid;grid-template-columns:repeat(3,1fr);background:#fff;border:1px solid var(--line);border-radius:10px;margin-bottom:20px}.summary>div{padding:18px 24px;border-right:1px solid var(--line)}.summary>div:last-child{border:0}.summary span,.summary small{display:block;color:var(--muted);font-size:11px}.summary strong{font-size:19px;letter-spacing:-.5px;margin:4px 0 1px;display:block}.summary .green{color:var(--green)}.toolbar{display:flex;gap:10px;margin-bottom:16px}.search{height:42px;background:#fff;border:1px solid var(--line);border-radius:6px;display:flex;align-items:center;gap:9px;padding:0 13px;flex:1;max-width:490px;color:#8c949b;font-size:21px}.search input{border:0;outline:0;font:12px Manrope;width:100%;color:var(--ink)}select{border:1px solid var(--line);border-radius:6px;background:white;padding:0 13px;color:#59636b;font:12px Manrope;min-width:154px}.icon-button{border:1px solid var(--line);background:white;border-radius:6px;width:42px;color:#536069;font-size:18px;cursor:pointer}.table-card{background:white;border:1px solid var(--line);border-radius:10px;overflow:hidden;position:relative}table{width:100%;border-collapse:collapse}th{text-align:left;font:10px 'DM Mono';letter-spacing:.7px;color:#909793;background:#fbfcfa;padding:13px 16px;border-bottom:1px solid var(--line)}td{padding:15px 16px;border-bottom:1px solid #eff0ef;color:#59646b;font-size:12px}td b{color:#263039;font-family:'DM Mono';font-size:11px}td strong{color:#263039;font-size:12px}tr:last-child td{border:0}.tag{font:10px 'DM Mono';padding:4px 7px;border-radius:4px;background:#eef2ec;color:#4d5c4c}.stock{font-family:'DM Mono';color:#3c4a52}.row-actions{background:transparent;border:0;cursor:pointer;font-size:17px;color:#6f787e}.empty-state{text-align:center;padding:70px 20px}.empty-state>div{color:#aac66a;font-size:34px}.empty-state h3{font-size:15px;margin:10px 0 5px}.empty-state p{color:var(--muted);font-size:12px;margin-bottom:18px}.result-note{color:#818990;font-size:11px;margin:12px 2px}.view{display:none}.view.active{display:block}.import-layout{display:grid;grid-template-columns:1.1fr .9fr;gap:55px;align-items:center;max-width:1040px;padding-top:22px}.intro{color:#6f8550;font:11px 'DM Mono';letter-spacing:.6px;margin-bottom:10px}.muted{line-height:1.7;color:#717c83;max-width:490px}.steps{margin-top:31px}.steps>div{display:flex;gap:16px;border-top:1px solid var(--line);padding:16px 0;align-items:center}.steps b{font:11px 'DM Mono';color:#81a131}.steps strong,.steps small{display:block}.steps strong{font-size:12px;margin-bottom:4px}.steps small{color:#7e888e;font-size:11px}.text-button{margin-left:auto;border:0;background:transparent;color:#5b8035;font:700 11px Manrope;cursor:pointer}.upload-card{background:#fff;border:1px dashed #bdc7b9;border-radius:12px;text-align:center;padding:51px 30px}.file-icon{font-size:37px;color:#71963d}.upload-card h3{margin:15px 0 6px;font-size:17px}.upload-card p,.upload-card small{font-size:11px;color:#838b90}.upload-card .button{margin:11px 0 7px}.import-success{margin-top:17px;padding:10px;background:#f1f7e6;color:#557234;border-radius:5px;font-size:11px}.user-head{display:flex;justify-content:space-between;align-items:end;margin:20px 0 25px}.users-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.user-card{background:#fff;border:1px solid var(--line);padding:20px;border-radius:9px}.user-card header{display:flex;align-items:center;gap:10px;margin-bottom:17px}.user-card h3{font-size:13px;margin:0}.user-card p{color:#78818b;font-size:11px;margin:3px 0}.user-card footer{border-top:1px solid var(--line);padding-top:12px;font:10px 'DM Mono';color:#78818b;display:flex;justify-content:space-between}.role{color:#608531}.modal-backdrop{display:none;align-items:center;justify-content:center;background:#14202a99;position:fixed;inset:0;z-index:5;padding:20px}.modal-backdrop.show{display:flex}.modal{background:#fff;border-radius:10px;padding:28px;width:min(620px,100%);position:relative;box-shadow:0 20px 70px #0b121940}.modal h2{font-size:21px}.close{position:absolute;right:17px;top:13px;border:0;background:transparent;font-size:24px;color:#657078;cursor:pointer}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.modal label{display:grid;gap:6px;font-size:11px;font-weight:700;color:#5a646b;margin-bottom:14px}.modal input,.modal textarea,.modal select{width:100%;border:1px solid #dce1dd;border-radius:5px;padding:10px;font:12px Manrope;min-height:39px}.modal textarea{height:70px;resize:vertical}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:19px}.small-modal{width:420px}.toast{position:fixed;bottom:23px;right:24px;background:#203039;color:white;border-radius:6px;padding:12px 16px;font-size:12px;transform:translateY(80px);opacity:0;transition:.25s;z-index:9}.toast.show{transform:none;opacity:1}@media(max-width:850px){.sidebar{width:68px;padding:22px 10px}.brand{margin:0 auto 35px}.brand>span:last-child,.nav-link{font-size:0}.nav-link{padding:12px;justify-content:center}.nav-link span{font-size:20px}.sidebar-bottom{display:none}main{padding:28px 22px}.import-layout{grid-template-columns:1fr;gap:28px}.users-grid{grid-template-columns:1fr 1fr}}@media(max-width:620px){.topbar{gap:14px}.topbar .button{font-size:0}.topbar .button:first-letter{font-size:18px}.summary{grid-template-columns:1fr}.summary>div{border-right:0;border-bottom:1px solid var(--line)}.toolbar{flex-wrap:wrap}.search{flex-basis:100%}.table-card{overflow:auto}table{min-width:800px}.users-grid,.form-grid{grid-template-columns:1fr}}
/* Bilingual sparepart name shown under the English name. */
.chinese-name{display:block;color:#6380a0;font-size:11px;margin-top:3px}
.compact-table{overflow:auto}.compact-table table{min-width:1180px}.compact-table th{padding:8px 9px;font-size:9px;white-space:nowrap;line-height:1.25}.compact-table th small{display:block;margin-top:2px;color:#6c8cae;font:8px Arial,sans-serif;letter-spacing:0}.compact-table td{padding:8px 9px;font-size:10px;white-space:nowrap}.compact-table td strong,.compact-table td b{font-size:10px}.compact-table .tag{font-size:9px;padding:3px 5px}.compact-table .stock{font-size:10px}.compact-table .mandarin{color:#6380a0}
.stock-status{display:inline-block;min-width:30px;padding:3px 7px;border-radius:999px;text-align:center;font:700 10px 'DM Mono'}.stock-available{background:#e5f7ed;color:#177244}.stock-low{background:#fff4d8;color:#9a6500}.stock-empty{background:#ffe6e6;color:#c72e2e}.stock-minus{background:#c92020;color:#fff}

.scope-menu{overflow:hidden}.scope-menu>.sales-menu-toggle{user-select:none}.scope-menu>.sales-menu-toggle strong{font:inherit}.scope-menu>.sales-menu-toggle i{margin-left:auto}.scope-menu[open]>.sales-menu-toggle i{transform:rotate(180deg)}.scope-menu:not([open])>.sales-submenu{display:none}
nav>.nav-link,.scope-menu>.sales-menu-toggle,.scope-menu>.sales-submenu button{text-transform:uppercase}

/* Uppercase only interface name tags. Business data and free-form values keep
   their original casing for documents, search, and exports. */
.topbar h1,.view h1,.view h2,.view h3,.view>.intro,.modal h2,.modal h3,
.modal .eyebrow,.summary span,th,.button,.view button:not(.close):not(.row-actions),
.history-action,.text-button,.delivery-slip-button,.storage-label,.eyebrow,.intro,
.steps strong,.role-detail>b,.role-detail>strong{text-transform:uppercase}
.user-card h3{text-transform:none}

/* One typography system across the complete Partbase interface. */
html,body,button,input,select,textarea,table,th,td,*{font-family:"Apple LiGothic","Apple LiGothic Medium","PingFang TC","PingFang SC",sans-serif!important}
.sales-menu{display:grid;gap:3px}.sales-menu-toggle{list-style:none;width:100%;border-radius:7px;background:transparent;color:#aeb8bf;text-align:left;padding:12px;font:600 14px Manrope;display:flex;gap:13px;align-items:center;cursor:pointer}.sales-menu-toggle::-webkit-details-marker{display:none}.sales-menu-toggle span{font-size:20px;width:17px;text-align:center}.sales-menu-toggle:hover{color:#fff;background:#2a3642}.sales-menu-toggle i{margin-left:auto;font-style:normal;font-size:14px;transition:transform .15s}.sales-menu[open] .sales-menu-toggle{background:#2a3642;color:#fff}.sales-menu[open] .sales-menu-toggle i{transform:rotate(180deg)}.sales-submenu{display:grid;gap:2px;margin:0 0 3px 13px;padding-left:8px;border-left:1px solid #44515b}.sales-submenu button{border:0;background:transparent;color:#aeb8bf;text-align:left;padding:7px 8px;border-radius:5px;font:600 10px Manrope;cursor:pointer}.sales-submenu button:hover{color:#fff;background:#2a3642}.sales-submenu b{display:inline-block;width:20px;color:#d1f476;font:9px 'DM Mono'}@media(min-width:851px){.sales-menu-toggle{padding:7px 8px;font-size:10px;gap:8px}.sales-menu-toggle span{font-size:15px}.sales-submenu button{padding:5px 7px;font-size:9px}}@media(max-width:850px){.sales-menu-toggle{font-size:0;justify-content:center;padding:12px}.sales-menu-toggle span{font-size:20px}.sales-menu-toggle i{display:none}.sales-submenu{margin-left:0;padding-left:0;border:0}.sales-submenu button{font-size:0;text-align:center}.sales-submenu button b{font-size:9px}}
.sales-menu-static .sales-menu-toggle{background:#2a3642;color:#fff;cursor:default}.sales-menu-static .sales-submenu{display:grid}
.import-error{margin-top:17px;padding:10px;background:#ffe8e8;color:#a52d2d;border-radius:5px;font-size:11px}
.guest-role .compact-table th:nth-child(6),.guest-role .compact-table td:nth-child(6),.guest-role .compact-table th:nth-child(7),.guest-role .compact-table td:nth-child(7){display:none}
.stock-card-result{margin-top:16px}.stock-card-table{width:100%;border-collapse:collapse;margin-top:14px}.stock-card-table th,.stock-card-table td{padding:9px;border-bottom:1px solid var(--line);font-size:11px;text-align:left}
/* Review dialogs may contain many item rows. Keep the title and action buttons
   visible while the document detail itself can be scrolled. */
#pr-review-modal .modal,#po-approval-modal .modal,#sales-review-modal .modal,#outstanding-review-modal .modal{max-height:calc(100vh - 32px);display:flex;flex-direction:column;overflow:hidden}
#pr-review-content,#po-approval-content,#sales-review-content,#outstanding-review-content{min-height:0;overflow:auto;padding-right:6px;overscroll-behavior:contain}
#pr-review-modal .modal-actions,#po-approval-modal .modal-actions,#sales-review-modal .modal-actions,#outstanding-review-modal .modal-actions{flex:0 0 auto;background:#fff;padding-top:12px;margin-top:12px;border-top:1px solid var(--line)}
/* The selected Review button stays visible as the current document. */
.review-active{background:#cdf25b!important;color:#203028!important;border-color:#a9d13a!important;box-shadow:0 0 0 2px #cdf25b66!important}
.scope-search-toolbar{margin:8px 0 14px}.scope-search-toolbar .search{flex:1;max-width:680px}.scope-search-status{white-space:nowrap}
.history-line.scope-search-hidden{display:none!important}
.archive-toolbar{display:flex;justify-content:flex-end;margin:0 0 10px}.archive-toolbar .button{font-size:10px}
.payment-print-head{display:flex;align-items:center;justify-content:space-between;gap:18px;border-bottom:1px solid var(--line);padding-bottom:12px;margin-bottom:4px}.payment-print-head h3{margin:0 0 3px}.payment-print-head small{color:var(--muted)}.payment-print-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap}.payment-print-toolbar label{display:flex;align-items:center;gap:6px;font-size:10px;font-weight:700;color:#566168}.payment-print-toolbar span{font-size:10px;color:var(--muted);min-width:120px;text-align:right}.payment-print-toolbar .button:disabled{opacity:.45;cursor:not-allowed}.payment-selector{display:flex;align-items:center;justify-content:center;align-self:stretch;cursor:pointer}.payment-selector input{width:16px;height:16px;accent-color:#63892d}.payment-selector+ b{min-width:0}@media(max-width:850px){.payment-print-head{align-items:flex-start;flex-direction:column}.payment-print-toolbar{justify-content:flex-start}.payment-print-toolbar span{text-align:left}}
/* Semantic action colours make the workflow readable at a glance. */
/* Compact desktop layout: more rows and fields fit without reducing clarity. */
@media(min-width:851px){body{font-size:13px}.sidebar{width:230px;padding:22px 14px 16px}.brand{font-size:20px;margin-bottom:30px}.nav-link{padding:9px 10px;font-size:12px;gap:10px}.nav-link span{font-size:17px}.storage{padding:14px 7px}.profile{padding-top:14px}main{padding:27px 36px 36px}.topbar{margin-bottom:22px}h1{font-size:24px}h2{font-size:21px}.button{padding:9px 12px;font-size:11px}.summary{margin-bottom:14px}.summary>div{padding:13px 18px}.summary strong{font-size:16px}.toolbar{gap:7px;margin-bottom:11px}.search{height:35px;padding:0 10px;font-size:16px}.search input,select{font-size:11px}.icon-button{width:35px;font-size:15px}.table-card th{padding:9px 10px}.table-card td{padding:9px 10px;font-size:11px}.compact-table th{padding:7px 8px;font-size:8px}.compact-table td{padding:7px 8px;font-size:9px}.user-head{margin:14px 0 17px}.modal{padding:22px}.modal input,.modal textarea,.modal select{padding:8px;min-height:34px;font-size:11px}}
@media(min-width:851px){.view .quote-layout{gap:14px}.view .quote-form,.view .cart-card,.view .quote-history{padding:16px;border-radius:8px}.view .quote-form label{gap:4px;margin-bottom:9px;font-size:10px}.view .quote-form input,.view .quote-form textarea{padding:7px;font-size:11px}.view .quote-search{padding-top:11px;margin-top:4px}.view .quote-result{padding:7px;font-size:10px;grid-template-columns:110px 1fr auto}.view .cart-card h3{font-size:12px;padding-bottom:9px}.view .cart-items{min-height:150px}.view .cart-line{padding:8px 0;font-size:10px}.view .cart-line span{margin:2px 0 5px}.view .quote-total{padding-top:8px}.view .quote-total span,.view .quote-total strong{font-size:10px;margin:5px 0}.view .quote-total strong{font-size:13px}.view .quote-history{margin-top:14px}.view .quote-history h3{font-size:12px}.view .history-line{grid-template-columns:125px 1fr auto 80px;gap:8px;padding:8px 0;font-size:10px}}
@media(min-width:851px){body{font-size:12px}.sidebar{width:210px;padding:17px 12px 13px}.brand{font-size:18px;margin-bottom:22px}.nav-link{padding:7px 8px;font-size:10px;gap:8px}.nav-link span{font-size:15px}.storage{padding:10px 5px}.profile{padding:10px 5px 0}.profile b{font-size:10px}.profile small{font-size:8px}main{padding:20px 27px 27px}.topbar{margin-bottom:17px}.eyebrow{font-size:8px;margin-bottom:5px}h1{font-size:20px}h2{font-size:18px}.button{padding:7px 10px;font-size:10px}.summary>div{padding:10px 14px}.summary span,.summary small{font-size:9px}.summary strong{font-size:14px}.toolbar{gap:5px;margin-bottom:8px}.search{height:30px;padding:0 8px;font-size:13px}.search input,select{font-size:10px}.icon-button{height:30px;width:30px;font-size:13px}.table-card th{padding:7px 8px;font-size:8px}.table-card td{padding:7px 8px;font-size:10px}.compact-table th{padding:5px 6px;font-size:7px}.compact-table td{padding:5px 6px;font-size:8px}.compact-table td strong,.compact-table td b,.compact-table .stock{font-size:8px}.compact-table .tag{font-size:7px;padding:2px 4px}.view .quote-layout{gap:10px}.view .quote-form,.view .cart-card,.view .quote-history{padding:12px}.view .quote-form label{font-size:9px;margin-bottom:6px}.view .quote-form input,.view .quote-form textarea{padding:5px;font-size:10px}.view .quote-result{padding:5px;font-size:9px}.view .cart-line{padding:6px 0;font-size:9px}.view .cart-line input{font-size:9px}.view .quote-total span,.view .quote-total strong{font-size:9px}.view .quote-total strong{font-size:11px}.view .history-line{padding:6px 0;font-size:9px;grid-template-columns:110px 1fr auto 70px}.modal{padding:17px}.modal h2{font-size:17px}.modal label{font-size:9px;margin-bottom:8px}.modal input,.modal textarea,.modal select{padding:6px;min-height:30px;font-size:10px}}
#receiving-modal{overflow-y:auto;overscroll-behavior:contain}.receiving-modal-card{max-height:calc(100dvh - 32px);display:flex;flex-direction:column;overflow:hidden}.receiving-modal-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-right:6px}.receiving-modal-card .modal-actions{flex:0 0 auto;background:#fff;border-top:1px solid var(--line);padding-top:12px;margin-top:12px}@media(max-width:620px){#receiving-modal{align-items:flex-start;padding:12px}.receiving-modal-card{max-height:calc(100dvh - 24px)}}

/* Quotation toolbar: semantic colours separate file, draft, and final actions. */
#quotation-view #download-quote-template{background:#dbeafe;color:#174ea6;border:1px solid #93c5fd}
#quotation-view #download-quote-template:hover{background:#bfdbfe}
#quotation-view #upload-quote-excel{background:#ede9fe;color:#6d28d9;border:1px solid #c4b5fd}
#quotation-view #upload-quote-excel:hover{background:#ddd6fe}
#quotation-view #restore-quote-draft{background:#ffedd5;color:#9a3412;border:1px solid #fdba74}
#quotation-view #restore-quote-draft:hover{background:#fed7aa}
#quotation-view #save-quote-draft{background:#dbe6ef;color:#243b53;border:1px solid #9fb3c8}
#quotation-view #save-quote-draft:hover{background:#cbd9e6}
#quotation-view #save-quote{background:#cdf25b;color:#203028;border:1px solid #acd436}
#quotation-view #save-quote:hover{background:#bce64e}
.view:is(#pr-view,#purchase-view) [data-download-order]{background:#dbeafe;color:#174ea6;border:1px solid #93c5fd}
.view:is(#pr-view,#purchase-view) [data-download-order]:hover{background:#bfdbfe}
.view:is(#pr-view,#purchase-view) [data-upload-order]{background:#ede9fe;color:#6d28d9;border:1px solid #c4b5fd}
.view:is(#pr-view,#purchase-view) [data-upload-order]:hover{background:#ddd6fe}
.view:is(#pr-view,#purchase-view) [id^="restore-"]{background:#ffedd5;color:#9a3412;border:1px solid #fdba74}
.view:is(#pr-view,#purchase-view) [id^="restore-"]:hover{background:#fed7aa}
.view:is(#pr-view,#purchase-view) [id^="save-"][id$="-draft"]{background:#dbe6ef;color:#243b53;border:1px solid #9fb3c8}
.view:is(#pr-view,#purchase-view) [id^="save-"][id$="-draft"]:hover{background:#cbd9e6}
.view:is(#pr-view,#purchase-view)>.user-head>#save-pr,.view:is(#pr-view,#purchase-view)>.user-head>#save-po{background:#cdf25b;color:#203028;border:1px solid #acd436}
.view:is(#pr-view,#purchase-view)>.user-head>#save-pr:hover,.view:is(#pr-view,#purchase-view)>.user-head>#save-po:hover{background:#bce64e}
.button-bilingual{display:inline-flex;min-height:48px;flex-direction:column;align-items:center;justify-content:center;gap:3px;white-space:nowrap;line-height:1.1;text-align:center}
.button-bilingual>span,.button-bilingual>small{display:block}
.button-bilingual>small{font-size:.88em;font-weight:700;letter-spacing:.02em;opacity:.9;text-transform:none}

/* Main navigation follows one consistent bilingual hierarchy. */
.sidebar .nav-link,.sidebar .sales-menu-toggle,.sidebar .sales-submenu button{align-items:center}
.nav-bilingual{display:flex;min-width:0;flex:1;flex-direction:column;gap:2px;line-height:1.12;text-align:left}
.nav-bilingual>span{display:block;color:inherit;font-size:1em;font-weight:700}
.nav-bilingual>small{display:block;color:inherit;font-size:.88em;font-weight:600;opacity:.78;line-height:1.15;text-transform:none}
.sidebar .nav-link.active .nav-bilingual>small,.sidebar .nav-link:hover .nav-bilingual>small,.sidebar .sales-menu-toggle:hover .nav-bilingual>small,.sidebar .sales-menu[open]>.sales-menu-toggle .nav-bilingual>small{opacity:.9}
.sidebar .sales-menu-toggle>strong{display:flex;min-width:0;flex:1;font:inherit}
.sidebar .sales-submenu button{display:flex;gap:5px}
.sidebar .sales-submenu button>b{flex:0 0 20px}
@media(min-width:851px){#quotation-view .quote-layout,#purchase-view .quote-layout,#pr-view .quote-layout,#sales-view .quote-layout{gap:8px}#quotation-view .quote-form,#quotation-view .cart-card,#quotation-view .quote-history,#purchase-view .quote-form,#purchase-view .cart-card,#purchase-view .quote-history,#pr-view .quote-form,#pr-view .cart-card,#pr-view .quote-history,#sales-view .quote-form,#sales-view .cart-card,#sales-view .quote-history{padding:9px;border-radius:6px}#quotation-view .quote-form label,#purchase-view .quote-form label,#pr-view .quote-form label,#sales-view .quote-form label{font-size:8px;gap:3px;margin-bottom:5px}#quotation-view .quote-form input,#quotation-view .quote-form textarea,#quotation-view .quote-form select,#purchase-view .quote-form input,#purchase-view .quote-form textarea,#purchase-view .quote-form select,#pr-view .quote-form input,#pr-view .quote-form textarea,#sales-view .quote-form input,#sales-view .quote-form textarea{font-size:9px;padding:4px;min-height:27px}#quotation-view .cart-card h3,#purchase-view .cart-card h3,#pr-view .cart-card h3,#sales-view .cart-card h3{font-size:10px;padding-bottom:6px}#quotation-view .cart-line,#purchase-view .cart-line,#pr-view .cart-line,#sales-view .cart-line{font-size:8px;padding:4px 0}#quotation-view .cart-line input,#purchase-view .cart-line input,#pr-view .cart-line input,#sales-view .cart-line input{font-size:8px;padding:2px}#quotation-view .quote-result,#purchase-view .quote-result,#pr-view .quote-result,#sales-view .quote-result{font-size:8px;padding:4px;grid-template-columns:95px 1fr auto}#quotation-view .quote-total span,#quotation-view .quote-total strong,#purchase-view .quote-total span,#purchase-view .quote-total strong{font-size:8px;margin:3px 0}#quotation-view .quote-total strong,#purchase-view .quote-total strong{font-size:10px}#quotation-view .history-line,#purchase-view .history-line,#pr-view .history-line,#sales-view .history-line{font-size:8px;padding:4px 0;gap:5px;grid-template-columns:95px 1fr auto 62px}}

/* Final desktop sidebar geometry: readable hierarchy without cramped labels. */
@media(min-width:851px){
  .sidebar{width:244px;height:100vh;position:sticky;top:0;overflow-y:auto;padding:18px 14px 14px}
  .sidebar .brand{margin:0 8px 24px;font-size:19px}
  .sidebar nav{gap:4px}
  .sidebar .nav-link,.sidebar .sales-menu-toggle{min-height:48px;padding:7px 9px;border-radius:8px;gap:10px;font-size:11px}
  .sidebar .nav-link>span:first-child,.sidebar .sales-menu-toggle>span:first-child{display:grid;flex:0 0 30px;width:30px;height:30px;place-items:center;border-radius:7px;background:#24313d;color:#c7d0d6;font-size:15px}
  .sidebar .nav-link.active>span:first-child,.sidebar .nav-link:hover>span:first-child,.sidebar .sales-menu[open]>.sales-menu-toggle>span:first-child,.sidebar .sales-menu-toggle:hover>span:first-child{background:#3a4854;color:#d8f77b}
  .sidebar .nav-bilingual,.sidebar .nav-bilingual>span,.sidebar .nav-bilingual>small{width:auto}
  .sidebar .nav-bilingual{gap:3px;line-height:1.1}
  .sidebar .nav-bilingual>span{font-size:11px;font-weight:750;letter-spacing:.015em}
  .sidebar .nav-bilingual>small{font-size:9.5px;font-weight:500;opacity:.68;line-height:1.1}
  .sidebar .sales-menu-toggle>i{font-size:11px;color:#84919b}
  .sidebar .sales-submenu{gap:2px;margin:3px 0 5px 23px;padding:2px 0 2px 12px;border-left:1px solid #43515d}
  .sidebar .sales-submenu button{min-height:38px;padding:5px 7px;gap:7px;border-radius:6px}
  .sidebar .sales-submenu button>b{display:grid;flex:0 0 24px;width:24px;height:21px;place-items:center;border-radius:5px;background:#263540;color:#d1f476;font-size:8px}
  .sidebar .sales-submenu .nav-bilingual{gap:1px}
  .sidebar .sales-submenu .nav-bilingual>span{font-size:9.5px}
  .sidebar .sales-submenu .nav-bilingual>small{font-size:8.5px}
}
/* Give every top-level sidebar destination a restrained green outline. */
.sidebar .nav-link,.sidebar .sales-menu-toggle{border:1px solid #587443}
.sidebar .nav-link.active,.sidebar .sales-menu[open]>.sales-menu-toggle{border-color:#8fbf45}

/* Clear but restrained pointer feedback for the complete sidebar. */
.sidebar .nav-link,.sidebar .sales-menu-toggle,.sidebar .sales-submenu button{transition:background-color .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease}
.sidebar .nav-link:hover,.sidebar .sales-menu-toggle:hover{background:#34483b;color:#fff;border-color:var(--lime);box-shadow:inset 3px 0 0 var(--lime);transform:translateX(2px)}
.sidebar .nav-link:hover .nav-bilingual>small,.sidebar .sales-menu-toggle:hover .nav-bilingual>small{color:#dce8df;opacity:1}
.sidebar .nav-link:hover>span:first-child,.sidebar .sales-menu-toggle:hover>span:first-child{background:#445b49;color:var(--lime);box-shadow:0 0 0 1px #cdf25b55}
.sidebar .sales-submenu button:hover{background:#304238;color:#fff;box-shadow:inset 2px 0 0 #a9d63f;transform:translateX(2px)}
.sidebar .sales-submenu button:hover>b{background:#405646;color:#e0fa8b}
.sidebar .sales-submenu button:hover .nav-bilingual>small{color:#d8e4da;opacity:1}
.sidebar .sales-submenu button.active,.sidebar .sales-submenu button.active:hover{background:var(--lime);color:#17212b;box-shadow:inset 3px 0 0 #587b1d;transform:none}
.sidebar .sales-submenu button.active .nav-bilingual>span,.sidebar .sales-submenu button.active .nav-bilingual>small{color:#17212b;opacity:1}
.sidebar .sales-submenu button.active>b{background:#304238;color:#e5ff91}
.purchase-follow-only .quote-layout,.purchase-follow-only .user-head>.button{display:none!important}
.toast{position:fixed;top:auto;bottom:24px;left:auto;right:24px;width:max-content;max-width:min(560px,calc(100vw - 48px));background:#cdf25b;color:#17212b;border:1px solid #a9cf38;border-radius:10px;padding:16px 22px;font-size:14px;font-weight:700;line-height:1.45;text-align:center;box-shadow:0 14px 40px rgba(47,65,22,.24);transform:translateY(14px) scale(.96);transform-origin:bottom right;opacity:0;visibility:hidden;transition:opacity .2s ease,transform .2s ease,visibility .2s;z-index:10000}
.toast.show{transform:translateY(0) scale(1);opacity:1;visibility:visible}
@media(max-width:620px){.toast{right:12px;bottom:12px;max-width:calc(100vw - 24px)}}
.price-history-toolbar{display:flex;gap:10px;align-items:center;margin:14px 0}.price-history-toolbar .search{flex:1}.price-history-summary{display:grid;grid-template-columns:repeat(4,minmax(130px,1fr));gap:10px;margin:12px 0}.price-history-summary span{display:flex;flex-direction:column;gap:4px;padding:12px 14px;border:1px solid #dfe6e2;border-radius:10px;background:#f8faf9;color:#66716f;font-size:11px}.price-history-summary strong{color:#17212b;font-size:16px}.price-history-link{font-size:11px;margin-top:5px;padding:0}.price-use-button{white-space:nowrap;padding:6px 9px}@media(max-width:800px){.price-history-summary{grid-template-columns:repeat(2,1fr)}.price-history-toolbar{align-items:stretch;flex-direction:column}}
.purchase-stage-panel{padding:14px 0}.purchase-stage-panel+.purchase-stage-panel{margin-top:12px;border-top:2px solid #dfe6e2}.purchase-stage-panel>h3,.purchase-stage-panel>h4{margin:0 0 10px}.purchase-action-queue{border-left:3px solid #cdf25b;padding-left:12px}.purchase-action-queue .status-cancelled,.purchase-action-queue .status-cancelled-archived{display:none}.purchase-document-history{border-left:3px solid #9fb3c8;padding-left:12px}.purchase-document-history .history-line{background:#f8faf9}.purchase-stage-panel .history-line{padding-left:8px;padding-right:8px}

#contract-item-modal > .modal {
  width: min(1800px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
}
#contract-item-content > .approval-table {
  overflow-x: auto;
}
#contract-item-content > .approval-table table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
#contract-item-content > .approval-table :is(th, td) {
  padding: 7px 8px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
}
#contract-item-content > .approval-table th { white-space: nowrap; }
#contract-item-content > .approval-table th:nth-child(1) { width: 1%; }
#contract-item-content > .approval-table th:nth-child(2) { width: 42px; }
#contract-item-content > .approval-table th:nth-child(3) { min-width: 95px; }
#contract-item-content > .approval-table th:nth-child(4) { min-width: 105px; }
#contract-item-content > .approval-table th:nth-child(5) { min-width: 250px; max-width: 340px; }
#contract-item-content > .approval-table th:nth-child(6),
#contract-item-content > .approval-table th:nth-child(9),
#contract-item-content > .approval-table th:nth-child(10),
#contract-item-content > .approval-table th:nth-child(11) { min-width: 58px; }
#contract-item-content > .approval-table th:nth-child(7) { min-width: 155px; max-width: 190px; }
#contract-item-content > .approval-table th:nth-child(8) { min-width: 105px; }
#contract-item-content > .approval-table th:nth-child(12),
#contract-item-content > .approval-table th:nth-child(13) { min-width: 120px; }
#contract-item-content > .approval-table th:nth-child(14) { min-width: 112px; }
#contract-item-content > .approval-table th:nth-child(15) { min-width: 125px; }
#contract-item-content > .approval-table th:nth-child(16) { min-width: 130px; max-width: 190px; }
#contract-item-content > .approval-table th:last-child { min-width: 175px; max-width: 210px; }
#contract-item-content > .approval-table td:last-child .history-action { margin: 2px 3px 2px 0; white-space: normal; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(1) { width: 42px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(2) { min-width: 95px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(3) { min-width: 105px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(4) { min-width: 250px; max-width: 340px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(5),
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(8),
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(9),
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(10) { min-width: 58px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(6) { min-width: 155px; max-width: 190px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(7) { min-width: 105px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(11),
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(12) { min-width: 120px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(13) { min-width: 112px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(14) { min-width: 125px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:nth-child(15) { min-width: 130px; max-width: 190px; }
#contract-item-content > .approval-table table:not(.can-edit-items) th:last-child { min-width: 175px; max-width: 210px; }

#contract-item-content .contract-match-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
#contract-item-content .contract-match-legend > span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
#contract-item-content .contract-match-legend > [data-contract-match-status="complete"],
#contract-item-content tr[data-contract-match-status="complete"] > td {
  background: #e9f6eb;
}
#contract-item-content .contract-match-legend > [data-contract-match-status="partial"],
#contract-item-content tr[data-contract-match-status="partial"] > td {
  background: #e5f1ff;
}
#contract-item-content tr.contract-match-selected > td {
  background: #fff0a8;
}
#contract-item-content tr.contract-match-selected > td:first-child {
  box-shadow: inset 4px 0 #ad7100;
}
#contract-item-content tr.contract-row-selected > td {
  background: #fff7cf !important;
}
#contract-item-content tr.contract-row-selected > td:first-child {
  box-shadow: inset 4px 0 #a87800;
}
#contract-list .contract-monitoring-line {
  grid-template-columns: 112px minmax(250px, 1fr) minmax(250px, 1fr) minmax(230px, .8fr);
  gap: 18px 22px;
  align-items: start;
  padding: 20px 18px;
}
#contract-list .contract-select {
  padding-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
#contract-list .contract-select label { display: inline-flex; align-items: center; gap: 6px; }
#contract-list .contract-identity { min-width: 0; }
#contract-list .contract-list-number {
  color:#17212b;
  display:block;
  font-size:16px;
  line-height:1.35;
  overflow-wrap:anywhere;
}
#contract-list .contract-identity small {
  display:block;
  margin-top:6px;
  color:var(--muted);
  font-size:11px;
  font-weight:500;
  line-height:1.55;
}
#contract-list .contract-customer-name {
  display:block;
  margin-top:4px;
  color:#314037;
  font-size:14px;
  font-weight:800;
  line-height:1.35;
  overflow-wrap:anywhere;
}
#contract-list .contract-progress {
  display:grid;
  gap:6px;
  min-width:0;
  padding: 1px 0;
}
#contract-list .contract-progress-title { font-weight:800; color:#435047; }
#contract-list .contract-progress-row { display:grid; gap:3px; }
#contract-list .contract-progress-row>div:first-child { display:flex; justify-content:space-between; gap:8px; }
#contract-list .contract-progress-row strong { color:#17212b; }
#contract-list .contract-progress-row small { color:var(--muted); }
#contract-list .contract-progress-track { height:7px; overflow:hidden; background:#e7ece8; border-radius:999px; }
#contract-list .contract-progress-track>span { display:block; height:100%; border-radius:inherit; }
#contract-list .contract-progress-track>.fulfillment { background:#628d43; }
#contract-list .contract-progress-track>.procurement { background:#bd7f28; }
#contract-list .contract-progress-track>.billing { background:#3d82c8; }
#contract-list .contract-finance { min-width: 0; }
#contract-list .contract-value { display:block; color:#17212b; font-size:16px; line-height:1.35; }
#contract-list .contract-value small { color:var(--muted); font-size:11px; font-weight:600; }
#contract-list .contract-financial-status { display:block; margin-top:7px; color:var(--muted); font-size:11px; line-height:1.55; }
#contract-list .contract-monitoring-line>.history-actions { grid-column:1 / -1; }
@media(max-width:850px){
  #contract-list .contract-monitoring-line { grid-template-columns:1fr; }
  #contract-list .contract-monitoring-line>.history-actions { grid-column:auto; }
  #contract-list .contract-select { padding-top:0; }
}
.action-safety-dialog.contract-match-dialog::backdrop {
  background: rgb(10 18 30 / 40%);
}
.action-safety-dialog.contract-match-dialog:has(#contract-invoice-link-title) {
  width: min(680px, calc(100vw - 28px)) !important;
  max-width: 680px;
  padding: 26px 30px;
}
.action-safety-dialog.contract-match-dialog:has(#contract-invoice-link-title) h2 {
  margin: 0 36px 8px 0;
  line-height: 1.35;
}
.action-safety-dialog.contract-match-dialog:has(#contract-invoice-link-title) > p {
  margin: 0 0 18px;
  color: #53616d;
  line-height: 1.5;
}
.contract-invoice-link-form { display: grid; gap: 10px; }
.contract-invoice-link-form > label { margin: 0; }
.contract-invoice-link-form select { width: 100%; min-height: 42px; }
.contract-invoice-link-message,.contract-invoice-link-error {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #dfe6e2;
  border-radius: 8px;
  background: #f6f8f6;
  color: #4d5a62;
  line-height: 1.55;
}
.contract-invoice-link-form .modal-actions {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #e4e9e5;
}
@media(max-width:620px) {
  .action-safety-dialog.contract-match-dialog:has(#contract-invoice-link-title) { padding: 22px 18px; }
  .contract-invoice-link-form .modal-actions { flex-wrap: wrap; }
  .contract-invoice-link-form .modal-actions .button { flex: 1 1 140px; }
}
.contract-match-dialog:has([name="supplierSearch"]) [name="supplierSearch"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd9d2;
  border-radius: 7px;
  padding: 9px 12px;
  background: #fff;
}
.contract-match-dialog:has([name="supplierSearch"]) [name="supplierSearch"]:focus {
  outline: 3px solid rgb(61 130 200 / 16%);
  border-color: #3d82c8;
}
/* Readable professional density: business data must remain comfortable to
   review at normal desktop zoom, without making dense operational tables
   unnecessarily wide.  These rules intentionally come last to replace the
   earlier compact-only desktop overrides. */
@media (min-width:851px) {
  body { font-size:14px; }
  .sidebar { width:240px; }
  .nav-link,.sales-menu-toggle { font-size:13px; }
  .sales-submenu button { font-size:11px; }
  .button { font-size:12px; padding:9px 13px; }
  .search input,select { font-size:13px; }
  .table-card th { font-size:10px; }
  .table-card td { font-size:12px; }
  .compact-table th { font-size:9px; }
  .compact-table td,.compact-table td strong,.compact-table td b,.compact-table .stock { font-size:11px; }
  .compact-table .tag { font-size:9px; }
  .view .quote-form label { font-size:11px; }
  .view .quote-form input,.view .quote-form textarea,.view .quote-form select { font-size:13px; min-height:34px; }
  .view .quote-result,.view .cart-line { font-size:12px; }
  .view .cart-line input { font-size:12px; }
  .view .quote-total span { font-size:11px; }
  .view .quote-total strong { font-size:14px; }
  .view .quote-history h3 { font-size:14px; }
  .view .history-line { font-size:12px; padding:9px 0; }
  .history-line small,.payment-print-head small { font-size:11px; }
  .modal label { font-size:12px; }
  .modal input,.modal textarea,.modal select { font-size:13px; min-height:38px; }
}
@media (max-width:850px) {
  body { font-size:14px; }
  .button { font-size:12px; }
  .table-card td { font-size:12px; }
  .compact-table th { font-size:9px; }
  .compact-table td { font-size:10px; }
  .view .quote-form label { font-size:11px; }
  .view .quote-form input,.view .quote-form textarea,.view .quote-form select { font-size:13px; }
  .view .history-line { font-size:12px; }
}
/* Sales uses direct warehouse deduction. Legacy source-allocation tools stay
   available only through historical records and must not appear in the daily
   Quotation → Packing → Delivery → Invoice workflow. */

/* Keep the catalog search usable even when filter and export actions share its toolbar. */
#catalog-view .toolbar{flex-wrap:wrap;align-items:stretch}
#catalog-view .toolbar>.search{flex:2 1 420px;width:100%;min-width:360px;max-width:none}
#catalog-view .toolbar>.search input{min-width:0}
#catalog-view .toolbar>select{flex:1 1 185px;min-width:185px}
#catalog-view .toolbar>.button,#catalog-view .toolbar>.icon-button{flex:0 0 auto}
.payment-history-filter{display:flex;flex-wrap:wrap;gap:10px;align-items:end;margin:0 0 12px}
.payment-history-filter label{display:grid;gap:4px;font-weight:700;font-size:12px}
.payment-history-filter input{min-height:38px}
.payment-history-total{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:baseline;margin:0 0 8px;padding:10px 12px;border:1px solid #d8e2d6;border-radius:8px;background:#f6faf4}
.payment-history-total strong{color:#236d46;font-size:15px}
.payment-history-total span,.payment-history-total small{color:#59665f}
@media(max-width:850px){#catalog-view .toolbar>.search{min-width:0;flex-basis:100%}}
.document-editor-actions{display:flex;align-items:stretch;justify-content:flex-end;flex-wrap:wrap;gap:10px;max-width:980px}
.document-editor-actions>.button{min-width:108px}
#document-import-review-modal{z-index:10020}
#document-import-review-modal .document-import-review{width:min(1440px,calc(100vw - 32px));max-width:1440px;max-height:calc(100vh - 32px);display:flex;flex-direction:column;padding:26px}
#document-import-review-modal .document-import-review-table{overflow:auto;max-height:min(58vh,620px);border:1px solid #e0e7e1;border-radius:8px}
#document-import-review-modal table{min-width:980px}
#document-import-review-modal th{position:sticky;top:0;z-index:1;background:#f5f8f4;white-space:nowrap}
#document-import-review-modal td{vertical-align:top}
#document-import-review-modal td small{color:#68747b}
#document-import-review-modal .document-import-review-note{margin:12px 0 0;color:#5b6a60;font-size:12px}
@media(max-width:850px){.user-head{align-items:flex-start;flex-direction:column;gap:12px}.document-editor-actions{justify-content:flex-start;max-width:none;width:100%}.document-editor-actions>.button{flex:1 1 140px}.document-import-review{padding:18px!important}}

/* Inventory: separate discovery, filtering, and export actions so the busy
   catalog stays readable at operational scale. */
#catalog-view .inventory-toolbar{
  display:grid;
  grid-template-columns:minmax(520px,1fr) auto;
  gap:10px;
  align-items:center;
  margin-bottom:14px;
}
#catalog-view .inventory-toolbar>.search{width:100%;min-width:0;max-width:none;height:46px}
#catalog-view .inventory-toolbar>.search input{min-width:0}
#catalog-view .inventory-filter-group{grid-column:1 / -1;grid-row:2;display:grid;grid-template-columns:repeat(4,minmax(180px,1fr));gap:8px}
#catalog-view .inventory-filter-group select{width:100%;min-width:0;min-height:46px}
#catalog-view .inventory-action-group{grid-column:2;grid-row:1;display:flex;align-items:stretch;justify-content:flex-end;flex-wrap:wrap;gap:8px}
#catalog-view .inventory-action-group .button,#catalog-view .inventory-action-group .icon-button{min-height:46px}
#catalog-view .inventory-action-group [data-identity-open]{white-space:nowrap}
#catalog-view .table-card{border-radius:12px;overflow:hidden}
#catalog-view .table-card thead th{background:#f5f8f4}
@media(max-width:1320px){
  #catalog-view .inventory-toolbar{grid-template-columns:minmax(360px,1fr)}
  #catalog-view .inventory-action-group{grid-column:auto;grid-row:auto;justify-content:flex-start}
  #catalog-view .inventory-filter-group{grid-column:auto;grid-row:auto;grid-template-columns:repeat(2,minmax(180px,1fr))}
}
@media(max-width:850px){
  #catalog-view .inventory-toolbar{grid-template-columns:1fr}
  #catalog-view .inventory-filter-group{grid-column:auto;grid-template-columns:1fr}
  #catalog-view .inventory-action-group{justify-content:flex-start}
  #catalog-view .inventory-action-group .button{flex:1 1 175px}
}

/* Reports and accounting share the same financial hierarchy: controls first,
   key figures second, then readable operational detail. */
#reports-view,#accounting-view{max-width:1680px}
#reports-view .quote-history,#accounting-view .acc-block{
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:20px;
  box-shadow:0 1px 2px rgb(20 36 27 / 3%);
}
#reports-view #period-report{margin-bottom:18px}
#reports-view .quote-history h2,#reports-view .quote-history h3{margin:0 0 7px;color:#17212b}
#reports-view .quote-history>p.muted{max-width:1060px;line-height:1.55}
#reports-view .period-toolbar{display:grid;grid-template-columns:minmax(230px,1fr) auto auto auto;gap:10px;align-items:end;margin:18px 0 10px}
#reports-view .period-toolbar+ #period-description{margin:0 0 16px;padding:10px 12px;border-left:3px solid #719a4c;background:#f7faf5;border-radius:0 7px 7px 0}
#reports-view .period-toolbar label{min-width:0;font-size:12px;font-weight:700;color:#526057}
#reports-view .period-toolbar input,#reports-view .period-toolbar select{min-height:42px;width:100%;font-size:13px}
#reports-view #period-summary{grid-template-columns:repeat(auto-fit,minmax(190px,1fr));margin:16px 0 10px;border-radius:10px;overflow:hidden}
#reports-view #period-summary>div{min-height:94px;padding:15px 16px}
#reports-view #period-results{border:1px solid #e0e7e1;border-radius:9px;margin-top:14px;max-height:620px}
#reports-view #period-results{overflow-x:hidden!important;overflow-y:auto!important}
#reports-view #period-results table{width:100%;min-width:2500px;table-layout:fixed;font-size:11px}
#reports-view #period-results th{position:sticky;top:0;z-index:1;background:#f4f7f3;font-size:10px}
#reports-view #period-results th,#reports-view #period-results td{padding:8px 7px;line-height:1.35;white-space:normal;overflow-wrap:anywhere;word-break:break-word}
#reports-view #period-results th:nth-child(1){width:165px}
#reports-view #period-results th:nth-child(2){width:145px}
#reports-view #period-results th:nth-child(3){width:110px}
#reports-view #period-results th:nth-child(4){width:230px}
#reports-view #period-results th:nth-child(5),#reports-view #period-results th:nth-child(9){width:135px}
#reports-view #period-results th:nth-child(6){width:110px}
#reports-view #period-results th:nth-child(8){width:175px}
#reports-view #period-results th:nth-child(7),#reports-view #period-results th:nth-child(n+10):not(:last-child){width:150px}
#reports-view #period-results th:last-child{width:180px}
#reports-view #period-results td:nth-child(7),#reports-view #period-results td:nth-child(n+10):not(:last-child){white-space:nowrap;overflow-wrap:normal;word-break:normal}
#reports-view #period-results details{min-width:0}
#reports-view #period-results .history-action{width:100%;min-width:0;min-height:36px;margin-top:8px;padding:7px 6px;white-space:normal;font-size:10px}
#reports-view .revenue-report{margin:18px 0}
#reports-view .revenue-summary{grid-template-columns:repeat(5,minmax(160px,1fr));gap:0;border:1px solid var(--line);border-radius:9px;overflow:hidden}
#reports-view .revenue-summary>div{min-height:94px;padding:15px 16px;border-right:1px solid var(--line)}
#reports-view .revenue-summary>div:last-child{border-right:0}
#reports-view .revenue-summary strong{margin-top:7px;font-size:16px;font-variant-numeric:tabular-nums}
#reports-view #negative-stock-report{border-color:#efd6ce;background:#fffdfc}
#reports-view #negative-stock-results{overflow:auto;border:1px solid #f0dfda;border-radius:9px;margin-top:14px}
#reports-view #negative-stock-results table{min-width:1040px}
#reports-view #negative-stock-results th{background:#fff4f0;white-space:nowrap}
#reports-view #customer-sales-ranking{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:18px}
#reports-view #customer-sales-ranking .history-line{grid-template-columns:48px minmax(0,1fr) auto;padding:11px 0}
#reports-view #report-extra{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:18px}
#reports-view #report-extra .quote-history{margin:0}
#reports-view #report-extra .quote-history:last-child{grid-column:1 / -1}

#accounting-view .user-head{padding:4px 0 18px;margin-bottom:18px;border-bottom:1px solid var(--line)}
#accounting-view .user-head h2{margin-top:3px}
#accounting-view .acc-tools{gap:10px}
#accounting-view .acc-tools input[type="search"],#accounting-view .acc-tools select{height:42px;border-radius:8px;font-size:13px}
#accounting-view .acc-tools input[type="search"]{min-width:280px}
#accounting-view .acc-kpis{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:12px}
#accounting-view .acc-kpi{min-height:104px;padding:17px 18px;border-radius:11px}
#accounting-view .acc-kpi>span{font-size:11px}
#accounting-view .acc-kpi>strong{font-size:19px;margin:8px 0 4px}
#accounting-view .acc-kpi>small{font-size:11px}
#accounting-view .acc-strip{border-radius:11px;margin-bottom:20px}
#accounting-view .acc-strip>div{padding:14px 17px}
#accounting-view .acc-strip strong{font-size:14px;margin-top:5px}
#accounting-view .acc-block{margin-bottom:18px}
#accounting-view .acc-block-head{padding-bottom:12px;border-bottom:1px solid #e5ebe5;margin-bottom:14px}
#accounting-view .acc-block-head h3{font-size:16px}
#accounting-view .acc-count{font-size:11px}
#accounting-view .table-card{border:1px solid #e0e7e1;border-radius:9px}
#accounting-view .acc-block .table-card{
  max-height:min(62vh,680px);
  overflow:auto;
  overscroll-behavior:contain;
}
#accounting-view .acc-table thead th{position:sticky;top:0;z-index:1;background:#f4f7f3}
#accounting-view .acc-table th,#accounting-view .acc-table td{padding:11px 12px}
#accounting-view .acc-table tfoot td{padding:12px;background:#f3f7f1}
#accounting-view .acc-table tfoot{position:sticky;bottom:0;z-index:1}
#accounting-view .acc-table tfoot td{box-shadow:0 -1px 0 #dce4dc}
#accounting-view .acc-review{width:min(1600px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);padding:20px;border:1px solid #dce5dc;border-radius:12px;color:var(--ink);box-shadow:0 20px 70px #0b121940}
#accounting-view .acc-review::backdrop{background:#14202a99}
#accounting-view .acc-review-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
#accounting-view .acc-review-head h2{margin:0}
#accounting-view .acc-review .acc-tools{margin-bottom:14px}
#accounting-view .acc-review .table-card{max-height:calc(100dvh - 190px);overflow:auto}
#accounting-view .acc-review-open{min-height:42px;border:1px solid #587443;padding-inline:20px}
@media print{
  body.acc-print #accounting-view .acc-review{display:block!important;position:static;width:auto;max-width:none;max-height:none;margin:0;padding:0;border:0;box-shadow:none;overflow:visible}
  body.acc-print #accounting-view .acc-review-head,body.acc-print #accounting-view .acc-review-open{display:none!important}
  body.acc-print #accounting-view .acc-review .table-card{max-height:none;overflow:visible}
}
@media(max-width:1100px){
  #reports-view .period-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}
  #reports-view .revenue-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  #reports-view .revenue-summary>div:nth-child(2n){border-right:0}
  #accounting-view .acc-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* Stock movement has three distinct duties: record a physical movement,
   import reviewed rows, and inspect the resulting audit history. */
#inventory-view{max-width:1680px}
#inventory-view .user-head{align-items:flex-start;gap:18px;padding:4px 0 16px;margin-bottom:18px;border-bottom:1px solid var(--line)}
#inventory-view .inventory-document-actions{display:flex;justify-content:flex-end;align-items:stretch;flex-wrap:wrap;gap:8px;max-width:1020px}
#inventory-view .inventory-document-actions__group{display:flex;align-items:center;flex-wrap:wrap;gap:7px;padding:8px 10px;border:1px solid #dfe7de;border-radius:9px;background:#f8faf7}
#inventory-view .inventory-document-actions__label{font-size:11px;font-weight:800;color:#526158;white-space:nowrap}
#inventory-view .inventory-document-actions .button{min-height:36px;white-space:nowrap}
#inventory-view #inventory-import-preview{width:100%;margin:0 0 16px}
#inventory-view #inventory-import-preview .notice{max-width:980px;margin:0;padding:13px 15px;line-height:1.55;border-radius:9px}
#inventory-view .quote-layout{align-items:start;gap:18px}
#inventory-view #inventory-form .form-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
#inventory-view #inventory-form .form-grid small{line-height:1.35;margin-top:3px}
#inventory-view .cart-card{position:sticky;top:18px}
#inventory-view #transfer-section,#inventory-view #operations-tools,#inventory-view #inventory-data-quality{border:1px solid #e0e7e1;border-radius:11px}
#inventory-view .quote-history h3{letter-spacing:.01em}
@media(max-width:1250px){
  #inventory-view .user-head{flex-direction:column}
  #inventory-view .inventory-document-actions{justify-content:flex-start;max-width:none}
  #inventory-view #inventory-form .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  #inventory-view .inventory-document-actions__group{width:100%}
  #inventory-view .inventory-document-actions .button{flex:1 1 165px}
  #inventory-view #inventory-form .form-grid{grid-template-columns:1fr}
  #inventory-view .cart-card{position:static}
}
@media(max-width:760px){
  #reports-view .quote-history,#accounting-view .acc-block{padding:15px}
  #reports-view .period-toolbar,#reports-view #report-extra,#reports-view #customer-sales-ranking{grid-template-columns:1fr}
  #reports-view .period-toolbar .button{width:100%}
  #reports-view .revenue-summary{grid-template-columns:1fr}
  #reports-view .revenue-summary>div{border-right:0;border-bottom:1px solid var(--line)}
  #reports-view #report-extra .quote-history:last-child{grid-column:auto}
  #accounting-view .user-head>.acc-tools{margin-left:0;width:100%}
  #accounting-view .acc-tools input[type="search"]{min-width:0;width:100%}
  #accounting-view .acc-kpis{grid-template-columns:1fr}
}

/* Final application layout audit: one spatial system for every module.  This
   comes last so older compact rules cannot make a page cramped, overlap an
   action, or change a control's visual hierarchy. */
@media screen {
  main{width:100%;max-width:none;padding:clamp(22px,2.4vw,42px) clamp(24px,3.2vw,56px) 48px}
  .topbar,.user-head{align-items:flex-start;gap:16px;flex-wrap:wrap}
  .topbar>div:first-child,.user-head>div:first-child{min-width:0}
  .topbar h1,.user-head h2{margin-bottom:0;line-height:1.2}
  .topbar>.button,.user-head>.button{margin-left:auto}

  .button,.icon-button,.history-action,.text-button,.delivery-slip-button{
    min-height:40px;display:inline-flex;align-items:center;justify-content:center;
    gap:6px;max-width:100%;white-space:normal;text-align:center;overflow-wrap:anywhere
  }
  #add-quote-charge,#add-po-charge,.add-charge-button{
    min-height:40px;padding:8px 14px;
  }
  .icon-button{min-width:40px;padding:0}
  button:disabled,.button:disabled{cursor:not-allowed;opacity:.52}
  :is(input,select,textarea){max-width:100%;min-width:0}
  select{min-height:40px}

  .document-editor-actions,.inventory-document-actions,.history-actions,.payment-print-toolbar,
  .price-history-toolbar,.acc-tools{gap:8px;align-items:center}
  .document-editor-actions>.button{min-width:132px}
  .inventory-document-actions__group{min-height:56px}
  .inventory-document-actions__label{flex:0 0 auto}

  .quote-layout{align-items:start}
  .quote-form,.cart-card,.quote-history,.acc-block{min-width:0}
  .quote-form label,.modal label{min-width:0}
  .form-grid{align-items:start}
  .quote-result,.history-line{min-width:0}
  .quote-result>*,.history-line>*{min-width:0;overflow-wrap:anywhere}
  .history-actions{padding-top:3px}
  .history-actions .history-action,.history-line .text-button,.history-line .delivery-slip-button{min-height:36px}

  .table-card,.approval-table,.document-import-review-table{max-width:100%;overflow:auto}
  .table-card table,.approval-table table{min-width:max-content}
  .table-card th,.table-card td{vertical-align:middle}
  .summary,.acc-kpis,.revenue-summary{min-width:0}
  .summary>div,.acc-kpi,.revenue-summary>div{min-width:0}
}

@media screen and (min-width:851px){
  .sidebar{width:244px}
  .topbar h1{font-size:26px}
  .user-head h2{font-size:23px}
  .quote-layout{gap:18px}
  .quote-form,.cart-card,.quote-history{padding:18px}
  .history-line{grid-template-columns:minmax(128px,.75fr) minmax(220px,1.8fr) minmax(96px,.7fr) minmax(90px,.65fr)}
  #reports-view,#accounting-view,#inventory-view{max-width:none}

  /* Receivable/payable queues are transaction rows, not document cards.
     Keep the invoice, amount and payment controls in one compact line. */
  #payment-view #payment-list .history-line,
  #supplier-payment-view #supplier-payment-list .history-line{
    grid-template-columns:32px minmax(150px,.9fr) minmax(250px,1.35fr) minmax(128px,.7fr) minmax(440px,1.7fr);
    gap:6px 14px;align-items:center;padding:12px 0;
  }
  #payment-view #payment-list .payment-selector,
  #supplier-payment-view #supplier-payment-list .payment-selector{grid-column:1;grid-row:1 / span 2;align-self:center}
  #payment-view #payment-list .history-line>b,
  #supplier-payment-view #supplier-payment-list .history-line>b{grid-column:2;grid-row:1;min-width:0}
  #payment-view #payment-list .history-line>span,
  #supplier-payment-view #supplier-payment-list .history-line>span{grid-column:3;grid-row:1;min-width:0}
  #payment-view #payment-list .history-line>strong,
  #supplier-payment-view #supplier-payment-list .history-line>strong{grid-column:4;grid-row:1;min-width:0;text-align:right}
  #payment-view #payment-list .history-line>small,
  #supplier-payment-view #supplier-payment-list .history-line>small{grid-column:2 / 5!important;grid-row:2;text-align:left!important;margin:0}
  #payment-view #payment-list .history-actions,
  #supplier-payment-view #supplier-payment-list .history-actions{grid-column:5;grid-row:1 / span 2;display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin:0}
  #payment-view #payment-list .history-actions input{width:168px;min-height:40px}
  #payment-view #payment-list .history-actions select{width:136px;min-width:136px;min-height:40px}
}

@media screen and (min-width:1600px){
  #payment-view #payment-list .history-line,
  #supplier-payment-view #supplier-payment-list .history-line{
    grid-template-columns:32px minmax(130px,.65fr) minmax(200px,1fr) minmax(110px,.5fr) minmax(690px,2.6fr);
  }
}

/* Long payment queues scroll inside their own work area so the search, print
   controls and payment history remain reachable without traversing invoices. */
#payment-view #payment-list,#supplier-payment-view #supplier-payment-list{
  max-height:min(62vh,680px);overflow-x:hidden;overflow-y:auto;
  overscroll-behavior:contain;padding-right:6px;
}
#payment-view #payment-list .history-line:first-child,
#supplier-payment-view #supplier-payment-list .history-line:first-child{border-top:0}

/* High-volume work queues use a local, contained scroll area.  This keeps the
   filters, document actions and the next workflow section within reach while
   retaining every row in the DOM for search, selection and audit purposes. */
#inventory-view #inventory-history,
#inventory-view #transfer-history,
#quotation-view #quote-history-list,
#purchase-view #po-history-list,
#pr-view #pr-history,
#contract-view #contract-list,
#sales-view #so-history,
#sales-view #packing-history-list,
#sales-view #delivery-history-list,
#invoice-view #invoice-queue,
#invoice-view #invoice-history-list,
#payment-view #payment-history-list,
#payment-view #customer-credit-list,
#supplier-payment-view #supplier-payment-history-list,
#supplier-payment-view #supplier-credit-list,
#outstanding-view #outstanding-list,
#audit-view #audit-log-list,
#quotation-view #sales-price-results,
#purchase-view #purchase-price-results{
  max-height:min(62vh,680px);
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding-right:6px;
}

/* Price and stock lookups are intentionally shorter: they are reference
   panels inside an editor, not the primary work queue. */
#inventory-view #card-results,
#inventory-view #inv-results,
#inventory-view #transfer-results,
#quotation-view #quote-results,
#purchase-view #po-results,
#pr-view #pr-results{
  max-height:min(42vh,460px);
  overflow-y:auto;
  overscroll-behavior:contain;
  padding-right:4px;
}

@media screen and (max-width:850px){
  main{padding:22px 18px 34px}
  .topbar>.button,.user-head>.button{margin-left:0}
  .document-editor-actions,.inventory-document-actions,.payment-print-toolbar,.acc-tools{width:100%;justify-content:flex-start}
  .document-editor-actions>.button{flex:1 1 156px}
  .inventory-document-actions__group{width:100%}
  .history-line{grid-template-columns:minmax(110px,.8fr) minmax(0,1.5fr) auto}
  .history-line>small{grid-column:2 / -1;text-align:left}
}

@media screen and (max-width:560px){
  .topbar,.user-head{gap:12px}
  .topbar>.button,.user-head>.button,.button-bilingual{width:100%}
  .form-grid,.history-line{grid-template-columns:1fr}
  .history-line>small{grid-column:auto}
  .history-actions .history-action,.history-line .text-button,.history-line .delivery-slip-button{flex:1 1 145px}
  .inventory-document-actions__group{padding:8px}
  .inventory-document-actions__label{width:100%}
}

/* Optional bulk quantity helpers always prefill a reviewable value; saving remains explicit. */
.quantity-fill-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:16px 0 10px;padding:12px 14px;background:#f7f9f7;border:1px solid #dce5d7;border-radius:8px}.quantity-fill-toolbar p{margin:0;color:#5c6870;line-height:1.45;font-size:12px}.quantity-fill-toolbar .button{white-space:nowrap}@media(max-width:620px){.quantity-fill-toolbar{align-items:stretch;flex-direction:column}.quantity-fill-toolbar .button{width:100%}}

/* Reports: clear section hierarchy, stable financial tables, and contained
   long lists so an operational review never becomes a very long page. */
/* A view stays hidden until its sidebar route is active.  Do not let the
   Reports layout declaration make it visible underneath another screen. */
#reports-view.active{display:block}
body:has(#reports-view.active) .topbar #global-search,
body:has(#reports-view.active) .topbar #open-add,
body:has(#accounting-view.active) .topbar #global-search,
body:has(#accounting-view.active) .topbar #open-add{display:none}
#reports-view .report-page-head{margin:14px 0 0;padding:0;border:0;justify-content:flex-end;align-items:flex-end}
#reports-view .report-page-head>div:first-child{display:none}
#reports-view .report-page-head h2{margin:3px 0 5px;font-size:25px;letter-spacing:-.04em}
#reports-view .report-page-head .intro,#reports-view .report-section-head .intro{margin:0;color:#66864a;font-size:11px;font-weight:800;letter-spacing:.06em}
#reports-view .report-page-head .muted{max-width:760px;margin:0;line-height:1.5}
#reports-view .report-window-control{display:grid;gap:7px;justify-items:end}
#reports-view .report-window-control label{display:grid;gap:7px;color:#526057;font-size:12px;font-weight:800}
#reports-view .report-window-control select{min-width:194px;min-height:42px;border-radius:8px;background:#fff}
#reports-view #report-asof{margin:0;text-align:right;font-size:11px;line-height:1.4}
#reports-view #kpi-visual .kpi-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap;margin-bottom:16px}
#reports-view #kpi-visual .kpi-header h3{margin:0}
#reports-view .report-section{display:grid;gap:14px;min-width:0}
#reports-view .report-section-head{display:flex;align-items:end;justify-content:space-between;gap:20px}
#reports-view .report-section-head h2,#reports-view .report-section-head h3{margin:4px 0 0;color:#17212b;letter-spacing:-.025em}
#reports-view .report-section-head h3{font-size:19px}
#reports-view .report-section-head>.muted{max-width:700px;margin:0;text-align:right;line-height:1.5}
#reports-view .report-inventory-overview{padding-top:2px}
#reports-view .quote-history{margin:0;box-shadow:0 7px 22px rgb(23 33 43 / 3%)}
#reports-view .report-sales-period{border-top:3px solid #6f964d}
#reports-view .report-detail-card{padding:18px}
#reports-view .report-detail-card>h3{margin:0 0 10px;padding-bottom:10px;border-bottom:1px solid #e4ebe4}
#reports-view #report-summary{margin:0;grid-template-columns:repeat(5,minmax(0,1fr));border:1px solid #dce5dc;border-radius:12px;overflow:hidden;background:#fff}
#reports-view #report-summary>div{min-height:104px;padding:17px;border-right:1px solid #e4ebe5;background:linear-gradient(145deg,#fff,#fbfcfa)}
#reports-view #report-summary>div:last-child{border-right:0}
#reports-view #report-summary strong{margin:8px 0 5px;font-size:20px;line-height:1.1;font-variant-numeric:tabular-nums}
#reports-view .period-controls{display:grid;gap:10px;padding:13px;border:1px solid #e1e8e1;border-radius:10px;background:#fafcf9}
#reports-view .period-toolbar{padding:0;border:0;background:transparent;margin:0}
#reports-view .period-toolbar .button{min-height:42px;white-space:nowrap}
#reports-view .period-toolbar .button.ghost{background:#fff}
#reports-view #period-description{margin:0!important;padding:8px 10px!important;max-width:none;line-height:1.4}
#reports-view #period-summary{margin:0;border-radius:10px}
#reports-view #period-summary>div{min-height:100px;padding:15px 16px}
#reports-view #period-summary strong{font-size:18px}
#reports-view #period-summary .period-summary-label{display:flex;flex-direction:column;gap:3px;line-height:1.3}
#reports-view #period-summary .period-summary-label span{display:block}
#reports-view #period-results{margin:0;max-height:min(62vh,660px);scrollbar-gutter:stable;overscroll-behavior:contain;background:#fff}
#reports-view #period-results thead th{box-shadow:0 1px 0 #dbe4dc;text-transform:uppercase;letter-spacing:.025em;color:#66736b}
#reports-view #period-results tbody tr:nth-child(even){background:#fbfcfb}
#reports-view #period-results tbody tr:hover{background:#f3f8ef}
#reports-view #period-results td:nth-child(7),#reports-view #period-results td:nth-child(10),#reports-view #period-results td:nth-child(11),#reports-view #period-results td:nth-child(12),#reports-view #period-results td:nth-child(13),#reports-view #period-results td:nth-child(14),#reports-view #period-results td:nth-child(15){text-align:right;font-variant-numeric:tabular-nums;font-weight:700}
#reports-view #slow-moving-report,#reports-view #customer-sales-ranking{max-height:min(48vh,480px);overflow:auto;overscroll-behavior:contain;padding-right:4px}
#reports-view #slow-moving-report .history-line,#reports-view #customer-sales-ranking .history-line{border-bottom:1px solid #e7ece7}
#reports-view #negative-stock-report{border-left:3px solid #c4553d}
#reports-view #negative-stock-results{max-height:min(52vh,540px);overflow:auto;overscroll-behavior:contain}
#reports-view .revenue-report{border-left:3px solid #6f964d}
#reports-view .revenue-report>p.muted{min-height:34px}
@media screen and (max-width:1250px){#reports-view #report-summary{grid-template-columns:repeat(3,minmax(0,1fr))}#reports-view #report-summary>div:nth-child(3n){border-right:0}}
@media screen and (max-width:760px){#reports-view .report-page-head{align-items:flex-start}#reports-view .report-window-control{justify-items:start;width:100%}#reports-view #report-asof{text-align:left}#reports-view .report-section-head{display:grid;gap:8px;align-items:start}#reports-view .report-section-head>.muted{text-align:left}#reports-view #report-summary{grid-template-columns:1fr}#reports-view #report-summary>div{min-height:auto;border-right:0;border-bottom:1px solid #e4ebe5}#reports-view #report-summary>div:last-child{border-bottom:0}}

/* Keep scroll behaviour intentional: one contained vertical surface only
   after the list is genuinely long.  This prevents the awkward blank space
   and misaligned scrollbars that a fixed-height panel causes for short data. */
#reports-view #slow-moving-report,
#reports-view #customer-sales-ranking,
#reports-view #negative-stock-results{
  max-height:none!important;
  overflow:visible!important;
  padding-right:0;
  scrollbar-gutter:auto;
}
#reports-view #slow-moving-report.report-internal-scroll,
#reports-view #customer-sales-ranking.report-internal-scroll,
#reports-view #negative-stock-results.report-internal-scroll{
  max-height:min(58vh,620px)!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain;
  padding-right:5px;
  scrollbar-gutter:stable;
}
#reports-view #period-review{width:min(1800px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);padding:20px;border:1px solid #dce5dc;border-radius:12px;color:var(--ink);box-shadow:0 20px 70px #0b121940}
#reports-view #period-review::backdrop{background:#14202a99}
#reports-view .report-detail-dialog{width:min(1400px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);padding:20px;border:1px solid #dce5dc;border-radius:12px;color:var(--ink);box-shadow:0 20px 70px #0b121940}
#reports-view .report-detail-dialog::backdrop{background:#14202a99}
#reports-view .report-review-open{min-height:42px;padding-inline:20px;border:1px solid #587443}
#reports-view .report-detail-dialog #customer-sales-ranking,
#reports-view .report-detail-dialog #negative-stock-results{margin-top:16px;max-height:calc(100dvh - 150px);overflow:auto}
#reports-view .report-detail-dialog .report-review-list{margin-top:16px;max-height:calc(100dvh - 150px);overflow:auto;overscroll-behavior:contain}
#reports-view #period-history-dialog{width:min(760px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);padding:20px;border:1px solid #dce5dc;border-radius:12px;color:var(--ink);box-shadow:0 20px 70px #0b121940}
#reports-view #period-history-dialog::backdrop{background:#14202a99}
#reports-view #period-history{max-height:calc(100dvh - 150px);overflow:auto;margin-top:16px}
#reports-view #period-history p{padding:10px 0;margin:0;border-bottom:1px solid #e7ece7;line-height:1.5}
#reports-view #period-history-open{justify-self:start}
#reports-view .period-review-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
#reports-view .period-review-head h2{margin:0}
#reports-view .period-review-context{margin:8px 0 12px;color:#63716b}
#reports-view #period-results,#reports-view #period-results.report-internal-scroll{max-height:calc(100dvh - 165px)!important;overflow:auto!important;overscroll-behavior:contain}
#reports-view #negative-stock-results{border:1px solid #f0dfda;border-radius:9px}
#reports-view #negative-stock-results table{width:100%;min-width:0;table-layout:fixed}
#reports-view #negative-stock-results th,#reports-view #negative-stock-results td{white-space:normal;overflow-wrap:anywhere;word-break:break-word}
#reports-view #negative-stock-results th:nth-child(1){width:13%}
#reports-view #negative-stock-results th:nth-child(2){width:18%}
#reports-view #negative-stock-results th:nth-child(3){width:16%}
#reports-view #negative-stock-results th:nth-child(4){width:11%}
#reports-view #negative-stock-results th:nth-child(5){width:14%}
#reports-view #negative-stock-results th:nth-child(6){width:14%}
#reports-view #negative-stock-results th:nth-child(7){width:14%}

/* Inventory is a workbench, not a single long document.  On a desktop the
   three high-volume areas sit beside one another and each keeps its own
   contained vertical scroll.  The existing fields, IDs and transaction
   handlers remain exactly as they are; this only changes presentation. */
@media screen and (min-width:1280px) and (min-height:700px){
  #inventory-view.active{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    align-items:start;
    gap:16px;
    padding-bottom:28px;
  }
  #inventory-view .user-head,
  #inventory-view .quote-layout{
    grid-column:1 / -1;
    margin:0;
  }
  #inventory-view .user-head{margin-bottom:2px}
  #inventory-view .quote-layout{min-width:0}
  #inventory-view #transfer-section,
  #inventory-view .quote-history:has(#stock-card-result),
  #inventory-view .quote-history:has(#inventory-history){
    display:flex;
    flex-direction:column;
    min-width:0;
    min-height:0;
    height:min(46dvh,500px);
    margin:0;
    overflow:hidden;
    box-shadow:0 7px 22px rgb(23 33 43 / 3%);
  }
  #inventory-view #transfer-section{grid-column:1}
  #inventory-view .quote-history:has(#stock-card-result){grid-column:2}
  #inventory-view .quote-history:has(#inventory-history){grid-column:3}
  #inventory-view #transfer-history,
  #inventory-view #stock-card-result,
  #inventory-view #inventory-history{
    flex:1 1 auto;
    min-height:88px;
    max-height:none;
    overflow:auto;
    overscroll-behavior:contain;
    padding-right:5px;
    scrollbar-gutter:stable;
  }
  #inventory-view #transfer-history{margin-top:12px}
  #inventory-view #stock-card-result{margin-top:12px}
  #inventory-view #inventory-history{margin-top:2px}
  #inventory-view #operations-tools,
  #inventory-view #inventory-data-quality{
    grid-column:1 / -1;
    margin:0;
  }
}

/* Keep tablet and mobile behaviour naturally flowing.  Their existing list
   scroll areas remain available without forcing a cramped multi-column view. */
@media screen and (max-width:1099px){
  #inventory-view #transfer-section,
  #inventory-view .quote-history:has(#stock-card-result),
  #inventory-view .quote-history:has(#inventory-history){
    min-width:0;
  }
}

/* A medium desktop has less usable width after the permanent sidebar.  Use
   two contained panels instead of squeezing three narrow columns.  On a
   short display (or at high browser zoom), the normal flowing layout wins so
   every form field remains reachable. */
@media screen and (min-width:1100px) and (max-width:1279px) and (min-height:860px){
  #inventory-view.active{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:start;
    gap:16px;
    padding-bottom:28px;
  }
  #inventory-view .user-head,
  #inventory-view .quote-layout{grid-column:1 / -1;margin:0}
  #inventory-view .user-head{margin-bottom:2px}
  #inventory-view #transfer-section,
  #inventory-view .quote-history:has(#stock-card-result),
  #inventory-view .quote-history:has(#inventory-history){
    display:flex;
    flex-direction:column;
    min-width:0;
    min-height:0;
    margin:0;
    overflow:hidden;
    box-shadow:0 7px 22px rgb(23 33 43 / 3%);
  }
  #inventory-view #transfer-section,
  #inventory-view .quote-history:has(#stock-card-result){height:min(38dvh,410px)}
  #inventory-view .quote-history:has(#inventory-history){grid-column:1 / -1;height:min(31dvh,310px)}
  #inventory-view #transfer-history,
  #inventory-view #stock-card-result,
  #inventory-view #inventory-history{
    flex:1 1 auto;
    min-height:82px;
    max-height:none;
    overflow:auto;
    overscroll-behavior:contain;
    padding-right:5px;
    scrollbar-gutter:stable;
  }
  #inventory-view #operations-tools,
  #inventory-view #inventory-data-quality{grid-column:1 / -1;margin:0}
}

/* Main Inventory is the catalogue work area.  Keep its controls visible and
   place the high-volume item table in the remaining window height.  This is
   deliberately presentation-only: filtering, paging, export and selection
   continue to use their original elements and handlers. */
@media screen and (min-width:1100px) and (min-height:700px){
  #catalog-view.active{
    display:grid;
    grid-template-rows:auto auto minmax(0,1fr) auto;
    gap:12px;
    height:calc(100dvh - 128px);
    min-height:520px;
    overflow:hidden;
  }
  #catalog-view .summary,
  #catalog-view .inventory-toolbar,
  #catalog-view .table-card,
  #catalog-view .result-note{margin:0}
  #catalog-view .table-card{
    min-height:0;
    height:100%;
    overflow:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
  #catalog-view .table-card thead th{
    position:sticky;
    top:0;
    z-index:2;
    box-shadow:0 1px 0 #dbe4dc;
  }
  #catalog-view .result-note{
    min-height:16px;
    line-height:1.35;
  }
}

/* Period headers are descriptive and bilingual.  Do not split a word into a
   vertical column when the report table is contained in its panel. */
#reports-view #period-results th{
  overflow-wrap:normal;
  word-break:normal;
  hyphens:none;
  font-size:9px;
}

/* Give report controls a consistent size, with fewer columns on smaller screens. */
#reports-view .period-controls>.period-toolbar{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  align-items:end;
  gap:10px;
}
#reports-view .period-controls>.period-toolbar label{display:grid;gap:6px;min-width:0}
#reports-view .period-controls>.period-toolbar input,
#reports-view .period-controls>.period-toolbar select,
#reports-view .period-controls>.period-toolbar .button{
  box-sizing:border-box;
  width:100%;
  height:48px;
  min-height:48px;
  border:1px solid #587443;
  border-radius:7px;
}
#reports-view .period-controls>.period-toolbar .button{
  min-width:0;
  padding:4px 8px;
  white-space:normal;
  line-height:1.2;
}
#reports-view .period-controls>.period-toolbar .button:not(:disabled):hover{border-color:#8fbf45}
#reports-view .period-controls>.period-toolbar input:not(:focus),
#reports-view .period-controls>.period-toolbar select:not(:focus){border-color:#587443!important}
@media screen and (max-width:1400px){
  #reports-view .period-controls>.period-toolbar{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media screen and (max-width:760px){
  #reports-view .period-controls>.period-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}
}
