.contract-editor{gap:16px!important}.contract-editor>header h3{font-weight:700}.contract-fields{display:flex;flex-wrap:wrap;gap:12px 16px;align-items:start}.contract-fields>.day-field{flex:1 1 240px;min-width:0;max-width:100%}.contract-fields>.contract-field-short{flex:0 1 190px}.contract-fields>.contract-field-money{flex:0 1 260px}.contract-fields>.contract-field-wide{flex:1 1 100%}.contract-section{border-block-start:1px solid var(--line,#b8c6cf);padding-block:12px}.contract-section>summary{cursor:pointer;font-weight:700;padding:4px 0;color:var(--text,#243746)}.contract-section[open]>.contract-fields{margin-top:12px}.contract-editor textarea{resize:vertical;min-height:76px}.contract-payments h4{margin:0;font-size:15px;font-weight:700}.contract-payment-table{min-width:760px}.contract-payment-table input{width:100%;min-width:0}.contract-payment-table td:nth-child(1){width:120px}.contract-payment-table td:nth-child(2){width:165px}.contract-payment-table td:nth-child(4){width:190px}.contract-payment-table td:last-child{width:44px}.contract-editor footer{display:flex;flex-wrap:wrap;gap:12px;align-items:center}.contract-pagination{display:flex;justify-content:center;align-items:center;gap:12px;margin-top:12px}.contract-pdf-dialog{width:min(980px,95vw);height:92dvh;padding:12px;border:1px solid #557182;border-radius:8px}.contract-pdf-dialog::backdrop{background:#15293280}.contract-pdf-dialog[open]{display:flex;flex-direction:column;gap:10px}.contract-pdf-dialog header{display:flex;align-items:center;gap:12px}.contract-pdf-dialog header strong{margin-inline-end:auto}.contract-pdf-dialog iframe{flex:1;width:100%;border:0;min-height:0}html:has(.contract-pdf-dialog[open]),body:has(.contract-pdf-dialog[open]){overflow:hidden!important}@media(max-width:760px){.contract-fields>.day-field{flex-basis:100%}.contract-fields>.contract-field-short{flex-basis:calc(50% - 8px)}.contract-pdf-dialog{width:100%;max-width:100%;height:100dvh;max-height:100dvh;margin:0;border-radius:0}}
.contract-fields.day-compact-form>.day-field{flex:1 1 320px}.contract-fields.day-compact-form>.contract-field-short{flex:0 1 250px}.contract-fields.day-compact-form>.contract-field-money{flex:0 1 330px}.contract-fields.day-compact-form>.contract-field-wide{flex:1 1 100%}.contract-editor>.contract-fields.day-compact-form>.contract-field-wide{flex:1 1 340px}.contract-fields.day-compact-form>.day-field[hidden]{display:none!important}.contract-payments>.day-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;min-width:0}.contract-payments>.day-section-head h4{font-size:15px;font-weight:700}.contract-payments>.day-section-head output{font-size:12px;font-weight:500}.contract-payments>.module-table-wrap{margin-bottom:12px}@media(max-width:760px){.contract-fields.day-compact-form>.day-field,.contract-editor>.contract-fields.day-compact-form>.contract-field-wide{flex:1 1 100%}.contract-payments>.day-section-head{flex-wrap:wrap;padding-inline:12px}}
.contract-editor{grid-template-columns:minmax(0,1fr)!important;grid-auto-rows:max-content;align-content:start}.contract-editor>*{min-width:0}.contract-payments{min-width:0}
.contract-editor.day-action-panel>header{box-shadow:0 -24px var(--day-module-soft,#fff)}
.contract-editor .contract-payments>.day-section-head{justify-content:flex-start}.contract-editor .contract-payments>.day-section-head>output{margin-inline-start:auto}
.contract-pdf-pages{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;background:#49555e;padding:12px;display:grid;gap:12px;align-content:start}.contract-pdf-page{margin:0 auto;width:100%;max-width:794px;background:white;line-height:0}.contract-pdf-page canvas{display:block;width:100%;height:auto}.contract-print-frame{position:fixed;width:1px;height:1px;inset:0;border:0;opacity:0;pointer-events:none}.contract-pdf-dialog>[data-pdf-status]{margin:0;font-size:12px}
/* Invoice rows stay together; the table wrapper scrolls on compact screens. */
.preinvoice-lines{min-width:1284px;table-layout:fixed}
.preinvoice-lines th:first-child{width:260px}
.preinvoice-lines th:nth-child(2){width:65px}
.preinvoice-lines th:nth-child(3){width:85px}
.preinvoice-lines th:nth-child(4){width:205px}
.preinvoice-lines th:nth-child(5),.preinvoice-lines th:nth-child(6){width:165px}
.preinvoice-lines th:nth-child(7){width:195px}
.preinvoice-lines [data-line-total]{white-space:nowrap;font-weight:700}
.preinvoice-editor>section>.day-section-head{display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:8px 14px;margin:0}
.preinvoice-editor>section>.day-section-head h4{margin:0;font-size:15px;font-weight:700}
.preinvoice-lines th:last-child{width:44px}
.preinvoice-lines th:nth-child(5){width:235px}
.preinvoice-editor:has([data-adjust=taxMode] option[value=percent]:checked) .preinvoice-lines [data-col=tax]{display:none}
.preinvoice-lines td:has([data-row-field=discountValue]){display:grid;grid-template-columns:76px minmax(0,1fr);gap:6px;align-items:center}
.preinvoice-lines td:has([data-row-field=discountValue]) .day-select{width:76px;min-width:0}
.preinvoice-lines td:has([data-row-field=discountValue]) .day-select-button{padding-inline:6px}
.preinvoice-adjustments{display:flex;flex-wrap:wrap;gap:14px 24px;align-items:center;padding:16px 14px;border-block:1px solid #a7b9d3;margin-top:12px;background:#f3f6fc}
.preinvoice-adjustments>.day-field{display:flex;align-items:center;gap:8px;flex:0 1 auto;min-width:0;font-weight:700}
.preinvoice-adjustments input{width:170px;max-width:100%;box-sizing:border-box;font-weight:400}
.preinvoice-adjustments [data-adjust=taxRate]{width:90px;direction:ltr;font-family:'DayVazirDigits','Vazir',sans-serif}
.preinvoice-adjustments .day-select{width:170px;min-width:0;font-weight:400}
@media(max-width:760px){.preinvoice-adjustments>.day-field{flex-wrap:wrap}.preinvoice-adjustments input{width:140px}.preinvoice-adjustments .day-select{width:140px}}
.preinvoice-lines input{width:100%;min-width:0;box-sizing:border-box}
/* Canonical identifiers have semantic widths, independent of wide subject/name fields. */
.contract-fields>.day-field:has(>input:is([data-pi-field="buyer.nationalId"],[data-pi-field="buyer.phone"],[name$=".national_id"],[name$=".phone"],[name="buyer.representative_phone"])) {display:flex;align-items:center;gap:8px;flex:0 1 auto;width:auto;max-width:100%}
.contract-fields>.day-field:has(>input:is([data-pi-field="buyer.nationalId"],[data-pi-field="buyer.phone"],[name$=".national_id"],[name$=".phone"],[name="buyer.representative_phone"]))>span {width:auto;flex:none}
.contract-fields>.day-field>input:is([data-pi-field="buyer.nationalId"],[data-pi-field="buyer.phone"],[name$=".national_id"],[name$=".phone"],[name="buyer.representative_phone"]) {flex:0 1 145px;width:145px;max-width:100%;font-family:'DayVazirDigits','Vazirmatn',sans-serif!important;direction:ltr;text-align:center}
.preinvoice-total{display:block;text-align:end;font-weight:700;padding:12px;color:var(--module-accent,#245b72)}
.preinvoice-editor .preinvoice-total{display:flex;justify-content:flex-end;gap:14px 24px;flex-wrap:wrap;padding:14px 0;border-bottom:1px solid #a7b9d3}
.preinvoice-total>span{display:grid;gap:4px;min-width:120px}.preinvoice-total>span>small{font-size:12px;font-weight:400;color:#52627b}.preinvoice-total>span>b{font-size:15px;color:#26364e}.preinvoice-total>span:last-child>b{color:#204da9;font-size:18px}.preinvoice-total b small{font-size:12px;font-weight:400}
.crm-related-documents{padding:12px 14px;border-top:1px solid #aab7c4}
.crm-related-documents h4{margin:0 0 10px;font-weight:700}
.crm-related-documents button{margin:0 0 8px 8px;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.preinvoice-shelf-calculator{border-block:1px solid var(--border-color,#b6c2d2);padding-block:12px;margin-block:12px;min-width:0}
.preinvoice-shelf-calculator .shelf-workspace{grid-template-columns:minmax(0,1fr) 260px}
.preinvoice-production{border-block-start:2px solid #a63049;padding-block:12px;margin-block-start:12px}
.preinvoice-production-actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.preinvoice-production-actions .day-field{flex:none;width:250px;max-width:100%}
.preinvoice-production [data-stage]{font-size:13px;font-weight:700;color:#754109}
.preinvoice-production [data-stage][data-state=approved]{color:#6e3292}
.preinvoice-production [data-stage][data-state=issued]{color:#9b2945}
.shelf-production-editor{max-width:1100px}
.preinvoice-editor>.preinvoice-terms{position:relative;display:block;padding:14px;border-block:1px solid var(--line,#a7b9d3);background:var(--day-module-soft,#f2f5fc)}
.preinvoice-terms>.day-field{display:grid;gap:10px;min-width:0}
.preinvoice-terms>.day-field>span{font-weight:700;padding-inline-end:44px;color:var(--text,#243041)}
.preinvoice-terms textarea,.preinvoice-settings textarea{width:100%;max-width:100%;box-sizing:border-box;min-height:120px;line-height:1.8;resize:vertical}
.preinvoice-terms>[data-pi-action=settings]{position:absolute;inset-inline-end:14px;top:8px}
.preinvoice-settings{max-width:880px}
.preinvoice-settings .preinvoice-terms-field{display:grid;gap:12px;min-width:0}
.preinvoice-settings .preinvoice-terms-field>span{font-weight:700}
.preinvoice-settings textarea{min-height:210px}
.preinvoice-editor .preinvoice-lines{min-width:1510px}
.preinvoice-editor .preinvoice-lines th[data-col=image]{width:76px}
.preinvoice-editor .preinvoice-lines th[data-col=description]{width:240px}
.preinvoice-editor .preinvoice-lines th[data-col=notes]{width:220px}
.preinvoice-editor .preinvoice-lines th[data-col=unit]{width:65px}
.preinvoice-editor .preinvoice-lines th[data-col=quantity]{width:85px}
.preinvoice-editor .preinvoice-lines th[data-col=unitPrice]{width:190px}
.preinvoice-editor .preinvoice-lines th[data-col=discountValue]{width:210px}
.preinvoice-editor .preinvoice-lines th[data-col=tax]{width:165px}
.preinvoice-editor .preinvoice-lines th[data-col=total]{width:185px}
.preinvoice-editor .preinvoice-lines th[data-col=action]{width:44px}
.preinvoice-editor .preinvoice-lines [data-row-field=notes]{min-height:56px;height:56px;width:100%;box-sizing:border-box;line-height:1.7;resize:vertical}
.preinvoice-row-photo{position:relative;display:grid;place-items:center;min-height:56px}
.preinvoice-row-photo>[data-pi-action=photo]{width:56px;min-width:56px;height:56px;padding:3px!important;overflow:hidden}
.preinvoice-row-photo img{display:block;width:100%;height:100%;object-fit:contain;background:#fff}
.preinvoice-row-photo>[data-pi-action=clear-photo]{position:absolute;inset-inline-end:-2px;top:-4px;width:24px!important;min-width:24px!important;height:24px!important;padding:2px!important}
.preinvoice-print-style{display:inline-flex;gap:0;flex:none;max-width:100%;border:1px solid var(--line,#a7b9d3);border-radius:4px;overflow:hidden}
.preinvoice-print-style>button{border:0!important;border-radius:0!important;margin:0!important}
.preinvoice-print-style>button[aria-pressed=true]{background:var(--day-module-accent,#2455b8)!important;color:#fff!important}
.shelf-production-editor .module-table{min-width:520px}
.shelf-production-editor>section{min-width:0;margin:0;display:grid;gap:10px}
.shelf-production-editor>.day-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.shelf-production-editor>.day-section-head>div{min-width:0}
.shelf-production-editor>.day-section-head p{margin:6px 0 0}
.shelf-production-editor>section>h4{margin:0;font-weight:700}
.shelf-production-editor>section>p{margin:0;font-size:12px;color:var(--text-secondary,#526479)}
@media(max-width:1050px){.preinvoice-shelf-calculator .shelf-workspace{grid-template-columns:minmax(0,1fr)}}
.contract-field-error{display:block;color:#a51c38;font-size:12px;font-weight:600;white-space:normal;margin-top:6px}
.contract-editor [data-contract-invalid]{border:2px solid #b52142!important;outline-offset:2px}
.contract-editor .contract-payment-table td:first-child{width:180px;min-width:180px}
.contract-payment-table .day-date-field{width:180px;max-width:100%}
.contract-payment-table .day-date-control{display:grid;grid-template-columns:minmax(0,1fr) 40px;width:100%}
.contract-payment-table .day-date-text{min-width:0;text-align:left;direction:ltr}
.contract-payments>.day-section-head{justify-content:flex-start;flex-wrap:wrap;gap:12px}
.contract-reference{border-block:1px solid var(--line,#a7b9d3);padding-block:10px;min-width:0}
.contract-reference>.day-section-head{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:4px 14px 12px}
.contract-reference h4{display:flex;align-items:center;gap:8px;margin:0;font-size:14px;font-weight:700}
.contract-reference .contract-reference-fields{gap:12px 16px}
.contract-reference-fields>.contract-reference-numbers{flex:0 1 300px}
.contract-reference-fields>.contract-field-wide{flex:1 1 340px}
.contract-reference-fields>.contract-field-short{flex:0 1 190px}
.contract-source-revision{font-size:12px;color:#52627b}
.contract-source-dialog{width:min(820px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:85dvh;padding:16px;border:1px solid #9aaac0;border-radius:8px;box-sizing:border-box;font-family:Vazir,sans-serif;color:#26364e;background:#fff}
.contract-source-dialog::backdrop{background:#17243c80}
.contract-source-dialog form{display:grid;gap:16px;min-width:0}
.contract-source-dialog .day-section-head{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:0 14px}
.contract-source-dialog h3{font-size:17px;font-weight:700;margin:0}
.contract-source-dialog .module-table-wrap{max-height:52dvh;overflow:auto}
.contract-source-table{min-width:540px}
.contract-source-table td:nth-child(2){text-align:right;max-width:360px;overflow-wrap:anywhere}
.contract-source-table td:nth-child(2)>span{display:block;margin-top:4px}
.contract-source-table input{width:18px;height:18px;accent-color:#2857b7}
.contract-source-table tr:has(input:checked){background:#eef3ff}
.contract-source-dialog footer{display:flex;flex-wrap:wrap;align-items:center;gap:12px}
.contract-source-dialog output{margin-inline-end:auto;font-weight:700;font-size:13px}
.contract-source-dialog [role=alert]{margin:0;color:#a51c38}
.contract-source-items>summary{display:flex;align-items:center;gap:12px;padding:8px 14px;flex-wrap:wrap;background:#f0f4fc;border-inline-start:3px solid #2857b7}
.contract-source-items>summary>span:first-of-type{flex:1 1 250px;min-width:0;overflow-wrap:anywhere}
.contract-source-items>summary>span:last-child{font-size:12px;font-weight:500}
.contract-source-items .module-table-wrap{margin-top:12px}
.contract-quote-lines{min-width:740px;table-layout:auto}
.contract-quote-lines td{font-size:12px}
.contract-quote-lines .day-description-cell{min-width:200px;max-width:380px;white-space:normal;overflow-wrap:anywhere;text-align:right}
.contract-quote-summary{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:center;padding:12px 14px;background:#f3f5fa;font-size:12px}
.contract-quote-summary>strong{margin-inline-start:auto;color:#244995;font-size:14px}
@media(max-width:760px){.contract-reference>.day-section-head,.contract-source-dialog .day-section-head{padding-inline:12px}.contract-reference-fields>.day-field{flex:1 1 100%}.contract-source-dialog{padding:12px}.contract-source-dialog footer>output{flex-basis:100%}.contract-source-items>summary{padding-inline:12px}}

/* Semantic widths and clear disclosures; contract snapshots and submission stay unchanged. */
.contract-editor{font-size:15px;line-height:1.8;gap:18px!important}
.contract-editor>.contract-primary-fields,.contract-editor>.contract-reference,.contract-editor>.contract-payments{border:1px solid #c5d2e5;border-radius:13px;padding:16px;background:#fff}
.contract-editor>.contract-primary-fields{background:#f5f7fc}
.contract-editor .contract-fields.day-compact-form>.day-field{flex:0 1 300px;min-width:0;gap:7px}
.contract-editor .contract-fields.day-compact-form>.contract-field-short{flex:0 1 220px}
.contract-editor .contract-fields.day-compact-form>.contract-field-money{flex:0 1 300px}
.contract-editor .contract-fields.day-compact-form>.contract-field-wide{flex:1 1 100%}
.contract-editor>.contract-primary-fields.day-compact-form>.contract-field-wide{flex:1 1 340px;max-width:640px}
.contract-editor .contract-reference-fields.day-compact-form>.contract-reference-numbers{flex:0 1 340px;max-width:380px}
.contract-editor .contract-reference-fields.day-compact-form>.contract-field-reference-title{flex:1 1 340px;max-width:600px}
.contract-editor .contract-reference-fields.day-compact-form>.contract-field-short{flex:0 1 230px}
.contract-editor .day-field>span{font-size:14px;font-weight:700;line-height:1.7}
.contract-editor input,.contract-editor textarea{font-size:15px;line-height:1.8}
.contract-editor textarea{min-height:90px;padding:12px;line-height:1.9}
.contract-editor [name^="texts."]{font-size:16px;line-height:2;min-height:130px}
.contract-editor>.contract-section{border:1px solid #bdcce1;border-radius:13px;padding:0;background:#fff;overflow:clip}
.contract-section>summary{list-style:none;display:flex;align-items:center;gap:12px;padding:14px 16px;background:#edf2fc;color:#1b3e72;min-height:56px;box-sizing:border-box;cursor:pointer}
.contract-section>summary::-webkit-details-marker{display:none}
.contract-section>summary::after{content:'';border-inline-start:2px solid currentColor;border-block-end:2px solid currentColor;width:8px;height:8px;transform:rotate(-45deg);margin-inline-start:4px;flex:none}
.contract-section[open]>summary::after{transform:rotate(135deg)}
.contract-section>summary:hover{background:#e1e9fb}.contract-section>summary:focus-visible{outline:3px solid #315bc8;outline-offset:-3px}
.contract-section[open]>summary{border-bottom:1px solid #bdcce1}
.contract-section-icon{display:grid;place-items:center;width:36px;height:36px;flex:none;border-radius:10px;background:#dae4fc;color:#234b9b}.contract-section-icon svg{width:20px;height:20px}
.contract-section-heading{display:grid;gap:2px;flex:1;min-width:0}.contract-section-heading>strong{font-size:16px;font-weight:800}.contract-section-heading>small{font-size:13px;font-weight:400;color:#344d67}
.contract-disclosure-cue{font-size:13px;color:#234b9b;font-weight:700;white-space:nowrap;margin-inline-start:auto}.contract-section .when-open{display:none}.contract-section[open] .when-open{display:inline}.contract-section[open] .when-closed{display:none}
.contract-section[open]>.contract-fields{padding:16px;margin:0}.contract-section>.module-table-wrap,.contract-section>.contract-quote-summary{margin:14px}
.contract-section.contract-source-items>summary>span:first-child{flex:1;min-width:0}.contract-section.contract-source-items>summary>span:last-of-type{font-size:13px;white-space:nowrap;margin-inline-start:auto}
.contract-editor{gap:12px!important}
.contract-editor .contract-fields.day-compact-form{gap:9px 12px}
.contract-editor .contract-fields.day-compact-form>.contract-field-identity{flex:0 1 330px;max-width:100%}
.contract-editor .contract-field-identity>input{min-inline-size:9.5rem}
.contract-editor .contract-fields.day-compact-form>.contract-field-address{flex:1 1 min(30rem,100%);max-inline-size:38rem}
.contract-editor .contract-field-address>textarea{min-block-size:58px;padding:8px 10px}
.contract-editor .contract-fields.day-compact-form>.contract-field-date{flex:0 1 330px;max-width:100%}
.contract-editor .contract-field-date .day-date-control{min-inline-size:10.75rem;max-inline-size:100%}
.contract-editor .contract-field-date .day-date-text{min-inline-size:6.6rem;text-align:center;padding-inline:4px}
.contract-field-caption{display:inline-flex;align-items:center;gap:5px}
.contract-field-caption>svg{inline-size:16px;block-size:16px;flex:none}
.contract-editor :is([data-contract-error],[data-error])[data-kind=error]:not([hidden]){
  display:flex;align-items:flex-start;gap:8px;background:#fff1f2!important;color:#952439!important;
  border:1px solid #efb6bd!important;padding:9px 12px;white-space:pre-wrap
}
.contract-editor :is([data-contract-error],[data-error])>svg{width:18px;height:18px;flex:none;margin-block-start:2px}
.contract-editor [data-contract-field-error]{flex-basis:100%;max-width:100%;white-space:normal;line-height:1.6}
.contract-editor label:has([data-contract-field-error]){flex-wrap:wrap}
[data-contract-articles]{flex:1 1 100%;min-width:0}
.contract-article-toolbar{display:flex;align-items:end;gap:8px;flex-wrap:wrap;margin-block-end:10px}
.contract-article-toolbar>label{display:grid;gap:4px;min-width:min(12rem,100%)}
.contract-article-toolbar>output{align-self:center;font-weight:700;margin-inline-end:auto}
.contract-article-toolbar>[data-article-message]{flex-basis:100%;margin:0;color:#754500}
.contract-article{display:grid;gap:7px;padding:9px 10px;border-block-start:1px solid #d3deed}
.contract-article>header,.contract-article>header>div{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.contract-article>header{justify-content:space-between}
.contract-article label{display:grid;gap:3px;min-width:0}
.contract-article [data-article-title]{max-inline-size:26rem}
.contract-article textarea{min-block-size:56px;line-height:1.65;padding:7px 9px}
.contract-article-note{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end;padding-inline-start:10px}
@media(max-width:570px){
  .contract-editor .contract-field-date,.contract-editor .contract-field-identity{flex-wrap:wrap}
  .contract-editor .contract-field-date .day-date-control{flex:0 1 12.5rem}
  .contract-editor .contract-field-identity>input{flex:0 1 11.5rem}
}
@media(max-width:760px){.contract-editor>.contract-primary-fields,.contract-editor>.contract-reference,.contract-editor>.contract-payments{padding:12px}.contract-editor .contract-fields.day-compact-form>.day-field,.contract-editor>.contract-primary-fields.day-compact-form>.contract-field-wide{flex:1 1 280px;max-width:100%}.contract-editor .contract-fields.day-compact-form>.contract-field-short{flex:0 1 220px}.contract-editor .contract-fields.day-compact-form>.contract-field-money{flex:0 1 280px}.contract-section>summary{padding:12px}.contract-section-heading>small{font-size:13px}.contract-disclosure-cue{display:none}.contract-section[open]>.contract-fields{padding:12px}.contract-section.contract-source-items>summary{flex-wrap:wrap}.contract-editor input,.contract-editor textarea{font-size:16px}}
