/* Shared wide workspaces. Record tabs own an inline page rather than a fixed dialog. */
body:not(.crm-printing){--crm-work-border:#dce4ef;--crm-work-soft:#f6f8fc;--crm-work-blue:#2853a5;background:#f4f7fb}
body:not(.crm-printing) .main{min-width:0}
body:not(.crm-printing) #content{padding:22px 24px 36px;min-width:0}
body:not(.crm-printing) #content.crm-record-workspace{max-width:none;width:100%;margin:0;padding:22px 24px 36px}
body:not(.crm-printing) #content.crm-record-workspace:empty{display:none}
#crmRecordSurface{padding:22px 24px 36px;min-width:0;width:100%;box-sizing:border-box}
#crmRecordSurface:not(:has(.show)){display:none}
body.crm-tab-record #crmRecordSurface :is(#utilityModal,#modal).show{position:static!important;inset:auto!important;display:block!important;overflow:visible!important;min-width:0;width:100%;padding:0!important;background:transparent;z-index:auto}
body.crm-tab-record #crmRecordSurface :is(#utilityModal,#modal)>.modal{width:100%!important;max-width:none!important;max-height:none!important;margin:0;padding:0!important;overflow:visible!important;border:1px solid var(--crm-work-border);border-radius:14px;background:#fff;box-shadow:0 3px 16px #162a4308}
body.crm-tab-record #crmRecordSurface .modal-head{position:static!important;margin:0;padding:20px 24px;border-bottom:1px solid var(--crm-work-border);border-radius:14px 14px 0 0;gap:16px;background:#fff}
body.crm-tab-record #crmRecordSurface .modal-head h3{font-size:19px!important;line-height:1.4;margin:0;letter-spacing:-.2px}
body.crm-tab-record #crmRecordSurface .modal>form{padding:24px!important;margin:0}
#crmRecordSurface :is(#utilityFields,#projectForm){grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:20px!important}
#crmRecordSurface #utilityFields> :not(label):not(.crm-field-group){grid-column:1/-1}
#crmRecordSurface .form-grid label:not(.check-item){display:grid;align-content:start;gap:6px;min-width:0;font-size:13px!important;line-height:1.5;color:#4c5d76}
#crmRecordSurface .form-grid :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=file]){width:100%;min-width:0;max-width:100%;box-sizing:border-box;font-size:14px!important;min-height:42px;margin:0;padding:10px 12px;border:1px solid #d4deeb;border-radius:8px;background:#fff;color:#1d304c}
#crmRecordSurface .form-grid textarea{min-height:104px;resize:vertical}
#crmRecordSurface .form-grid :is(input,select,textarea):focus{outline:3px solid #e6eefc;border-color:#7196d3;outline-offset:0}
#crmRecordSurface .form-actions{grid-column:1/-1;margin:4px 0 0;padding:18px 0 0!important;border-top:1px solid var(--crm-work-border);gap:10px;justify-content:flex-end}
#crmRecordSurface .btn{min-height:40px;font-size:13px!important;padding:10px 14px}
#crmRecordSurface .table-wrap{width:100%;max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-x:contain}
#crmRecordSurface :is(.crm-sales-form,.crm-reservation-form){display:block!important}
#crmRecordSurface .crm-sales-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr))!important;gap:18px!important;margin-bottom:16px}
#crmRecordSurface .crm-sales-form> :is(p,.toolbar,label,[data-sale-lines]){display:block;margin:16px 0;width:100%;min-width:0;white-space:normal;overflow-wrap:anywhere}
#crmRecordSurface .crm-sales-form>.toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap}
#crmRecordSurface .crm-sales-form>p{font-size:12px!important;line-height:1.65;color:#65758b}
#crmRecordSurface .crm-sales-form>[data-sale-error]{color:#b42318}
#crmRecordSurface .crm-sales-form>[data-sale-total]{font-size:16px!important;font-weight:700;color:#193d7d;padding:14px 16px;border-radius:9px;background:#f1f5fc}
#crmRecordSurface [data-sale-lines] table{min-width:880px;table-layout:fixed}
#crmRecordSurface [data-sale-lines] th:first-child{width:185px}#crmRecordSurface [data-sale-lines] th:nth-child(2){width:280px}#crmRecordSurface [data-sale-lines] th:nth-child(3){width:90px}#crmRecordSurface [data-sale-lines] th:last-child{width:60px}
#crmRecordSurface [data-sale-lines] td{vertical-align:top;white-space:normal}#crmRecordSurface [data-sale-lines] input{min-width:0;width:100%}
body:not(.crm-printing) .crm-quote-window{max-height:none;overflow:visible;padding:0;scrollbar-gutter:auto}
body:not(.crm-printing) #content.crm-record-workspace .section{padding:22px;margin-bottom:16px}
body:not(.crm-printing) .crm-quote-window>.crm-compact-quote{position:static;padding:20px 22px}
body:not(.crm-printing) #content.crm-record-workspace :is(h2,.crm-compact-quote h2){font-size:19px!important;line-height:1.4}
body:not(.crm-printing) .card{border-color:var(--crm-work-border);box-shadow:0 3px 16px #162a4306;border-radius:14px}
body:not(.crm-printing) .section-head{align-items:center;gap:16px;flex-wrap:wrap}
body:not(.crm-printing) .section-head :is(h2,h3){margin:0 0 5px;line-height:1.4}
body:not(.crm-printing) .section-head p{max-width:900px;line-height:1.6;white-space:normal}
body:not(.crm-printing) .crm-reservation-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0}
.crm-reservation-summary>div{padding:14px 16px;background:#f6f8fd;border:1px solid #e0e7f2;border-radius:10px}.crm-reservation-summary small{display:block;color:#64748b;font-size:12px}.crm-reservation-summary strong{display:block;color:#1e3f73;font-size:23px;margin-top:6px}
.crm-reservation-order-picker{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;margin:20px 0}.crm-reservation-order-picker label{display:grid;gap:6px;min-width:240px;max-width:100%;font-size:12px;color:#64748b}.crm-reservation-order-picker select{min-width:0;max-width:100%;padding:10px;border:1px solid #d4deeb;border-radius:8px;background:#fff}
.crm-reservations-table{min-width:1050px;table-layout:fixed}.crm-reservations-table th:last-child{width:330px}.crm-reservations-table .crm-reserve-actions{white-space:normal!important;overflow:visible}.crm-reservations-table .toolbar{gap:6px}.crm-reservations-table .btn{font-size:11px;padding:7px 9px}
.crm-reservation-archive{margin-top:20px;padding:15px 18px;border:1px solid #e0e7f2;border-radius:10px;background:#fafbfd}.crm-reservation-archive summary{cursor:pointer;color:#4b607b}.crm-reservation-archive-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 0;border-bottom:1px solid #e4eaf2}.crm-reservation-archive-row small{display:block;margin-top:5px;color:#64748b}.crm-reserve-availability{padding:14px 16px;border:1px solid #dbe7f7;border-radius:9px;background:#f1f6ff;color:#264c84;font-size:14px;line-height:1.6}
@media(max-width:1200px){#crmRecordSurface :is(#utilityFields,#projectForm){grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:700px){body:not(.crm-printing) #content,body:not(.crm-printing) #content.crm-record-workspace,#crmRecordSurface{padding:12px!important}#crmRecordSurface :is(#utilityFields,#projectForm){grid-template-columns:1fr!important;gap:16px!important}body.crm-tab-record #crmRecordSurface .modal-head,body.crm-tab-record #crmRecordSurface .modal>form{padding:16px!important}#crmRecordSurface .crm-sales-fields{grid-template-columns:1fr!important}body:not(.crm-printing) .crm-reservation-summary{grid-template-columns:1fr}.crm-reservation-order-picker>*{width:100%}.crm-reservation-archive-row{align-items:flex-start;flex-direction:column}#crmRecordSurface .form-actions{justify-content:stretch}#crmRecordSurface .form-actions>.btn{flex:1}#crmRecordSurface .form-grid :is(input,select,textarea):not([type=checkbox]):not([type=radio]){font-size:16px!important}}
@media print{#crmRecordSurface{display:none!important}}

body.crm-tab-record .quote-items-overlay{left:var(--crm-workspace-left,268px)!important;padding:20px;background:#f4f7fb}
body.crm-tab-record .quote-items-dialog{width:100%;max-width:none;max-height:calc(100dvh - var(--crm-form-top,145px) - 40px);overflow:auto;border:1px solid #dce4ef;border-radius:14px}
@media(max-width:700px){body.crm-tab-record .quote-items-overlay{padding:10px}body.crm-tab-record .quote-items-dialog{max-height:calc(100dvh - var(--crm-form-top,145px) - 20px)}}

/* Product entry remains editable on phones without hiding quantities/prices off-screen. */
@media(max-width:700px){
 #crmRecordSurface [data-sale-lines] .table-wrap{overflow:visible}
 #crmRecordSurface [data-sale-lines] table{display:block;min-width:0!important;width:100%!important;table-layout:auto}
 #crmRecordSurface [data-sale-lines] thead{display:none}
 #crmRecordSurface [data-sale-lines] tbody{display:grid;gap:14px}
 #crmRecordSurface [data-sale-lines] tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:14px;border:1px solid #dce4ef;border-radius:10px;background:#fafcff}
 #crmRecordSurface [data-sale-lines] td{display:block;width:auto!important;max-width:none;min-width:0;border:0;padding:0;white-space:normal}
 #crmRecordSurface [data-sale-lines] td::before{content:attr(data-label);display:block;color:#64748b;font-size:12px;margin-bottom:6px}
 #crmRecordSurface [data-sale-lines] td:nth-child(1),#crmRecordSurface [data-sale-lines] td:nth-child(2){grid-column:1/-1}
 #crmRecordSurface [data-sale-lines] td:first-child{display:grid;grid-template-columns:minmax(0,1fr) 42px;align-items:end;gap:6px 8px}
 #crmRecordSurface [data-sale-lines] td:first-child::before{grid-column:1/-1;margin:0}
 #crmRecordSurface [data-sale-lines] td:last-child{display:flex;align-items:flex-end;justify-content:flex-end}
 #crmRecordSurface [data-sale-lines] td:last-child::before{display:none}
 #crmRecordSurface [data-sale-lines] .crm-stock-ellipsis{white-space:normal;overflow-wrap:anywhere;line-height:1.5}
}

@media(max-width:1024px){
 .topbar>div:has(.crm-heading-line){flex:1 1 160px;min-width:0;max-width:100%}
 .topbar .crm-heading-line{min-width:0;max-width:100%;width:100%}
 .topbar .crm-fx-widget{min-width:0;max-width:100%;width:100%;flex-shrink:1;flex-wrap:wrap;gap:5px}
 .topbar .crm-fx-head{flex:0 0 auto;min-width:0}
 .topbar .crm-fx-values{flex:1 1 100px;min-width:0;max-width:100%;flex-wrap:wrap;gap:3px 7px}
 .topbar .crm-fx-pair{white-space:nowrap;max-width:100%}
}

.crm-auto-document-number{display:flex;align-items:center;min-height:42px;padding:10px 12px;background:#f3f6fb;border:1px solid #e0e7f0;border-radius:8px;color:#506581;font-size:13px;overflow-wrap:anywhere}

.crm-number-hint{font-size:12px;color:#52637e;background:#f4f7fc;border:1px solid #e1e8f3;border-radius:9px;padding:10px 12px;line-height:1.6;grid-column:1/-1;max-width:100%;overflow-wrap:anywhere}
.crm-number-hint small{display:block;font-size:11px;color:#6b7a91}.crm-number-hint b{color:#244684}.crm-number-hint span{margin:0 8px}
.crm-price-list .crm-price-table{width:max-content;min-width:100%;table-layout:fixed}.crm-price-table th,.crm-price-table td{min-width:145px;max-width:200px;vertical-align:middle}.crm-price-table th:nth-child(2),.crm-price-table td:nth-child(2){min-width:270px;max-width:270px}.crm-price-table th:last-child,.crm-price-table td:last-child{min-width:215px}.crm-price-table [data-price-changed-by]{overflow-wrap:anywhere}.crm-price-table thead{position:sticky;top:0;background:#f5f7fc;z-index:1}.crm-price-list [data-price-error]{color:#b42318}.crm-price-history{width:min(1100px,95vw)}

@media(min-width:1100px){.crm-price-table th:nth-last-child(3),.crm-price-table td:nth-last-child(3){position:sticky;right:355px;min-width:155px;max-width:155px;background:#fff;border-left:1px solid #e3e9f3;z-index:2}.crm-price-table th:nth-last-child(2),.crm-price-table td:nth-last-child(2){position:sticky;right:215px;min-width:140px;max-width:140px;background:#fff;z-index:2}.crm-price-table th:last-child,.crm-price-table td:last-child{position:sticky;right:0;min-width:215px;max-width:215px;background:#fff;z-index:2}.crm-price-table thead th:nth-last-child(-n+3){background:#f5f7fc;z-index:3}}

.crm-price-table[data-currency-count="1"]{width:100%;min-width:1180px;table-layout:fixed}.crm-price-table[data-currency-count="1"] th,.crm-price-table[data-currency-count="1"] td{position:static;min-width:0;max-width:none;width:auto;white-space:normal}.crm-price-table[data-currency-count="1"] th:first-child,.crm-price-table[data-currency-count="1"] td:first-child{width:100px}.crm-price-table[data-currency-count="1"] th:nth-child(2),.crm-price-table[data-currency-count="1"] td:nth-child(2){width:200px}.crm-price-table[data-currency-count="1"] th:nth-last-child(3),.crm-price-table[data-currency-count="1"] td:nth-last-child(3){width:155px}.crm-price-table[data-currency-count="1"] th:nth-last-child(2),.crm-price-table[data-currency-count="1"] td:nth-last-child(2){width:125px}.crm-price-table[data-currency-count="1"] th:last-child,.crm-price-table[data-currency-count="1"] td:last-child{width:190px}.crm-price-table[data-currency-count="1"] .toolbar{gap:4px;flex-wrap:wrap}

body.crm-tab-record #crmRecordSurface #utilityModal>.modal.crm-compact-reservation{width:100%!important;max-width:none!important;margin:0!important}body.crm-tab-record #crmRecordSurface .crm-compact-reservation .modal-head{padding:14px 18px!important}body.crm-tab-record #crmRecordSurface .crm-compact-reservation>form{padding:16px 18px!important}.crm-reserve-header{display:grid;grid-template-columns:1fr 1fr 1.4fr;gap:12px;min-width:0}.crm-reserve-editor{min-width:0;max-width:100%}.crm-reserve-tools{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap}.crm-reserve-note,.crm-reserve-editor small{font-size:11px;color:#66758e;line-height:1.5}.crm-reserve-editor [role=alert]{font-size:12px;color:#b42318;margin:6px 0}.crm-reserve-lines-wrap{max-height:260px;overflow:auto;border:1px solid #e1e7f0;border-radius:8px}.crm-reserve-lines{width:100%;table-layout:fixed}.crm-reserve-lines th:nth-child(1){width:26%}.crm-reserve-lines th:nth-child(3){width:120px}.crm-reserve-lines th:last-child{width:44px}.crm-reserve-lines th,.crm-reserve-lines td{padding:6px 8px!important}.crm-reserve-lines th{position:sticky;top:0;background:#f5f7fc;z-index:1}.crm-reserve-lines [data-reserve-description]{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:12px}.crm-compact-reservation .crm-reserve-reason textarea{min-height:54px!important}.crm-compact-reservation .crm-reserve-editor input,.crm-compact-reservation .crm-reserve-editor .btn{min-height:34px!important;padding:6px 8px!important;font-size:12px!important}.crm-reserve-import-preview{padding:10px;border:1px solid #d6e2f5;border-radius:8px;margin-bottom:10px}.crm-reserve-import-preview .table-wrap{max-height:150px;overflow:auto}.crm-reserve-import-preview select{max-width:220px}
@media(max-width:650px){.crm-reserve-header{grid-template-columns:1fr}.crm-reserve-lines{min-width:560px}.crm-reserve-tools .toolbar{gap:4px}.crm-reserve-lines-wrap{max-height:240px}body.crm-tab-record #crmRecordSurface .crm-compact-reservation>form{padding:12px!important}}

/* v179 warehouse histories: long references never overlap neighboring cells. */
.crm-kits-view table,.crm-receipts-view table{table-layout:fixed;min-width:1000px}
.crm-kits-view th:first-child,.crm-receipts-view th:first-child{width:220px}
.crm-kits-view td,.crm-receipts-view td{overflow:hidden;text-overflow:ellipsis;white-space:normal;overflow-wrap:anywhere}
.crm-kits-view td small{display:block;margin-top:4px;color:var(--muted,#617183)}
.crm-receipt-dialog{width:min(1100px,94vw);max-height:90vh;overflow:auto}
.crm-receipt-dialog table{min-width:800px}.crm-receipt-note{white-space:pre-wrap;overflow-wrap:anywhere}
#inventoryDocumentLines input{min-width:90px;width:100%;box-sizing:border-box}
#inventoryDocumentLines [name=sku]{min-width:150px}#inventoryDocumentLines [name=productName]{min-width:220px}
#inventoryDocumentLines textarea{min-width:220px;min-height:70px;box-sizing:border-box}
.crm-kit-editor{grid-column:1/-1}.crm-kit-editor input{min-width:140px}

/* Common list/form rhythm; operational tables retain their own column settings. */
@media screen{
 body:not(.crm-printing) #content :is(.section-head,.toolbar,.form-actions){max-width:100%;gap:8px 10px}
 body:not(.crm-printing) #content .toolbar{flex-wrap:wrap}
 body:not(.crm-printing) #content .section-head>:first-child{min-width:0;max-width:100%}
 body:not(.crm-printing) #content .section-head :is(h2,h3,p){overflow-wrap:anywhere}
 body:not(.crm-printing) #content table th{line-height:1.5;white-space:normal;overflow-wrap:anywhere}
 body:not(.crm-printing) #content .mini{min-width:0;overflow-wrap:anywhere}
 body:not(.crm-printing) #content .mini :is(span,strong,small){white-space:normal;line-height:1.5}
 body:not(.crm-printing) #content .crm-quotes .mini-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr))!important}
 body:not(.crm-printing) #content .btn:disabled{cursor:not-allowed;opacity:.5}
 body:not(.crm-printing) #content :is(button,a,input,select,textarea):focus-visible{outline:2px solid var(--crm-accent,#254fa4);outline-offset:2px}
 body:not(.crm-printing) #content .empty{padding:18px 12px;color:#64748b;line-height:1.6;white-space:normal}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
