/* v0.68: corrective release — readable document workspaces, durable scrolling and document-specific wording. */
:root{--v068-navy:#153a59;--v068-blue:#147fbd;--v068-green:#188a49;--v068-line:#cbd8de;--v068-wash:#f5f8f9}

/* Supplier invoice and credit records: keep audit beside the core facts, with notes immediately below it. */
#detailDialog:has(> .invoice-record-shell){width:min(1440px,calc(100vw - 18px))!important;height:min(960px,calc(100vh - 14px))!important;max-height:calc(100vh - 14px)!important;overflow:hidden!important}
#detailDialog>#detailContent.invoice-record-shell{box-sizing:border-box;display:block!important;height:100%!important;max-height:none!important;padding:.75rem .85rem!important;overflow:auto!important;scrollbar-gutter:stable;scroll-padding-block:1rem 5rem}
.invoice-record-grid{height:auto!important;min-height:max-content!important;margin:.65rem 0;grid-template-columns:minmax(270px,.92fr) minmax(310px,1fr) minmax(410px,1.35fr)!important;grid-template-areas:"document values preview" "po audit preview" "workflow audit coding" "workflow related coding"!important;grid-template-rows:auto auto auto auto!important;align-content:start!important;overflow:visible!important;gap:.65rem!important}
.invoice-record-section{min-height:auto!important;padding:.7rem .78rem!important;border-radius:11px!important;overflow:visible!important;font-size:.82rem!important}
.invoice-record-section>h3,.invoice-record-section-heading h3,.invoice-record-related-section h3{font-size:.92rem!important;line-height:1.25!important;margin-bottom:.45rem!important}
.invoice-record-facts dt{font-size:.69rem!important;line-height:1.25!important}.invoice-record-facts dd{font-size:.8rem!important;line-height:1.32!important}
.invoice-record-preview{min-height:500px}.invoice-document-frame{min-height:430px}.invoice-record-recent-audit{max-height:none!important;overflow:visible!important}.invoice-record-notes textarea{min-height:78px!important;max-height:none!important;resize:vertical!important}
.workflow-action-disclosure[open],.compact-record-disclosure[open]{position:relative;z-index:2}.project-editor{max-width:100%}
.invoice-record-footer{position:static!important;z-index:auto!important;padding:.65rem 0 .2rem!important;background:#fff}
.allocated-credit-notes{margin-top:.65rem;padding-top:.65rem;border-top:1px solid var(--v068-line)}.allocated-credit-notes h4{margin:0 0 .45rem;font-size:.78rem}.allocated-credit-note-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:.4rem}.allocated-credit-note{display:flex;align-items:center;justify-content:space-between;gap:.65rem;min-width:0;padding:.5rem .6rem!important;color:var(--ink)!important;text-align:left;background:#fff!important;border:1px solid #b7d9c4!important;border-radius:8px!important}.allocated-credit-note span{min-width:0;overflow-wrap:anywhere}.allocated-credit-note strong{white-space:nowrap;color:var(--v068-navy)}

/* Upload invoice: legible labels and controls, with the form itself remaining scrollable at every height. */
#uploadDialog{width:min(1480px,calc(100vw - 18px))!important;height:min(960px,calc(100vh - 14px))!important;max-height:calc(100vh - 14px)!important;overflow:hidden!important}
#uploadDialog>form.upload-landscape-form{box-sizing:border-box;display:block!important;height:100%;max-height:none!important;padding:.72rem .85rem!important;overflow:auto!important;scrollbar-gutter:stable;scroll-padding-block:1rem 5rem}
.upload-landscape-grid{height:auto!important;min-height:max-content!important;margin:.55rem 0;grid-template-columns:minmax(245px,.85fr) minmax(245px,.85fr) minmax(300px,1fr) minmax(390px,1.28fr)!important;grid-template-rows:auto auto!important;gap:.65rem!important;align-content:start;overflow:visible!important}
.upload-record-section{padding:.65rem .7rem!important;overflow:visible!important}.upload-record-section>h3{font-size:.88rem!important;margin:0 0 .48rem!important}.upload-section-fields{gap:.48rem .55rem!important}.upload-approval-section .upload-section-fields{grid-template-columns:repeat(2,minmax(125px,1fr))!important}
.upload-section-fields label{font-size:.76rem!important;line-height:1.25!important;gap:.2rem!important}.upload-section-fields input,.upload-section-fields select,.upload-section-fields textarea{min-height:36px!important;padding:.42rem .5rem!important;font-size:.78rem!important}.upload-section-fields textarea{min-height:58px!important;max-height:none!important;resize:vertical!important}
#uploadDocumentPreview{min-height:520px!important}.upload-preview-section{min-height:600px}.upload-preview-section .invoice-record-section-heading{gap:.5rem}

/* Sales document editor: give line items a real working surface and make the PDF choice unmistakably per document. */
.sales-document-workspace form.sales-document-form-v068{box-sizing:border-box;width:min(1480px,calc(100% - 24px));margin:14px auto;padding:16px 18px 82px;background:#fff;box-shadow:0 8px 24px #1d35422a;position:relative}
.sales-type-toolbar{gap:16px;padding:11px 13px}.sales-type-toolbar>span:first-child{min-width:190px}.sales-pdf-columns{display:grid!important;grid-template-columns:auto minmax(210px,310px);align-items:center;gap:0 .65rem;margin-left:auto!important;padding:.5rem .65rem;border:1px solid #b7dac5;border-radius:9px;background:#f4faf6}.sales-pdf-columns input{grid-row:1/3;width:18px;height:18px;margin:0}.sales-pdf-columns span{font-size:.78rem;font-weight:800}.sales-pdf-columns small{font-size:.68rem;line-height:1.25}
.sales-landscape-grid{grid-template-columns:minmax(390px,1.05fr) minmax(280px,.72fr) minmax(390px,1fr)!important;gap:12px!important}.sales-editor-panel{padding:13px!important}.sales-lines-fieldset{min-width:0;padding:13px!important}.sales-lines-table-wrap{width:100%;max-width:100%;overflow-x:auto!important;border:1px solid var(--v068-line);border-radius:8px}.sales-lines-table{width:100%!important;min-width:1120px!important;table-layout:fixed!important}.sales-lines-table th{box-sizing:border-box;padding:9px 7px!important;white-space:normal;line-height:1.2}.sales-lines-table th:nth-last-child(1){width:46px!important}.sales-lines-table th:nth-last-child(2){width:13%!important}.sales-lines-table th:nth-last-child(3){width:9%!important}.sales-lines-table th:nth-last-child(4){width:15%!important}.sales-lines-table th:nth-last-child(5){width:8%!important}.sales-lines-table th:nth-last-child(6){width:12%!important}.sales-lines-table th:nth-last-child(7){width:9%!important}.sales-lines-table th:nth-last-child(8){width:34%!important}.product-invoice .sales-lines-table{min-width:1260px!important}.product-invoice .sales-lines-table th.product-column{width:15%!important}.sales-lines-table td{vertical-align:top}.sales-lines-table input,.sales-lines-table select{min-height:42px!important;padding:8px!important}.sales-lines-table textarea{min-height:42px!important;padding:8px!important}.sales-line-net{padding:13px 9px!important;white-space:nowrap}.sales-lines-table .icon-button{margin:4px auto}.sales-document-footer{display:flex;align-items:end;gap:.55rem;padding:10px 18px!important}.sales-document-footer #salesDocumentTotals{display:grid;grid-template-columns:repeat(4,minmax(100px,auto));gap:1rem;margin-right:auto}.sales-document-footer #salesDocumentTotals span{display:grid;font-size:.68rem}.sales-document-footer #salesDocumentTotals strong{font-size:.88rem}

/* Accommodation workbook: preserve a useful spreadsheet width and scroll instead of crushing columns. */
.accommodation-entry-help{margin:0 0 .55rem;padding:.55rem .7rem;border:1px solid #b9d9c5;border-left:4px solid var(--v068-green);border-radius:7px;background:#f1f8f3;color:#324b40}.accommodation-entry-help strong{display:block;margin-bottom:.12rem;color:#174a32}.accommodation-register-fit,.accommodation-workbook{max-width:100%;overflow:auto!important;scrollbar-gutter:stable}.accommodation-register-fit table,.accommodation-register-table{width:max-content!important;min-width:1420px!important;table-layout:auto!important}.accommodation-register-table th,.accommodation-register-table td{box-sizing:border-box;overflow:visible!important;text-overflow:clip!important;white-space:normal!important}.accommodation-register-table th:nth-child(1),.accommodation-register-table td:nth-child(1){min-width:42px}.accommodation-register-table th:nth-child(2),.accommodation-register-table td:nth-child(2){min-width:105px}.accommodation-register-table th:nth-child(3),.accommodation-register-table td:nth-child(3){min-width:155px}.accommodation-register-table th:nth-child(4),.accommodation-register-table td:nth-child(4){min-width:145px}.accommodation-register-table th:nth-child(7),.accommodation-register-table td:nth-child(7){min-width:150px}.accommodation-register-table th:nth-child(8),.accommodation-register-table td:nth-child(8),.accommodation-register-table th:nth-child(9),.accommodation-register-table td:nth-child(9){min-width:135px}.accommodation-register-table th:nth-child(11),.accommodation-register-table td:nth-child(11){min-width:130px}.accommodation-register-table th:nth-child(12),.accommodation-register-table td:nth-child(12){min-width:120px}.accommodation-register-table th:nth-child(13),.accommodation-register-table td:nth-child(13){min-width:110px}.accommodation-register-table th:nth-child(15),.accommodation-register-table td:nth-child(15){min-width:145px}.accommodation-register-table input,.accommodation-register-table select{box-sizing:border-box;min-width:110px!important;width:100%!important;background:#fff!important;border-color:#91c9a8!important}.accommodation-register-table .accommodation-draft-row td{vertical-align:top;background:#edf8f1}

/* Stage workbook loading and errors remain visible while a project is selected automatically. */
.stage-workbook-loading{display:grid;place-content:center;min-height:280px;padding:2rem;text-align:center;border:1px solid var(--v068-line);border-radius:12px;background:linear-gradient(135deg,#f4f8f6,#fff)}.stage-workbook-loading:before{content:"";justify-self:center;width:30px;height:30px;margin-bottom:.75rem;border:3px solid #cfe1d6;border-top-color:var(--v068-green);border-radius:50%;animation:v068-spin .8s linear infinite}.stage-workbook-loading p{margin:.3rem 0 0;color:var(--muted)}@keyframes v068-spin{to{transform:rotate(360deg)}}

/* Document wording is selected and saved independently for each output type. */
.document-template-intro{max-width:760px}.document-template-tabs{display:flex;flex-wrap:wrap;gap:.35rem;margin:.75rem 0 1rem;padding:.3rem;border:1px solid var(--v068-line);border-radius:10px;background:var(--v068-wash)}.document-template-tabs button{color:var(--v068-navy);background:transparent;border-color:transparent}.document-template-tabs button.active{color:#fff;background:var(--v068-green);border-color:var(--v068-green)}.document-template-pane{padding:.8rem;border:1px solid #d7e1e5;border-radius:10px;background:#fbfcfc}.document-template-pane textarea{resize:vertical}.document-template-actions{display:flex;justify-content:flex-start;margin-top:.75rem}.document-template-preview{border-top:4px solid var(--v068-blue)}

/* Purchase-order editor: header and editable rows share exactly the same seven-column grid. */
.po-document-lines{overflow-x:auto}.po-document-line-head,.po-line-row,.po-line-row.fixed-line,.po-line-row.note-line,.po-line-row.rate-line{box-sizing:border-box;grid-template-columns:34px 78px 82px minmax(360px,1fr) 118px 118px 38px!important;min-width:900px}.po-document-line-head{align-items:center}.po-reorder-heading{display:block}.po-line-drag{align-self:stretch;display:grid;place-items:center;min-width:34px;padding:0;border-radius:0;background:#edf2f4;color:#60737d}.po-line-row{align-items:stretch}.po-line-row label{margin:0}.po-line-row input,.po-line-row textarea{box-sizing:border-box;width:100%;height:100%;min-height:52px!important}.po-line-total{display:grid;place-items:center end;padding:.55rem .65rem;font-weight:800;white-space:nowrap}.po-document-totals{width:min(330px,100%);margin:0 0 0 auto;border:1px solid #9fb1ba;border-top:0}.po-document-totals>div{display:grid;grid-template-columns:1fr 125px;min-height:39px;border-top:1px solid #9fb1ba}.po-document-totals span,.po-document-totals strong{display:flex;align-items:center;justify-content:flex-end;padding:.5rem .65rem}.po-document-totals strong{border-left:1px solid #9fb1ba}.po-document-totals>div:last-child{color:#075e9a;background:#eef6fb;font-size:1rem}

/* Purchase-order record: stronger hierarchy, useful facts and a proper lines/totals table. */
.purchase-order-record-dialog{width:min(1080px,calc(100vw - 20px))!important;border-radius:15px}.purchase-order-record-dialog>.dialog-heading{padding:1rem 1.2rem!important;background:linear-gradient(135deg,#f1f8f4,#fff)}#purchaseOrderRecordBody{gap:.85rem!important;padding:1rem 1.2rem 1.2rem!important}.po-record-summary{grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:.55rem!important}.po-record-summary>div{padding:.72rem .78rem!important;border-top:3px solid #a9c9b5!important;background:#f8faf9!important}.po-record-summary strong{font-size:.92rem;overflow-wrap:anywhere}.po-record-information{display:grid;grid-template-columns:1.2fr .8fr;gap:.7rem}.po-record-information>article,.po-record-lines,.po-record-action-panel{padding:.85rem .95rem;border:1px solid var(--v068-line);border-radius:11px;background:#fff}.po-record-information h3,.po-record-lines h3,.po-record-action-panel h3{margin:0 0 .6rem}.po-record-information p{margin:.35rem 0;line-height:1.45}.po-record-facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem}.po-record-lines .dashboard-table-wrap{overflow:auto;border:1px solid var(--v068-line);border-radius:8px}.po-record-lines table{min-width:720px}.po-record-lines th,.po-record-lines td{padding:.62rem .7rem}.po-record-lines thead th{color:#fff;background:var(--v068-navy)}.po-record-lines tfoot th,.po-record-lines tfoot td{background:#f3f7f8}.po-record-lines tfoot tr:last-child th,.po-record-lines tfoot tr:last-child td{color:#075e9a;border-top:2px solid var(--v068-blue);background:#eef6fb}.po-record-note-line td:nth-child(3){font-style:italic}.po-record-action-panel{background:#f7faf9!important}

@media(max-width:1180px){.invoice-record-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-areas:"document values" "preview preview" "po audit" "workflow audit" "coding coding" "related related"!important}.invoice-record-preview{min-height:460px}.upload-landscape-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-areas:"coding supplier" "values approval" "preview preview"!important}.upload-preview-section{min-height:520px}.sales-landscape-grid{grid-template-columns:1fr 1fr!important;grid-template-areas:"customer coding" "preview preview" "lines lines"!important}.sales-preview-panel{min-height:430px}.po-record-summary{grid-template-columns:repeat(3,minmax(0,1fr))!important}}
@media(max-width:760px){#detailDialog:has(> .invoice-record-shell),#uploadDialog{width:calc(100vw - 8px)!important;height:calc(100vh - 8px)!important;max-height:calc(100vh - 8px)!important}.invoice-record-grid{grid-template-columns:1fr!important;grid-template-areas:"document" "values" "preview" "po" "audit" "workflow" "coding" "related"!important}.upload-landscape-grid{display:grid!important;grid-template-columns:1fr!important;grid-template-areas:"coding" "supplier" "values" "approval" "preview"!important}.upload-preview-section{min-height:420px}.sales-document-workspace form.sales-document-form-v068{width:100%;margin:0;padding:12px 12px 110px}.sales-type-toolbar{align-items:stretch;flex-direction:column}.sales-pdf-columns{margin-left:0!important;grid-template-columns:auto 1fr}.sales-landscape-grid{grid-template-columns:1fr!important;grid-template-areas:"customer" "coding" "preview" "lines"!important}.sales-document-footer{align-items:stretch;flex-wrap:wrap}.sales-document-footer #salesDocumentTotals{grid-template-columns:repeat(2,1fr);width:100%}.document-template-layout,.po-record-information{grid-template-columns:1fr}.po-record-summary{grid-template-columns:1fr 1fr!important}}
