.service-invoice{background:#fff;border:1px solid #d7e3ef;border-radius:14px;overflow:hidden}
.service-invoice>.section-header{padding:20px 24px;background:#f4f9fe;border-bottom:1px solid #d7e3ef}
.service-invoice>.section-header h2{margin:0;font-size:23px}.service-invoice .eyebrow{margin-bottom:5px}
.service-invoice-header{display:grid;grid-template-columns:2fr 1fr 1fr 1.3fr;gap:20px;padding:20px 24px;border-bottom:1px solid #e3ebf3;align-items:start}
.service-invoice-header small{display:block;color:#667e94;font-size:10px;letter-spacing:.07em;margin-bottom:8px;font-weight:750}
.service-invoice-header .service-customer{grid-column:1/-1}.service-customer textarea{min-height:85px;background:#e4f3f9;border-color:#b8d6e4;resize:vertical}.service-customer-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:9px}.service-customer>label{font-size:12px;color:#175d80}.service-reference{grid-column:1/-1;display:grid;grid-template-columns:90px 1fr;align-items:center;color:#175d80;font-size:13px}.service-reference input{background:#e4f3f9;border-color:#b8d6e4}
.service-customer>label{grid-template-columns:90px 1fr;align-items:start}.service-customer-actions{padding-left:97px}
.service-invoice-header strong{display:block;font-size:14px;line-height:1.6}.service-invoice-header button{min-height:36px;font-size:13px;text-align:left;max-width:100%}
.service-customer p{font-size:12px;color:#64748b;overflow-wrap:anywhere;line-height:1.5;margin:8px 0}.service-customer .link-btn{font-size:12px;padding:0}
.service-entry{padding:18px 24px;background:#fbfdff}.service-entry-top{display:flex;gap:12px;align-items:end;margin-bottom:12px}.service-entry-top label{width:230px}.service-entry label{font-size:12px}
.service-line-entry{display:flex;gap:18px;align-items:center;flex:1;color:#175d80;font-size:13px;font-weight:700}.service-line-entry button{flex:1;min-height:44px}.service-product-type{margin:0;border:1px solid #cbdce8;border-radius:7px;padding:8px 14px;min-width:175px}.service-product-type legend{font-size:10px;font-weight:750;color:#536e83}.service-product-type label{width:auto;display:flex;align-items:center;gap:7px;line-height:1.8}.service-product-type input{width:14px;min-height:0;accent-color:#0e7490}.service-entry details>summary{cursor:pointer;color:#176b94;font-size:12px;padding:6px 0 10px}
#serviceProductSearchForm{display:flex;gap:10px;align-items:end}#serviceProductSearchForm label{flex:1;min-width:0}
.service-product-results{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:7px;margin-top:10px;max-height:180px;overflow:auto}
.service-product-result{display:flex;justify-content:space-between;gap:12px;align-items:center;text-align:left;border:1px solid #347297;background:#164766;padding:10px 12px;color:#fff;font-size:12px;font-weight:500;box-shadow:0 2px 4px #123b5215}.service-product-result:hover{border-color:#1498c5;background:#0d3550}.service-product-result:focus-visible{outline:3px solid #06b6d4;outline-offset:2px}.service-product-result small{display:block;font-size:11px;color:#d3e6f2;margin-top:5px}.service-product-result>strong{white-space:nowrap;color:#9de9ff}
.service-grid-wrap{overflow:auto;border-top:1px solid #d7e3ef}.service-grid{width:100%;min-width:1000px;border-collapse:collapse;font-size:12px}.service-grid th{background:#0c5279;color:#fff;text-align:left;padding:12px;white-space:nowrap;font-size:11px}.service-grid td{border-bottom:1px solid #e2eaf2;padding:12px;vertical-align:top}.service-grid tbody tr:nth-child(even){background:#f8fbfe}.service-grid td small{display:block;color:#6b8193;margin-top:6px}.service-grid .service-description-cell{width:30%;min-width:220px}.service-description-cell p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;color:#52677a;margin:7px 0}.service-grid button{min-height:32px;font-size:12px;padding:4px 7px;white-space:nowrap}.service-cell-edit{background:#eaf3fa;color:#095d89;font-weight:700}.service-remove-cell .link-btn{color:#b52c48}.service-type{font-size:10px;border-radius:4px;background:#e8f3fb;color:#225e8f;padding:3px 6px;white-space:nowrap}.service-type.is-service{background:#e7f4ee;color:#15694b}.service-invoice-empty{text-align:center;color:#6b8193;padding:34px!important}
#servicePricingStatus{font-size:12px;color:#657e92;padding:0 24px;min-height:16px}
.service-invoice-bottom{padding:10px 24px 20px;display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,340px);gap:50px}.service-invoice-bottom label{font-size:12px}.service-invoice-bottom textarea{resize:vertical}.service-invoice-bottom dl{margin:0}.service-invoice-bottom dl>div{display:flex;justify-content:space-between;padding:8px 0;gap:16px;font-size:13px}.service-invoice-bottom dd{margin:0;font-weight:750}.service-grand-total{border-top:1px solid #cbdce9;margin-top:6px;color:#075985;font-size:21px!important}.service-grand-total dd{white-space:nowrap}
.service-invoice-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;padding:16px 24px;border-top:1px solid #d7e3ef;background:#f4f9fe}.service-invoice-actions button{font-size:12px}#serviceDone{min-width:180px}
#serviceLineDialog{width:min(650px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto}#serviceLineDialog h2{font-size:20px}#serviceLineDialog p{line-height:1.5;font-size:12px}#serviceLineDialog textarea{resize:vertical;min-height:190px;background:#dceff5;border-color:#aecdd9;color:#123c51}#serviceLineDescriptionLabel{color:#175d80;font-size:13px}.service-line-fields{display:grid;grid-template-columns:125px minmax(0,220px);align-items:center;gap:9px 14px;margin-top:16px;color:#175d80;font-size:13px;font-weight:650}.service-line-fields>label{display:block;margin:0}.service-line-fields input,.service-line-fields select{min-height:38px;background:#e4f3f9;border-color:#b8d6e4;text-align:center;font-weight:700}.service-line-fields .service-vat-setting{display:flex;align-items:center;gap:9px}.service-vat-setting input{width:16px;height:16px;min-height:0;margin:0;accent-color:#087ead}.service-line-fields output{display:block;text-align:center;padding:9px 12px;background:#f1f6fa;border:1px solid #c9d8e2;border-radius:6px;color:#143b53;font-variant-numeric:tabular-nums}.service-line-fields .service-line-total{background:#fce1e2;border-color:#edbfc4;color:#8e2435;font-size:17px}.service-line-actions{display:flex;gap:10px}.service-line-actions button{flex:1}#serviceLineDialog input:disabled,#serviceLineDialog select:disabled{opacity:.75}#serviceLineDialog .service-vat-setting input{opacity:1}@media(max-width:600px){#serviceLineDialog .dialog-card{padding:18px}#serviceLineDialog h2{font-size:18px}.service-line-fields{grid-template-columns:100px minmax(0,1fr);gap:8px 10px}#serviceLineDialog textarea{min-height:150px}#serviceLineDialog select{font-size:16px}}
@media(max-width:600px){.service-entry-top{align-items:stretch;flex-wrap:wrap}.service-line-entry{flex-basis:100%;gap:10px}.service-product-type{display:flex;gap:20px;flex:1}.service-entry .service-product-type label{flex:none}.service-reference,.service-customer>label{grid-template-columns:1fr;gap:7px}.service-customer-actions{padding-left:0}}
@media(max-width:1000px){.service-invoice-header{grid-template-columns:2fr 1fr}.service-invoice-bottom{gap:24px}}
@media(max-width:600px){.service-invoice>.section-header,.service-invoice-header,.service-entry{padding:14px}.service-invoice-header{gap:14px;grid-template-columns:1fr 1fr}.service-customer{grid-column:1/-1}.service-invoice-header button{font-size:12px}.service-entry-top label{width:auto;flex:1}.service-entry-top button{font-size:12px;padding:0 12px}#serviceProductSearchForm button{font-size:12px;padding:0 12px}.service-product-results{grid-template-columns:1fr;max-height:160px}.service-grid{min-width:0}.service-grid thead{display:none}.service-grid tbody{display:block}.service-grid tr{display:grid;grid-template-columns:1fr 1fr;gap:0 12px;padding:12px;border-bottom:2px solid #d7e3ef}.service-grid td{display:block;border:0;padding:6px 0;min-width:0;overflow-wrap:anywhere}.service-grid td::before{content:attr(data-label);display:block;color:#6b8193;font-size:10px;font-weight:600;margin-bottom:5px}.service-grid .service-description-cell{grid-column:1/-1;min-width:0;width:auto}.service-grid td:first-child{display:none}.service-grid .service-remove-cell{align-self:end}.service-grid .service-invoice-empty{grid-column:1/-1}.service-invoice-bottom{padding:14px;grid-template-columns:1fr;gap:18px}.service-invoice-actions{padding:14px}.service-invoice-actions button{flex:1;min-width:130px}#servicePricingStatus{padding:0 14px}#serviceLineDialog input{font-size:16px}}
/* Account-first service header, with compact desktop controls. */
.service-invoice>.section-header{padding:12px 18px}.service-invoice>.section-header h2{font-size:21px}
.service-invoice-header{grid-template-columns:minmax(0,1fr) minmax(260px,340px);gap:18px;padding:14px 18px}
.service-invoice-header .service-customer{grid-column:auto;display:grid;gap:9px;min-width:0}
.service-account-row{display:flex;align-items:center;gap:10px;min-width:0;color:#175d80;font-size:12px;font-weight:700}
.service-account-row>span{width:105px;flex-shrink:0}.service-account-row #serviceChooseCustomer{flex:1;background:#e4f3f9;border:1px solid #b8d6e4;display:flex;justify-content:space-between;align-items:center;gap:12px;overflow-wrap:anywhere}
#serviceChooseCustomer::after{content:'⌄';font-size:17px;flex-shrink:0}
.service-customer>label{grid-template-columns:105px minmax(0,1fr);align-items:center;gap:10px;margin:0;font-size:12px}
.service-customer textarea{min-height:54px;height:54px;font-size:13px;line-height:1.4;padding:8px 10px}
.service-customer .service-reference{grid-column:auto}
.service-reference input{min-height:36px;padding:7px 10px;font-size:13px}
.service-customer #serviceCustomerDetails{margin:0 0 0 115px;font-size:11px;line-height:1.4}
.service-header-side{min-width:0;display:grid;gap:14px}
.service-header-meta{display:grid;grid-template-columns:1fr 1fr;gap:10px 14px;align-items:start}
.service-header-meta #serviceRepField{grid-column:1/-1;display:flex;align-items:center;gap:10px}
.service-header-meta small{margin-bottom:3px;font-size:9px}.service-header-meta #serviceRepField small{margin:0}
.service-header-meta strong{font-size:12px}.service-header-meta button{min-height:30px;font-size:12px;padding:5px 12px}
.service-header-side .service-customer-actions{padding:0;margin:0;display:flex;flex-wrap:wrap;gap:6px;align-items:start}
.service-header-side .service-customer-actions button{min-height:32px;font-size:11px;padding:7px 10px;text-align:center}
.service-entry{padding:12px 18px}.service-entry-top{margin-bottom:5px}.service-line-entry{flex:none;min-width:0;gap:12px;width:min(100%,610px)}.service-line-entry button{min-height:38px;font-size:12px}.service-product-type{padding:5px 12px;min-width:160px}
@media(max-width:850px){.service-invoice-header{grid-template-columns:minmax(0,1fr)}.service-header-side{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}.service-header-meta{grid-template-columns:1fr 1fr}.service-header-side .service-customer-actions{align-content:start}}
@media(max-width:600px){.service-invoice-header{padding:12px;gap:12px}.service-account-row{flex-wrap:wrap;gap:7px}.service-account-row>span{width:100%}.service-account-row #serviceChooseCustomer{min-height:44px}.service-customer>label{grid-template-columns:minmax(0,1fr);gap:5px}.service-customer #serviceCustomerDetails{margin:0}.service-customer textarea{font-size:16px;min-height:58px}.service-reference input{font-size:16px;min-height:44px}.service-header-side{grid-template-columns:minmax(0,1fr)}.service-header-meta{grid-template-columns:1fr 1fr}.service-header-meta #serviceRepField{grid-column:auto}.service-header-side .service-customer-actions button{min-height:44px;flex:1}.service-entry{padding:12px}.service-entry-top{gap:8px}.service-line-entry{width:100%;flex:1 0 100%}.service-line-entry button{min-height:44px}}
.service-reference-row{display:grid;grid-template-columns:minmax(210px,1fr) minmax(0,2fr);gap:14px}.service-reference-row .service-reference{grid-template-columns:105px minmax(0,1fr);gap:10px}.service-reference-row .service-reference:not(.service-po){grid-template-columns:65px minmax(0,1fr)}
@media(max-width:1000px){.service-reference-row{grid-template-columns:minmax(0,1fr)}.service-reference-row .service-reference:not(.service-po){grid-template-columns:105px minmax(0,1fr)}}
@media(max-width:600px){.service-reference-row{gap:9px}.service-reference-row .service-reference,.service-reference-row .service-reference:not(.service-po){grid-template-columns:minmax(0,1fr);gap:5px}}
.service-terms{display:flex;gap:24px;align-items:center;margin:0;border:1px solid #cbdce8;border-radius:7px;padding:8px 12px}.service-terms legend{font-size:10px;font-weight:750;color:#536e83}.service-terms label{display:flex;align-items:center;gap:7px;font-size:12px;color:#175d80}.service-terms input{width:16px;min-height:16px;accent-color:#0e7490}.account-checkout .payment-methods,.account-checkout .payment-adjustments,.account-checkout .payment-entry-workspace,.account-checkout #paymentParts{display:none!important}.account-checkout #paymentChange{padding:16px;background:#eff6ff;color:#075985;border-radius:8px;font-weight:700}.account-checkout .payment-scroll{min-height:0}
.service-customer>.service-terms{justify-self:start;min-width:240px}
/* Keep customer entry compact and align branch, date and salesperson. */
.service-invoice-header{grid-template-columns:minmax(0,720px) minmax(330px,430px);gap:24px;justify-content:start}
.service-account-row{max-width:680px}
.service-header-side{padding-top:48px}
.service-header-meta{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1.15fr);gap:12px;align-items:start}
.service-header-meta #serviceRepField{grid-column:auto;display:block}
.service-header-meta #serviceRepField small{margin:0 0 3px}
.service-header-meta strong{min-height:30px;display:flex;align-items:center;overflow-wrap:anywhere}
.service-header-meta button{min-height:30px;white-space:normal;overflow-wrap:anywhere}
@media(max-width:1100px){.service-invoice-header{grid-template-columns:minmax(0,1fr) 340px;gap:18px}}
@media(max-width:850px){.service-invoice-header{grid-template-columns:minmax(0,1fr)}.service-header-side{padding-top:0;grid-template-columns:minmax(0,1fr)}.service-account-row{max-width:none}}
@media(max-width:600px){.service-header-meta{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.service-header-meta button{min-height:36px;padding:5px 8px}.service-header-meta strong{min-height:36px}}
#serviceProductSearchDialog{width:min(1000px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto}#serviceProductSearchDialog h2{font-size:21px;margin:0}#serviceProductSearchDialog .service-product-results{max-height:min(55dvh,500px);margin:0;padding:3px;grid-template-columns:repeat(auto-fill,minmax(220px,1fr))}#serviceProductSearchDialog .service-product-result{min-height:70px}#serviceOpenProductSearch{font-size:12px;min-height:36px}#serviceProductSearchDialog label{font-size:12px}@media(max-width:600px){#serviceProductSearchDialog .service-product-results{grid-template-columns:minmax(0,1fr)}#serviceProductSearchDialog input{font-size:16px}#serviceProductSearchDialog h2{font-size:19px}}
.service-entry-top{flex-wrap:wrap;align-items:center}.service-line-entry{flex:1 1 300px;width:auto;max-width:610px}
/* Compact invoice rows; service descriptions are the editable line name. */
.service-grid{min-width:900px}.service-grid th{padding:9px 10px}.service-grid td{padding:7px 10px;vertical-align:middle}.service-grid .service-description-cell{width:40%;white-space:pre-wrap}.service-grid button{min-height:28px;padding:3px 6px}.service-grid .service-description-edit{display:block;text-align:left;background:transparent;color:#172033;font-weight:600;white-space:pre-wrap;overflow-wrap:anywhere;padding:0;max-width:100%;border-radius:3px}.service-grid .service-description-edit:hover{text-decoration:underline;color:#075985}.service-grid .service-description-edit:focus-visible{outline:2px solid #0284c7;outline-offset:3px}
@media(max-width:600px){.service-grid{min-width:0}.service-grid tr{padding:9px 12px}.service-grid td{padding:4px 0}.service-grid .service-description-cell{width:auto;min-width:0}}
#serviceRecurringDialog{width:min(1050px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto}#serviceRecurringDialog h2{margin:0;font-size:21px}#serviceRecurringDialog .muted{font-size:12px;line-height:1.5;margin:6px 0}#recurringInvoiceSearch{display:grid;gap:12px}#recurringInvoiceSearch>button{justify-self:start}.recurring-filters{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.recurring-filters label{min-width:0;font-size:12px}.recurring-filters .check-label{align-self:end;min-height:44px}.recurring-results{max-height:32dvh;overflow:auto;min-width:0}.recurring-results table{width:100%;min-width:650px;border-collapse:collapse;font-size:12px}.recurring-results th{background:#0c5279;color:#fff;text-align:left;padding:9px}.recurring-results td{padding:8px 9px;border-bottom:1px solid #d7e3ef}.recurring-results tbody tr:nth-child(even){background:#f4f9fe}.recurring-results button{min-height:32px;font-size:12px}#recurringStatus{font-size:12px;line-height:1.5;margin:0}#recurringInvoicePreview{border:1px solid #cbdce8;border-radius:8px;padding:12px;background:#f4f9fe}#recurringInvoicePreview h3{margin:0;font-size:14px}.recurring-preview-lines{max-height:23dvh;overflow:auto}.recurring-preview-lines>div{display:flex;justify-content:space-between;gap:20px;padding:7px 0;border-bottom:1px solid #d7e3ef;font-size:12px}.recurring-preview-lines span{white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}.recurring-preview-lines strong{white-space:nowrap}.recurring-help{margin:0!important}@media(max-width:600px){.recurring-filters{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:9px}.recurring-filters input{font-size:16px;min-width:0}.recurring-filters label:nth-child(3){grid-column:1/-1}#serviceRecurringDialog .dialog-card{padding:16px}#serviceRecurringDialog h2{font-size:19px}.recurring-preview-lines>div{gap:12px}.recurring-preview-lines strong{white-space:normal;min-width:85px}}
@media(max-width:600px){.recurring-results table{min-width:0}.recurring-results thead{display:none}.recurring-results tbody{display:block}.recurring-results tr{display:grid;grid-template-columns:1fr 1fr;gap:9px;padding:10px;border:1px solid #d7e3ef;border-radius:7px;margin-bottom:7px}.recurring-results td{padding:0;border:0;min-width:0;overflow-wrap:anywhere}.recurring-results td[data-label]::before{content:attr(data-label);display:block;font-size:10px;color:#64748b;margin-bottom:3px}.recurring-results td[data-label=Customer],.recurring-results .recurring-select-cell{grid-column:1/-1}.recurring-results .recurring-select-cell button{width:100%;min-height:40px}}
#serviceProductSearchDialog .muted{margin:0;font-size:12px;line-height:1.5}#serviceProductPickerStatus{margin:0;min-height:18px;font-size:12px;color:#175d80}.service-picker-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;background:#fff;padding-top:10px;border-top:1px solid #d7e3ef;position:sticky;bottom:0}.service-picker-footer>span{font-size:12px;color:#526b7f}.service-picker-footer button{min-width:115px}.service-picker-qty:empty{display:none}.service-picker-qty{display:inline-block;margin-top:6px;border-radius:4px;padding:2px 6px;background:#cdf8e7;color:#115e46;font-size:10px;font-weight:750}.service-product-result.is-added{border-color:#39c5a0;box-shadow:inset 0 0 0 1px #39c5a0}.service-product-result:disabled{opacity:.7}

/* Keep invoice context beside Terms and the secondary actions in a compact column. */
#serviceSalesView .service-invoice-header{grid-template-columns:minmax(0,1fr) 190px;gap:10px 18px;align-items:start}
#serviceSalesView .service-header-top{grid-column:1/-1;display:grid;grid-template-columns:minmax(180px,240px) minmax(0,600px);gap:18px;align-items:center;min-width:0}
#serviceSalesView .service-header-top .service-terms{min-width:0;margin:0}
#serviceSalesView .service-header-meta{grid-template-columns:repeat(3,minmax(0,1fr));min-width:0}
#serviceSalesView .service-header-side{padding-top:0;display:block;min-width:0}
#serviceSalesView .service-customer-actions{display:flex;flex-direction:column;align-items:stretch;gap:6px}
#serviceSalesView .service-customer-actions button{width:100%;margin:0}
@media(max-width:600px){
 #serviceSalesView .service-invoice-header{grid-template-columns:minmax(0,1fr);gap:12px}
 #serviceSalesView .service-header-top{grid-template-columns:minmax(0,1fr);gap:10px}
 #serviceSalesView .service-header-top .service-terms{justify-self:start;min-width:200px}
 #serviceSalesView .service-customer-actions{max-width:240px}
}

@media screen{
 #serviceSalesView>.section-header{background:#155e75;color:#fff;border-bottom-color:#0f4f63}
 #serviceSalesView>.section-header h2{color:#fff}
}

/* Keep invoice context and actions on short rows, leaving room for line entry. */
@media screen{
 #appScreen #serviceSalesView>.section-header{margin-bottom:0}
 #appScreen #serviceSalesView .service-invoice-header{grid-template-columns:minmax(0,1fr) auto;gap:6px 16px;padding:8px 12px}
 #appScreen #serviceSalesView .service-header-top{grid-column:1;grid-row:1;grid-template-columns:180px minmax(0,520px);gap:14px;align-items:center}
 #appScreen #serviceSalesView .service-terms{padding:3px 9px;gap:18px}
 #appScreen #serviceSalesView .service-header-meta{gap:12px}
 #appScreen #serviceSalesView .service-header-meta small{margin:0;font-size:10px;letter-spacing:0}
 #appScreen #serviceSalesView .service-header-meta strong{min-height:28px;line-height:1.3}
 #appScreen #serviceSalesView .service-header-side{grid-column:2;grid-row:1;padding:0;align-self:center}
 #appScreen #serviceSalesView .service-customer-actions{display:grid;grid-template-columns:repeat(4,max-content);gap:6px;margin:0;padding:0;max-width:none}
 #appScreen #serviceSalesView .service-customer-actions button{width:auto;min-height:30px;padding:5px 9px;font-size:11px;line-height:1.3}
 #appScreen #serviceSalesView .service-customer{grid-column:1/-1;display:grid;grid-template-columns:minmax(260px,1fr) minmax(0,1.6fr);gap:3px 18px;align-items:start}
 #appScreen #serviceSalesView .service-account-row{grid-column:1;grid-row:1;max-width:none;gap:8px}
 #appScreen #serviceSalesView .service-account-row>span{width:60px}
 #appScreen #serviceSalesView #serviceChooseCustomer{min-height:32px;padding:5px 9px;font-size:12px;line-height:1.4}
 #appScreen #serviceSalesView #serviceCustomerDetails{grid-column:1;grid-row:2;margin:0 0 0 68px;font-size:11px;line-height:1.3}
 #appScreen #serviceSalesView #serviceCustomerDetails:empty{display:none}
 #appScreen #serviceSalesView #serviceCodCustomerLabel{grid-column:1;grid-row:1/3;grid-template-columns:80px minmax(0,1fr);gap:8px}
 #appScreen #serviceSalesView #serviceCustomerDetail{height:48px;min-height:48px;padding:5px 8px}
 #appScreen #serviceSalesView .service-reference-row{grid-column:2;grid-row:1/3;grid-template-columns:minmax(160px,1fr) minmax(0,1.7fr);gap:12px}
 #appScreen #serviceSalesView .service-reference-row .service-reference{grid-template-columns:auto minmax(0,1fr);gap:8px}
 #appScreen #serviceSalesView .service-reference input{min-height:32px;padding:5px 8px}
 #appScreen #serviceSalesView .service-entry{padding:6px 12px}
 #appScreen #serviceSalesView .service-entry-top{gap:10px;margin:0}
 #appScreen #serviceSalesView .service-line-entry{max-width:430px;gap:8px}
 #appScreen #serviceSalesView .service-line-entry button,#appScreen #serviceSalesView #serviceOpenProductSearch{min-height:32px;padding:5px 10px}
 #appScreen #serviceSalesView .service-product-type{display:flex;align-items:center;gap:14px;min-width:0;padding:2px 9px}
 #appScreen #serviceSalesView .service-product-type label{width:auto;flex:none;line-height:1.4}
}
@media screen and (max-width:1400px){
 #appScreen #serviceSalesView .service-customer-actions{grid-template-columns:repeat(2,max-content)}
 #appScreen #serviceSalesView .service-header-top{grid-template-columns:160px minmax(0,1fr)}
}
@media screen and (max-width:950px){
 #appScreen #serviceSalesView .service-invoice-header{grid-template-columns:minmax(0,1fr)}
 #appScreen #serviceSalesView .service-header-side{grid-column:1;grid-row:3}
 #appScreen #serviceSalesView .service-customer-actions{display:flex;flex-wrap:wrap}
 #appScreen #serviceSalesView .service-customer{grid-template-columns:minmax(0,1fr)}
 #appScreen #serviceSalesView .service-reference-row{grid-column:1;grid-row:3;grid-template-columns:minmax(0,1fr) minmax(0,1.7fr)}
}
@media screen and (max-width:600px){
 #appScreen #serviceSalesView .service-invoice-header{padding:8px;gap:8px}
 #appScreen #serviceSalesView .service-header-top{grid-template-columns:minmax(0,1fr);gap:6px}
 #appScreen #serviceSalesView .service-header-top .service-terms{min-width:0;justify-self:start}
 #appScreen #serviceSalesView .service-header-meta{gap:8px}
 #appScreen #serviceSalesView .service-customer-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 #appScreen #serviceSalesView .service-customer-actions button{min-height:40px;padding:6px;font-size:12px}
 #appScreen #serviceSalesView .service-account-row{flex-wrap:nowrap}
 #appScreen #serviceSalesView .service-account-row>span{width:52px}
 #appScreen #serviceSalesView #serviceChooseCustomer{min-height:40px}
 #appScreen #serviceSalesView #serviceCustomerDetails{margin-left:60px}
 #appScreen #serviceSalesView .service-reference-row{grid-template-columns:minmax(0,1fr);gap:6px}
 #appScreen #serviceSalesView .service-reference-row .service-reference{grid-template-columns:60px minmax(0,1fr);gap:0}
 #appScreen #serviceSalesView .service-reference input{min-height:40px;font-size:16px}
 #appScreen #serviceSalesView #serviceCodCustomerLabel{grid-template-columns:60px minmax(0,1fr);gap:0}
 #appScreen #serviceSalesView .service-entry{padding:6px 8px}
 #appScreen #serviceSalesView .service-line-entry{max-width:none;flex-basis:100%}
 #appScreen #serviceSalesView .service-line-entry button,#appScreen #serviceSalesView #serviceOpenProductSearch{min-height:40px}
 #appScreen #serviceSalesView .service-product-type{flex:1;gap:8px;padding:4px 7px}
}
/* Dense invoice entry on desktop screens; retain larger touch targets on phones. */
@media screen and (min-width:601px){
 #appScreen.workspace-shell #serviceSalesView .service-grid :is(th,td){padding:3px 7px;line-height:1.25}
 #appScreen.workspace-shell #serviceSalesView #serviceInvoiceLines td button{min-height:26px;padding:3px 6px;line-height:1.2;margin:0;border-radius:5px}
 #appScreen.workspace-shell #serviceSalesView #serviceInvoiceLines .service-description-edit{min-height:26px;padding:3px 0;white-space:pre-wrap}
 #appScreen.workspace-shell #serviceSalesView .service-invoice-header{padding:5px 8px;gap:4px 10px}
 #appScreen.workspace-shell #serviceSalesView .service-header-meta strong{min-height:0}
 #appScreen.workspace-shell #serviceSalesView :is(.service-header-meta button,.service-reference input,#serviceChooseCustomer){min-height:30px;padding:4px 7px;line-height:1.25}
 #appScreen.workspace-shell #serviceSalesView #serviceCustomerDetail{height:34px;min-height:34px;padding:4px 7px}
 #appScreen.workspace-shell #serviceSalesView .service-entry{padding:4px 8px}
 #appScreen.workspace-shell #serviceSalesView .service-entry-top{margin:0;gap:8px}
}
/* Align invoice context and entry actions without repeating the global shop selector. */
@media screen{
 #appScreen.workspace-shell #serviceSalesView .service-header-meta>div:has(>#serviceBranch){display:none}
 #appScreen.workspace-shell #serviceSalesView .service-header-top{grid-template-columns:180px minmax(220px,360px);gap:12px;align-items:end}
 #appScreen.workspace-shell #serviceSalesView .service-header-meta{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:end}
 #appScreen.workspace-shell #serviceSalesView .service-header-meta small{font-size:10px;margin:0 0 4px;line-height:1.2}
 #appScreen.workspace-shell #serviceSalesView .service-header-meta strong{min-height:32px;align-items:center;line-height:1.3}
 #appScreen.workspace-shell #serviceSalesView #serviceChooseRep,
 #appScreen.workspace-shell #serviceSalesView #serviceChooseCustomer{background:#f5f9fc!important;color:#153e52!important;border:1px solid #b8cedd!important;border-radius:6px;box-shadow:none;min-height:32px;padding:5px 9px;line-height:1.3;text-align:left}
 #appScreen.workspace-shell #serviceSalesView #serviceChooseRep{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;white-space:normal}
 #appScreen.workspace-shell #serviceSalesView #serviceChooseRep::after{content:'⌄';flex-shrink:0}
 #appScreen.workspace-shell #serviceSalesView :is(#serviceChooseRep,#serviceChooseCustomer):hover{background:#e7f2f8!important;border-color:#4186a0!important}
 #appScreen.workspace-shell #serviceSalesView .service-terms{min-height:40px;align-items:center;justify-content:space-between;gap:12px;padding:3px 9px;margin:0}
 #appScreen.workspace-shell #serviceSalesView .service-account-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;align-items:center}
 #appScreen.workspace-shell #serviceSalesView .service-account-row>span{grid-column:1/-1;width:auto;line-height:1.2}
 #appScreen.workspace-shell #serviceSalesView #serviceChooseCustomer{width:100%;min-width:0}
 #appScreen.workspace-shell #serviceSalesView #serviceCustomerDetails{margin:2px 0 0;font-size:11px}
 #appScreen.workspace-shell #serviceSalesView :is(.service-reference-row .service-reference,#serviceCodCustomerLabel){display:grid;grid-template-columns:minmax(0,1fr);gap:4px;align-content:start}
 #appScreen.workspace-shell #serviceSalesView .service-reference-row .service-reference{grid-column:auto}
 #appScreen.workspace-shell #serviceSalesView .service-customer{align-items:start;column-gap:12px}
 #appScreen.workspace-shell #serviceSalesView .service-customer-actions button{border-radius:6px;box-shadow:none}
 #appScreen.workspace-shell #serviceSalesView #serviceOpenProductSearch{min-height:32px;border-radius:6px;padding:5px 12px;line-height:1.3;background:#155e75!important;color:#fff!important;border:1px solid #155e75!important;box-shadow:none}
 #appScreen.workspace-shell #serviceSalesView .service-entry-top{align-items:center}
 #appScreen.workspace-shell #serviceSalesView .service-product-type{margin:0;padding:2px 8px;gap:12px;border-radius:6px;align-items:center;min-height:32px}
 #appScreen.workspace-shell #serviceSalesView .service-product-type label{align-items:center;gap:5px;line-height:1.3;margin:0}
 #appScreen.workspace-shell #serviceSalesView .service-product-type input{margin:0;flex-shrink:0}
}
@media screen and (max-width:600px){
 #appScreen.workspace-shell #serviceSalesView .service-header-top{grid-template-columns:minmax(0,1fr);gap:8px}
 #appScreen.workspace-shell #serviceSalesView .service-terms{justify-self:stretch;min-height:40px;justify-content:flex-start;gap:24px}
 #appScreen.workspace-shell #serviceSalesView :is(#serviceChooseRep,#serviceChooseCustomer,#serviceOpenProductSearch){min-height:40px}
 #appScreen.workspace-shell #serviceSalesView .service-reference-row .service-reference{grid-template-columns:minmax(0,1fr)}
 #appScreen.workspace-shell #serviceSalesView .service-product-type{min-height:40px}
}
@media screen{
 #appScreen.workspace-shell #serviceSalesView :is(#serviceCreateCustomer,#serviceCustomerStatement,#serviceRecurring,#serviceOptionalNote){min-height:32px;padding:5px 10px;font-size:12px;line-height:1.3}
}
@media screen and (max-width:950px){
 #appScreen.workspace-shell #serviceSalesView .service-customer-actions{flex-direction:row;gap:6px}
}
@media screen and (max-width:600px){
 #appScreen.workspace-shell #serviceSalesView :is(#serviceCreateCustomer,#serviceCustomerStatement,#serviceRecurring,#serviceOptionalNote){min-height:40px}
}
