/* v0.67: complete amendment pass — landscape records, readable commercial cards and editable document templates. */
:root{--panel-blue:#eef5f8;--panel-green:#eef8f1;--panel-grey:#f3f5f6;--panel-warm:#faf7ef}

/* Supplier invoice / credit record. The default desktop view must not create a second scrollbar. */
@media(min-width:1101px){
  #detailDialog:has(.invoice-record-shell){width:min(1280px,calc(100vw - 20px))!important;height:calc(100vh - 16px);max-height:calc(100vh - 16px)!important;zoom:1!important}
  #detailDialog #detailContent.invoice-record-shell{height:100%;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:.4rem;overflow:hidden!important;padding:.55rem .7rem}
  .invoice-record-grid{grid-template-columns:minmax(0,.94fr) minmax(0,.9fr) minmax(0,1.34fr);grid-template-areas:"document values preview" "po audit preview" "workflow related coding";grid-template-rows:auto auto minmax(0,1fr);overflow:hidden!important;gap:.42rem;align-content:stretch}
  .invoice-record-section{overflow:hidden;padding:.48rem .58rem;border-radius:10px}
  .invoice-record-document,.invoice-record-po{background:var(--panel-blue)}
  .invoice-record-values,.invoice-record-coding{background:var(--panel-green)}
  .invoice-record-workflow,.invoice-record-audit{background:var(--panel-grey)}
  .invoice-record-related{background:var(--panel-warm)}
  .invoice-record-preview{background:#fff}
  .invoice-record-workflow,.invoice-record-related,.invoice-record-coding{align-self:stretch}
  .invoice-record-preview{min-height:0}.invoice-document-frame{margin-top:.3rem}
  .invoice-record-recent-audit{max-height:none;overflow:hidden}
  .record-workflow-actions{gap:.25rem}.record-workflow-approve button{white-space:nowrap;min-width:76px}
  .invoice-record-notes textarea{resize:none;min-height:56px;max-height:82px}
}
.invoice-preview-heading>span:first-child{min-width:0}.invoice-preview-heading h3,.invoice-preview-heading small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.invoice-preview-actions{display:flex;gap:.3rem;flex:0 0 auto}

/* Upload record — same landscape visual language as the record view, with no step tabs. */
@media(min-width:900px){
  #uploadDialog{width:min(1280px,calc(100vw - 20px))!important;height:calc(100vh - 16px);max-height:calc(100vh - 16px)!important;zoom:1!important}
  #uploadDialog>form.upload-landscape-form{grid-template-rows:auto minmax(0,1fr) auto auto;padding:.55rem .7rem;gap:.35rem}
  .upload-landscape-grid{display:grid!important;grid-template-columns:minmax(0,.8fr) minmax(0,.8fr) minmax(280px,.95fr) minmax(350px,1.25fr);grid-template-areas:"coding supplier approval preview" "coding values approval preview";grid-template-rows:minmax(0,.45fr) minmax(0,.55fr);gap:.42rem;min-height:0;overflow:hidden!important}
  .upload-record-section{min-width:0;min-height:0;padding:.45rem .55rem;border:1px solid var(--line);border-radius:10px;overflow:hidden}
  .upload-record-section>h3{margin:0 0 .35rem;font-size:.82rem}.upload-section-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.28rem .42rem;align-content:start}.upload-section-fields>.full,.upload-section-fields>section,.upload-section-fields>div{grid-column:1/-1}
  .upload-section-fields label{font-size:.67rem;gap:.1rem;margin:0}.upload-section-fields input,.upload-section-fields select,.upload-section-fields textarea{min-height:28px;padding:.24rem .36rem;font-size:.7rem}.upload-section-fields textarea{min-height:34px;max-height:45px;resize:none}
  .upload-supplier-section{grid-area:supplier;background:var(--panel-blue)}.upload-coding-section{grid-area:coding;background:var(--panel-grey)}.upload-values-section{grid-area:values;background:var(--panel-green)}.upload-approval-section{grid-area:approval;background:var(--panel-warm)}.upload-preview-section{grid-area:preview;display:grid;grid-template-rows:auto minmax(0,1fr);background:#fff}
  .upload-approval-section .upload-section-fields{grid-template-columns:repeat(4,minmax(0,1fr))}
  #uploadDocumentPreview{min-height:0;display:grid;place-items:center;border:1px dashed var(--line);border-radius:8px;background:#f6f8f9;color:var(--muted);overflow:hidden}#uploadDocumentPreview iframe,#uploadDocumentPreview img{width:100%;height:100%;object-fit:contain;border:0}
  #uploadDialog .credit-allocation-panel{padding:.25rem .35rem}#uploadDialog .confidential-record-control small,#uploadDialog label small{display:none}
  #uploadDialog .dialog-actions{margin:0;padding:.35rem 0 0;position:static}
}

/* Sales editor. Service and product invoices use one page, not separate forms. */
.sales-document-workspace form.sales-document-form-v067{width:min(1280px,calc(100% - 24px));padding:14px 16px 70px}
.sales-type-toolbar{display:flex;align-items:center;gap:14px;padding:8px 10px;margin-bottom:10px;border:1px solid #cbd8de;border-radius:10px;background:#f2f6f7}.sales-type-toolbar>span{display:grid}.sales-type-toolbar small{color:var(--muted)}.segmented-control{display:flex}.segmented-control button{border-radius:0;background:#fff;color:#17324a}.segmented-control button:first-child{border-radius:8px 0 0 8px}.segmented-control button:last-child{border-radius:0 8px 8px 0}.segmented-control button.active{background:#167e45;color:#fff}.sales-pdf-columns{margin-left:auto}
.sales-landscape-grid{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(240px,.65fr) minmax(320px,.9fr);grid-template-areas:"customer coding preview" "lines lines lines";gap:10px}.sales-editor-panel{min-width:0;border:1px solid #cfdbdf;border-radius:10px;padding:11px;background:#fff}.sales-editor-panel>h3{margin:0 0 8px}.sales-customer-panel{grid-area:customer;background:var(--panel-blue)}.sales-coding-panel{grid-area:coding;background:var(--panel-green)}.sales-preview-panel{grid-area:preview;display:grid;grid-template-rows:auto minmax(170px,1fr);background:#f7f9fa}.sales-lines-fieldset{grid-area:lines;background:#fff}.sales-preview-panel iframe{width:100%;height:100%;min-height:260px;border:1px solid #cbd8de;border-radius:8px}.sales-preview-empty{display:grid;place-content:center;text-align:center;color:var(--muted)}.sales-preview-empty small{display:block}
.sales-lines-table th:first-child{width:auto}.sales-lines-table .product-column,.sales-line-product{display:none}.product-invoice .sales-lines-table .product-column,.product-invoice .sales-line-product{display:table-cell}.product-invoice .sales-lines-table th.product-column{width:14%}.sales-lines-table textarea{width:100%;min-height:28px;border:0;border-top:1px dashed #d6dfe3;border-radius:0;padding:6px;resize:vertical}.sales-lines-table select{max-width:100%}

/* Projects and customer batch controls. */
.project-overview-list{max-width:100%;overflow:hidden}.project-overview-row{box-sizing:border-box;width:100%;min-width:0;color:#17324a!important}.project-overview-row>span{min-width:0}.project-overview-row>span>small{color:#62737c!important}.project-overview-row>span>strong{display:block;color:#102c43!important;font-size:.92rem;font-variant-numeric:tabular-nums}.project-overview-row>span:not(:first-child)>strong{margin-top:.2rem;color:#116738!important}.project-metric button{display:grid!important;gap:.35rem;width:100%;color:#17324a!important}.project-metric button small{display:block;color:#60727b}.project-metric button strong{display:block;color:#102c43;font-size:1rem;font-variant-numeric:tabular-nums;white-space:nowrap}
.customer-batch-toolbar{display:flex;align-items:end;gap:.45rem;flex-wrap:wrap;margin:.6rem 0;padding:.6rem;border:1px solid #bcd8c7;border-radius:9px;background:#f1f8f3}.customer-batch-toolbar label{margin:0;min-width:170px}.customer-batch-check{align-self:center;margin:0 .35rem 0 0}.customer-batch-check input{width:18px;height:18px}.customer-ledger-account summary{grid-template-columns:auto minmax(0,1fr) auto auto!important}

/* Organisation document wording and product catalogue. */
.document-template-layout{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr);gap:14px}.document-template-preview{position:sticky;top:8px;align-self:start;display:grid;gap:10px;padding:15px;border:1px solid #cbd7dd;border-radius:10px;background:#fff;box-shadow:0 6px 18px #17324a12}.document-template-preview div{padding:8px;border:1px solid #dce4e8;border-radius:7px;background:#f7f9fa}.document-template-preview p{white-space:pre-line;margin:.25rem 0 0;font-size:.76rem}.sales-product-settings{display:grid;gap:7px}.sales-product-setting{display:grid;grid-template-columns:.7fr 1fr 1.8fr .7fr .55fr 1.2fr auto auto;gap:7px;align-items:end;padding:8px;border:1px solid #d5e0e4;border-radius:8px;background:#f8faf9}.sales-product-setting label{margin:0;font-size:.72rem}.sales-product-setting input,.sales-product-setting select{min-width:0;padding:.42rem}.product-settings-head{display:flex;justify-content:flex-end;margin-bottom:8px}

@media(max-width:1100px){.sales-landscape-grid{grid-template-columns:1fr 1fr;grid-template-areas:"customer coding" "preview preview" "lines lines"}.document-template-layout{grid-template-columns:1fr}.sales-product-setting{grid-template-columns:repeat(2,minmax(0,1fr))}.product-description{grid-column:span 2}}
@media(max-width:700px){.sales-landscape-grid{grid-template-columns:1fr;grid-template-areas:"customer" "coding" "preview" "lines"}.sales-type-toolbar{align-items:stretch;flex-direction:column}.sales-pdf-columns{margin-left:0}.project-overview-row{grid-template-columns:1fr 1fr}.customer-ledger-account summary{grid-template-columns:auto 1fr!important}}
