:root{--v077-navy:#163650;--v077-green:#219653;--v077-red:#b53d49;--v077-blue:#476b8d;--v077-line:#d4e1dc;--v077-wash:#f5f9f7}

/* A dialog is never laid out until the browser has opened it. */
dialog:not([open]){display:none!important}
.global-search-dialog[open]{display:flex;flex-direction:column}
.global-search-dialog{display:none}
.global-search-dialog::backdrop{background:rgba(16,38,53,.28)}

.active-search-chip{display:inline-flex;align-items:center;gap:.45rem;max-width:min(680px,100%);margin:.45rem 0 0;padding:.35rem .45rem .35rem .7rem;border:1px solid #b9d7c5;border-radius:999px;background:#edf8f1;color:var(--v077-navy);font-size:.78rem;font-weight:700}
.active-search-chip span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.active-search-chip button{min-height:27px;padding:.1rem .45rem;border-radius:999px}

.sortable-heading{cursor:pointer;user-select:none}.sortable-heading::after{content:"↕";margin-left:.35rem;color:currentColor;opacity:.48;font-size:.78em}.sortable-heading[aria-sort="ascending"]::after{content:"↑";opacity:1}.sortable-heading[aria-sort="descending"]::after{content:"↓";opacity:1}.sortable-heading:focus-visible{outline:2px solid var(--v077-green);outline-offset:-2px}
.invoice-list-sort-head{display:grid;grid-template-columns:minmax(240px,1.4fr) minmax(170px,.8fr) minmax(210px,1fr) minmax(170px,.8fr) 130px;gap:0;margin:0 .35rem;border:1px solid #d3dfe3;border-radius:9px 9px 0 0;background:#f1f5f4}.invoice-list-sort-head button,.sales-ledger-head [data-list-sort],.request-list-head [data-list-sort]{position:relative;padding:.58rem .72rem;border:0;border-left:1px solid #dce5e1;border-radius:0;background:transparent;color:#526b78;font-size:.68rem;font-weight:800;letter-spacing:.04em;text-align:left;text-transform:uppercase;cursor:pointer}.invoice-list-sort-head button:first-child{border-left:0}.invoice-list-sort-head button::after,.sales-ledger-head [data-list-sort]::after,.request-list-head [data-list-sort]::after{content:"↕";float:right;opacity:.55}.invoice-list-sort-head button:hover,.sales-ledger-head [data-list-sort]:hover,.request-list-head [data-list-sort]:hover{background:#e6f1eb;color:#173d2b}

.status.sales-status-issued,.status.status-issued{display:inline-flex;align-items:center;justify-content:center;min-width:112px;padding:6px 12px;border-radius:999px;background:#e3edf4!important;color:#264760!important;box-shadow:none!important;font-weight:800}
.sales-ledger-row .status.danger.sales-status-issued{background:#e3edf4!important;color:#264760!important;box-shadow:none!important}
.request-status-pill{display:inline-flex;align-items:center;justify-content:center;min-width:92px;padding:.35rem .7rem;border-radius:999px;background:#e3edf4;color:#27485f;font-weight:800;text-transform:none}.request-status-requested{background:#fff0d8;color:#754c09}.request-status-invoiced{background:#e0ecf5;color:#24516e}.request-status-paid{background:#dff4e6;color:#176b3a}.request-status-cancelled{background:#eceff1;color:#5a666c}

#customerInvoiceRequestDialog{width:min(1480px,calc(100vw - 18px));height:min(960px,calc(100dvh - 14px));max-height:calc(100dvh - 14px);overflow:hidden}
#customerInvoiceRequestDialog>form{height:100%;max-height:none!important;overflow:auto!important;scrollbar-gutter:stable}
#customerInvoiceRequestDialog .customer-request-sales-layout{display:grid;grid-template-columns:minmax(340px,.95fr) minmax(290px,.68fr) minmax(410px,1.25fr);grid-template-areas:"customer coding preview" "lines lines lines";gap:.65rem;margin:.65rem .8rem}
#customerInvoiceRequestDialog .customer-request-customer-section{grid-area:customer}#customerInvoiceRequestDialog .customer-request-coding-section{grid-area:coding}#customerInvoiceRequestDialog .customer-request-preview-section{grid-area:preview}#customerInvoiceRequestDialog .customer-request-lines-section{grid-area:lines}
#customerInvoiceRequestDialog .sales-editor-panel{min-width:0;padding:.65rem .72rem;border:1px solid var(--v077-line);border-radius:10px;background:#f8fbfa}
#customerInvoiceRequestDialog .customer-request-preview-section{display:grid;grid-template-rows:auto minmax(330px,1fr) auto;background:#fbfcfc}
#customerRequestDocumentPreview{min-height:330px;margin-top:.45rem;overflow:auto;border:1px dashed var(--v077-line);border-radius:9px;background:#f2f5f5}
#customerRequestDocumentPreview iframe,#customerRequestDocumentPreview img{display:block;width:100%;height:100%;min-height:330px;border:0;object-fit:contain}
.customer-request-file-button{position:relative;overflow:hidden}.customer-request-file-button input{position:absolute;inset:0;opacity:0;cursor:pointer}
#customerInvoiceRequestDialog .customer-request-selected-customer{margin-top:.5rem}
#customerInvoiceRequestDialog .customer-request-line-head,#customerInvoiceRequestDialog .customer-request-line{display:grid;grid-template-columns:minmax(260px,2.8fr) 70px 92px 78px minmax(135px,1.1fr) 92px 100px auto;gap:.45rem;align-items:end}
#customerInvoiceRequestDialog .customer-request-line-head{padding:.45rem .55rem;background:var(--v077-navy);color:#fff;font-size:.72rem;font-weight:800}
#customerInvoiceRequestDialog .customer-request-line{padding:.5rem;border-bottom:1px solid var(--v077-line);background:#fff}
#customerInvoiceRequestDialog .customer-request-line label{min-width:0}#customerInvoiceRequestDialog .customer-request-line label>span{display:none}#customerInvoiceRequestDialog .customer-request-line textarea{height:37px;min-height:37px}
#customerInvoiceRequestDialog .request-line-actions{display:flex;gap:.25rem;align-items:center}.customer-request-totals{display:flex;justify-content:flex-end;gap:1.4rem;padding:.6rem .8rem;background:#eff7f2}.customer-request-totals span{display:grid}.customer-request-totals strong{font-size:.95rem}

.credit-allocation-panel.credit-allocation-workspace{grid-column:1/-1;width:100%;margin:.2rem 0;padding:.75rem;border:1px solid #cbded4;border-radius:12px;background:#f7fbf8}.credit-allocation-workspace .allocation-heading{align-items:flex-start}.credit-allocation-workspace .allocation-row{position:relative;display:grid;grid-template-columns:minmax(180px,1.1fr) 110px 125px 125px 125px auto;gap:.5rem;align-items:end;padding:.55rem;border-top:1px solid #dbe7e1}.credit-allocation-workspace .allocation-invoice-results{position:absolute;z-index:80;top:calc(100% - 6px);left:.55rem;width:min(540px,calc(100% - 1.1rem));max-height:240px;overflow:auto;border:1px solid #b6cfc1;border-radius:9px;background:#fff;box-shadow:0 12px 28px rgba(20,50,36,.15)}.allocation-invoice-results button{display:grid;grid-template-columns:1fr auto;gap:.6rem;width:100%;padding:.55rem .65rem;border:0;border-bottom:1px solid #e2ebe6;border-radius:0;background:#fff;color:var(--v077-navy);text-align:left}.allocation-invoice-results button:hover{background:#edf7f0}.allocation-source-note{margin:.45rem 0 0;color:#246b42;font-weight:700}

.query-attachments{display:grid;gap:.35rem;margin:.5rem 0}.query-attachments input{width:100%}.query-attachment-list{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.3rem}.query-attachment-list a{font-size:.72rem}

.invoice-record-related-matches{display:grid;gap:.35rem}.related-match-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:.55rem;align-items:center;width:100%;padding:.48rem .55rem;border:1px solid #dce6e1;border-radius:8px;background:#fff;color:var(--v077-navy);text-align:left}.related-match-row:hover{background:#eff8f2}.related-match-row span{display:grid;text-align:left}.related-match-row small{color:var(--muted)}
@media(min-width:1101px){.invoice-record-grid{grid-template-columns:minmax(270px,.85fr) minmax(500px,1.55fr) minmax(310px,.95fr)!important}.invoice-record-column-preview{grid-column:2}.invoice-record-column-secondary{grid-column:3}.invoice-document-frame{height:560px!important;min-height:560px!important}.invoice-record-preview{min-height:620px!important}}

@media(max-width:1100px){#customerInvoiceRequestDialog .customer-request-sales-layout{grid-template-columns:1fr 1fr;grid-template-areas:"customer coding" "preview preview" "lines lines"}.credit-allocation-workspace .allocation-row{grid-template-columns:1fr 1fr 1fr}.invoice-document-frame{min-height:520px!important}}
@media(max-width:700px){#customerInvoiceRequestDialog{width:100vw;height:100dvh;max-height:100dvh;margin:0;border:0;border-radius:0}#customerInvoiceRequestDialog .customer-request-sales-layout{grid-template-columns:1fr;grid-template-areas:"customer" "coding" "preview" "lines";margin:.5rem}#customerInvoiceRequestDialog .customer-request-line-head{display:none}#customerInvoiceRequestDialog .customer-request-line{grid-template-columns:1fr 1fr}#customerInvoiceRequestDialog .request-line-description,#customerInvoiceRequestDialog .request-line-actions{grid-column:1/-1}#customerInvoiceRequestDialog .customer-request-line label>span{display:block}.credit-allocation-workspace .allocation-row{grid-template-columns:1fr 1fr}.credit-allocation-workspace .allocation-row>*:first-child{grid-column:1/-1}}
@media(max-width:900px){.invoice-list-sort-head{display:none}}
