/* Shared form and dialog foundations across warehouse, documents and finance. */
body .mud-dialog{display:flex;flex-direction:column;background:#fff;border:1px solid #e9eaeb;border-radius:12px!important;box-shadow:0 24px 48px -12px #0a0d1233;max-height:calc(100dvh - 48px)!important;color:#414651;font:var(--sar-type-body);overflow:hidden;}
body .mud-dialog-width-lg{width:960px;max-width:calc(100vw - 48px);}
body .mud-dialog-width-sm{width:480px;max-width:calc(100vw - 48px);}
body .mud-dialog .mud-dialog-title{flex-shrink:0;padding:24px!important;border-bottom:1px solid #e9eaeb;}
.sar-modal-header{position:relative;padding-right:48px;font-family:Inter,sans-serif;}
.sar-modal-icon{display:flex;align-items:center;justify-content:center;width:48px;height:48px;border:1px solid #e9eaeb;border-radius:10px;box-shadow:0 1px 2px #0a0d120d;margin-bottom:16px;background:white;}
.sar-modal-icon img{width:24px;height:24px;}
.sar-modal-header h2{font:var(--sar-type-section);color:#181d27;margin:0 0 8px;}
.sar-modal-header p{font:var(--sar-type-body);color:#535862;margin:0;max-width:720px;}
.sar-modal-close{position:absolute;top:0;right:0;display:flex;align-items:center;justify-content:center;width:48px;height:48px;border:0;border-radius:8px;background:white;color:#717680;font:400 28px/1 Inter,sans-serif;cursor:pointer;}
.sar-modal-close:hover{background:#fafafa;color:#181d27;}.sar-modal-close:focus-visible{outline:3px solid #fe470c60;outline-offset:2px;}
body .mud-dialog .mud-dialog-content{padding:24px!important;overflow-y:auto;overscroll-behavior:contain;min-height:0;}
body .mud-dialog .modal-form-container{padding:0;max-width:none;}
body .mud-dialog .mud-grid{width:calc(100% + 16px);margin:-8px;}
body .mud-dialog .mud-grid>.mud-grid-item{padding:8px;min-width:0;}
body .mud-dialog .mud-form>.mud-grid{margin-top:0;}
body .mud-dialog .mud-typography-caption{font:var(--sar-type-label);color:#414651;margin-bottom:6px;}
body .mud-dialog .mud-input-control{margin-top:0;min-width:0;}
body .mud-dialog .mud-input{margin-top:0;min-height:48px;background:white;border-radius:6px;}
body .mud-dialog .mud-input-outlined-border{border:1px solid #d5d7da;border-radius:6px;}
body .mud-dialog .mud-input-outlined:focus-within .mud-input-outlined-border{border-color:#fe470c;box-shadow:0 0 0 3px #fe470c1f;}
body .mud-dialog .mud-input-slot{font:var(--sar-type-body);padding:12px 14px;min-height:48px;box-sizing:border-box;}
body .mud-dialog textarea.mud-input-slot{min-height:96px;}
body .mud-dialog .mud-input-adornment .mud-icon-button{width:48px;height:48px;min-width:48px;min-height:48px;border-radius:6px;color:#717680;}
body .mud-dialog .mud-input-adornment{margin:0;}
body .mud-dialog .modal-product-card{background:#fff!important;border:1px solid #e9eaeb!important;border-radius:8px;box-shadow:0 1px 2px #0a0d120d!important;}
body .mud-dialog .modal-form-note{font:var(--sar-type-body);color:#535862;margin:0 0 16px;}
body .mud-dialog .mud-dialog-actions{flex-shrink:0;padding:20px 24px!important;border-top:1px solid #e9eaeb;gap:12px!important;background:#fff;}
body .mud-dialog .mud-button{min-height:48px;border-radius:8px!important;font:var(--sar-type-action);text-transform:none;box-shadow:0 1px 2px #0a0d120d;}
body .mud-dialog .sar-btn-secondary{background:white!important;color:#414651!important;border:1px solid #d5d7da!important;}
body .mud-dialog .sar-btn-tertiary{background:#fe470c!important;color:white!important;border:1px solid #ef4006!important;}
body .mud-dialog .sar-btn-secondary:hover{background:#fafafa!important;}body .mud-dialog .sar-btn-tertiary:hover{background:#e53e08!important;}
body .mud-dialog .mud-dialog-actions>.mud-grid{margin:0;width:100%;gap:12px;flex-wrap:nowrap;}
body .mud-dialog .mud-dialog-actions>.mud-grid>.mud-grid-item{flex:1;max-width:none;padding:0;}
body .mud-dialog .mud-dialog-actions .mud-button-label{white-space:normal;}
body .mud-dialog .modal-qr-image{display:block;width:280px;height:280px;max-width:100%;object-fit:contain;margin:0 auto;}
.mud-overlay.mud-overlay-dialog .mud-overlay-scrim{background:#181d2755;backdrop-filter:blur(4px);}
body .preview-modal{border:1px solid #e9eaeb;border-radius:12px;padding:24px;box-shadow:0 24px 48px -12px #0a0d1233;}
body .preview-modal h2{font:var(--sar-type-section);color:#181d27;}
body .preview-modal .figma-button{min-height:48px;}
body .finance-modal{gap:24px;}body .finance-modal .finance-modal-heading{margin-bottom:0;}
body .finance-modal input,body .finance-modal select,body .finance-modal textarea{font-size:14px;border-radius:6px;}
body .sar-confirm-modal{width:440px;}
body .sar-confirm-modal .mud-dialog-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}
body .sar-confirm-modal .mud-dialog-actions>.mud-button{width:100%;margin:0;}
body .sar-confirm-modal .modal-form-note{margin:0;line-height:24px;}
body .sar-confirm-modal .mud-dialog-title{border-bottom:0;}
body .sar-confirm-modal .mud-dialog-content{padding-top:0!important;}
@media(max-width:767px){
 body .mud-dialog{margin:16px!important;width:calc(100vw - 32px)!important;max-width:calc(100vw - 32px)!important;max-height:calc(100dvh - 32px)!important;}
 body .mud-dialog .mud-dialog-title,body .mud-dialog .mud-dialog-content{padding:20px!important;}
 body .mud-dialog .mud-dialog-actions{padding:16px 20px!important;}
 .sar-modal-header{padding-right:40px;}.sar-modal-header h2{font-size:18px;line-height:26px;}
 body .mud-dialog .mud-grid>.mud-grid-item{flex-basis:100%;max-width:100%;}
 body .mud-dialog .mud-dialog-actions>.mud-grid>.mud-grid-item{flex-basis:0;}
 body .mud-dialog .mud-dialog-actions:has(>.mud-grid){display:flex!important;}
 body .mud-dialog .mud-dialog-actions>.mud-button:only-child{width:100%;}
 body .mud-dialog .modal-product-card{padding:16px!important;}
 body .preview-modal{padding:20px;max-height:calc(100dvh - 32px);overflow:auto;}
}

body .sar-delivery-modal hr{border:0;border-top:1px solid #e9eaeb;margin:16px 0;opacity:1;}
.modal-document-number{display:flex;justify-content:space-between;gap:16px;padding:12px 16px;background:#fafafa;border:1px solid #e9eaeb;border-radius:8px;margin:0 0 20px;}
.modal-document-number span{color:#535862;}.modal-document-number strong{color:#181d27;font-weight:600;}
body .sar-delivery-modal .modal-remove-product,body .sar-delivery-modal .modal-add-product{min-width:48px;width:48px;min-height:48px;height:48px;border:1px solid #d5d7da;border-radius:8px!important;background:white;color:#717680;opacity:1;}
@media(max-width:767px){body .sar-delivery-modal .modal-delivery-row{flex-wrap:wrap;gap:12px;}body .sar-delivery-modal .modal-delivery-row>.mud-grid-item{flex:1 1 calc(50% - 12px);max-width:calc(50% - 6px);}body .sar-delivery-modal .modal-delivery-row>.mud-grid-item:first-child{flex-basis:100%;max-width:100%;}.modal-document-number{flex-wrap:wrap;}}

/* One item editor for both new and open delivery notes. */
body .mud-dialog:has(.sar-delivery-modal){width:1040px;max-width:calc(100vw - 48px);}
.delivery-items-table{min-width:780px;}
body .delivery-items-table th,body .delivery-items-table td{padding:14px 12px;vertical-align:middle;}
body .delivery-items-table th:first-child,body .delivery-items-table td:first-child{min-width:190px;}
body .delivery-items-table input{width:90px;min-width:90px;text-align:left;}
body .delivery-items-table .delivery-remove{width:40px;min-height:40px;padding:8px;}
.delivery-totals{display:flex;justify-content:flex-end;gap:24px;padding:20px 0;margin:0;}
.delivery-totals>div{min-width:160px;padding:16px;border:1px solid #e9eaeb;border-radius:8px;background:#fafafa;}
.delivery-totals dt{font:var(--sar-type-caption-medium);color:#535862;}
.delivery-totals dd{font:var(--sar-type-section);color:#181d27;margin:4px 0 0;}
@media(max-width:767px){body .mud-dialog:has(.sar-delivery-modal){width:calc(100vw - 32px);max-width:calc(100vw - 32px);}.delivery-totals{gap:12px;justify-content:stretch;}.delivery-totals>div{min-width:0;flex:1;padding:12px;}.delivery-totals dd{font-size:16px;}body .delivery-items-table .delivery-remove{width:48px;min-height:48px;}}

/* Delivery-note editor follows the supplied form composition. */
body .mud-dialog:has(.sar-delivery-editor){width:1180px;max-width:calc(100vw - 48px);}
body .mud-dialog:has(.sar-delivery-editor) .mud-dialog-title{padding:28px 32px 12px!important;border:0;position:relative;background:repeating-radial-gradient(circle at 64px 55px,transparent 0 29px,#f5f5f5 30px 31px,transparent 32px 60px);background-size:250px 210px;background-repeat:no-repeat;}
body .mud-dialog:has(.sar-delivery-editor) .mud-dialog-content{padding:0 32px 24px!important;}
body .mud-dialog:has(.sar-delivery-editor) .mud-dialog-actions{padding:0 32px 28px!important;border:0;display:grid;grid-template-columns:1fr 1fr;gap:20px!important;}
.delivery-editor-form{display:flex;flex-direction:column;gap:24px;}
.delivery-editor-form label{display:flex;flex-direction:column;gap:8px;color:#414651;font:var(--sar-type-label);min-width:0;}
.delivery-editor-form input,.delivery-editor-form textarea{width:100%;min-width:0;}
.delivery-type-nav{border-bottom:1px solid #e9eaeb;padding-top:12px;}
.delivery-type-nav span{display:block;color:#fe470c;text-align:center;border-bottom:2px solid #fe470c;padding:12px;font:var(--sar-type-navigation);}
.delivery-metadata{display:flex;flex-direction:column;gap:12px;padding:0 0 24px;border-bottom:1px solid #e9eaeb;}
.delivery-metadata>div,.delivery-metadata>label{display:grid;grid-template-columns:1fr 1fr;align-items:center;width:50%;gap:16px;}
.delivery-metadata strong{font-weight:400;color:#717680;overflow-wrap:anywhere;}
.delivery-dates{display:grid;grid-template-columns:1fr 1fr;gap:20px;}
.delivery-new-partner{align-self:flex-start;}
.delivery-item-list{border-top:1px solid #e9eaeb;}
.delivery-item-row{display:grid;grid-template-columns:minmax(180px,1.3fr) minmax(100px,1fr) minmax(80px,1fr) minmax(110px,1fr) minmax(110px,1fr) 48px;gap:16px;padding:24px 0;border-bottom:1px solid #e9eaeb;align-items:end;}
.delivery-money{display:flex;border:1px solid #d5d7da;border-radius:8px;overflow:hidden;min-height:48px;box-shadow:0 1px 2px #0a0d120d;}
.delivery-money>span{display:flex;align-items:center;padding:0 12px;border-right:1px solid #d5d7da;color:#535862;font-weight:400;}
body .delivery-money>input{border:0;box-shadow:none;border-radius:0;padding-inline:12px;}
.delivery-row-remove{width:48px;height:48px;border:1px dashed #fecdca;border-radius:50%;background:#fff;color:#f04438;display:flex;align-items:center;justify-content:center;cursor:pointer;}
.delivery-empty{padding:24px 0;color:#717680;}
.delivery-add-product{padding-bottom:0;border-bottom:0;}
.delivery-bill{width:50%;margin:0 0 12px auto;}
.delivery-bill>div{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0;}
.delivery-bill dt{font-weight:400;color:#717680;}.delivery-bill dd{margin:0;color:#717680;}
.delivery-bill .delivery-grand-total{border-top:1px solid #e9eaeb;margin-top:12px;padding-top:20px;}
.delivery-grand-total dt,.delivery-grand-total dd{font-weight:600;color:#414651;}
.delivery-discount{display:flex;align-items:center;width:130px;gap:6px;}.delivery-discount input{text-align:right;}
@media(max-width:1000px){.delivery-item-row{grid-template-columns:repeat(3,minmax(0,1fr));}.delivery-item-row>label:first-child{grid-column:span 2;}}
@media(max-width:767px){body .mud-dialog:has(.sar-delivery-editor){max-width:calc(100vw - 24px);}body .mud-dialog:has(.sar-delivery-editor) .mud-dialog-title{padding:24px 20px 12px!important;}body .mud-dialog:has(.sar-delivery-editor) .mud-dialog-content{padding:0 20px 20px!important;}body .mud-dialog:has(.sar-delivery-editor) .mud-dialog-actions{padding:0 20px 24px!important;gap:12px!important;}.delivery-metadata>div,.delivery-metadata>label,.delivery-bill{width:100%;}.delivery-dates{grid-template-columns:1fr;gap:16px;}.delivery-item-row{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}.delivery-item-row>label:first-child{grid-column:1/-1;}.delivery-row-remove{justify-self:end;}.delivery-editor-form{gap:20px;}}

.delivery-bill{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));width:100%;gap:20px;border-top:1px solid #e9eaeb;padding-top:24px;}
.delivery-bill>div{flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:8px;padding:0;}
.delivery-bill dd{font-size:20px;line-height:28px;}
.delivery-bill .delivery-grand-total{border-top:0;margin-top:0;padding-top:0;}
.delivery-bill:has(>div:nth-child(5)){grid-template-columns:repeat(5,minmax(0,1fr));}
.delivery-bill .delivery-discount input{width:80px;}
@media(max-width:767px){.delivery-bill,.delivery-bill:has(>div:nth-child(5)){grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;}.delivery-bill .delivery-grand-total{grid-column:1/-1;flex-direction:row;justify-content:space-between;border-top:1px solid #e9eaeb;padding-top:16px;}}

.delivery-recipient-row{display:flex;align-items:flex-end;gap:16px;}
.delivery-recipient-row .delivery-recipient{flex:1;min-width:0;}
.delivery-recipient-row .delivery-new-partner{height:48px;min-height:48px;margin:0;flex-shrink:0;align-self:flex-end;}
.delivery-bill>div{justify-content:space-between;}
.delivery-bill .delivery-discount{display:flex;align-items:center;border:1px solid #d5d7da;border-radius:8px;background:#fff;height:36px;max-width:88px;overflow:hidden;}
.delivery-bill .delivery-discount input{width:60px!important;min-width:0;min-height:0!important;height:34px!important;padding:4px 8px!important;border:0!important;border-radius:0;box-shadow:none!important;font:var(--sar-type-intro);}
.delivery-bill .delivery-discount span{padding-right:8px;font:var(--sar-type-body);}
@media(max-width:767px){.delivery-recipient-row{gap:12px;}.delivery-recipient-row .delivery-new-partner{padding:10px 12px;}.delivery-bill .delivery-discount{height:48px;max-width:100px;}.delivery-bill .delivery-discount input{height:46px!important;width:72px!important;}}

body .delivery-money>input{border:0!important;border-radius:0!important;box-shadow:none!important;outline-offset:-3px;}
.delivery-metadata>div{width:100%;grid-template-columns:minmax(0,1fr) auto;}
.delivery-metadata strong{text-align:right;font-size:20px;line-height:28px;font-weight:500;}
.delivery-recipient-row .delivery-recipient{margin:0;}
body .delivery-recipient-row .partner-dropdown{box-sizing:border-box;height:48px;min-height:48px;}
body .delivery-recipient-row .partner-dropdown-trigger{height:46px;min-height:46px;}
body .delivery-recipient-row .delivery-new-partner{box-sizing:border-box;height:48px!important;min-height:48px!important;margin:0!important;}

.product-edit-selector{display:flex;gap:12px;align-items:flex-end;}
.product-edit-selector label{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px;margin:0;font:var(--sar-type-label);}
.product-edit-selector input{width:100%;}
.product-edit-selector button{height:48px;min-height:48px;flex-shrink:0;}
.product-edit-selected{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;color:#717680;font:var(--sar-type-body);}
.product-edit-selected strong{color:#414651;font-weight:500;}
