/* Finance document editor. These rules apply only while this form is open. */
#modalCard:has(.iq-editor){width:calc(100vw - 40px);max-width:1160px;height:min(900px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);border-radius:16px;}
#modalCard:has(.iq-editor) .modal-head{padding:18px 24px;flex-shrink:0;}
#modalCard:has(.iq-editor) .modal-head h3{font-size:21px;font-weight:750;letter-spacing:-.025em;line-height:1.3;margin:0;}
#modalCard:has(.iq-editor) .modal-body{padding:0;display:flex;flex-direction:column;overflow:hidden;flex:1;min-height:0;}
.iq-editor{display:flex;flex-direction:column;flex:1;min-height:0;margin:0;color:#213044;font-family:Inter,Arial,sans-serif;font-size:14px;}
.iq-editor *{box-sizing:border-box;}
.iq-editor [hidden]{display:none!important;}
.iq-editor .iq-scroll{overflow-y:auto;min-height:0;flex:1;padding:18px 24px 24px;scrollbar-gutter:stable;}
.iq-editor .iq-intro{margin:0 0 18px;color:#66758a;font-size:13px;line-height:1.5;}
.iq-editor .iq-meta-grid{display:grid;grid-template-columns:1.1fr 1fr 1fr;gap:18px;padding:16px 18px;background:#f5f7fa;border:1px solid #e4e9f0;border-radius:10px;margin-bottom:18px;}
.iq-editor .iq-field{display:flex;flex-direction:column;gap:6px;min-width:0;margin:0;}
.iq-editor .iq-field-label{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px;color:#42526a;font-size:12px;font-weight:650;line-height:1.5;text-transform:none;letter-spacing:0;}
.iq-editor .iq-hint{font-size:10px;font-weight:400;color:#7c8899;}
.iq-editor .iq-field input,.iq-editor .iq-field select,.iq-editor .iq-field textarea{width:100%;min-width:0;min-height:42px;padding:10px 11px;margin:0;border:1px solid #d9e0e8;border-radius:7px;background:#fff;color:#253349;font:400 13px/1.4 Inter,Arial,sans-serif;box-shadow:none;outline:none;}
.iq-editor .iq-field input[readonly]{color:#607087;background:#edf1f5;cursor:default!important;}
.iq-editor .iq-field textarea{min-height:98px;resize:vertical;}
.iq-editor .iq-field input:focus,.iq-editor .iq-field select:focus,.iq-editor .iq-field textarea:focus,.iq-editor .line-row input:focus,.iq-editor .line-row textarea:focus{border-color:#ed7a35;box-shadow:0 0 0 3px #ed7a351b;outline:none;}
.iq-editor input::placeholder,.iq-editor textarea::placeholder{color:#8a96a7;opacity:1;}
.iq-editor .iq-details-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-bottom:18px;}
.iq-editor .iq-section{border:1px solid #e1e6ed;border-radius:10px;padding:16px 18px;background:#fff;min-width:0;}
.iq-editor .iq-section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px;}
.iq-editor .iq-section-heading h4{margin:0;color:#253349;font-size:14px;font-weight:750;letter-spacing:-.01em;line-height:1.4;text-transform:none;}
.iq-editor .iq-section-heading>span{font-size:11px;color:#7a8798;}
.iq-editor .iq-section-heading p{font-size:11px;color:#7a8798;margin:4px 0 0;line-height:1.4;}
.iq-editor .iq-fields-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px 14px;}
.iq-editor .iq-full{grid-column:1/-1;}
.iq-editor .iq-items-section{padding-bottom:10px;margin-bottom:18px;}
.iq-editor button{font-family:inherit;cursor:pointer;transition:background .15s,border-color .15s;}
.iq-editor button:focus-visible{outline:3px solid #ffad76;outline-offset:2px;}
.iq-editor .iq-add-button{border:1px solid #d8e0e9;border-radius:7px;background:#fff;color:#2d4059;padding:9px 13px;font-size:12px;font-weight:650;white-space:nowrap;min-height:38px;}
.iq-editor .iq-add-button:hover{background:#f5f7fa;border-color:#adbaca;}
.iq-editor .iq-items-head,.iq-editor .line-row{display:grid;grid-template-columns:22px minmax(160px,1fr) 76px 124px 132px 32px;gap:10px;align-items:start;}
.iq-editor .iq-items-head{background:#f5f7fa;margin:0 -18px 0;padding:10px 18px;color:#64748a;font-size:10px;font-weight:700;letter-spacing:.02em;border-top:1px solid #e8edf2;border-bottom:1px solid #e8edf2;}
.iq-editor .iq-numeric-heading{text-align:right;padding-right:10px;}
.iq-editor .line-row{margin:0;padding:12px 0;border-bottom:1px solid #edf0f4;}
.iq-editor .line-row:last-child{border-bottom:0;}
.iq-editor .iq-row-number{padding-top:12px;color:#8591a1;font-size:11px;font-variant-numeric:tabular-nums;}
.iq-editor .iq-item-field{display:block;min-width:0;margin:0;}
.iq-editor .line-row .li-desc,.iq-editor .line-row input{width:100%;min-width:0;margin:0;min-height:42px;padding:10px 9px;border:1px solid #d9e0e8;border-radius:7px;background:#fff;color:#253349;font:400 13px/20px Inter,Arial,sans-serif;}
.iq-editor .line-row .li-desc{display:block;resize:vertical;height:42px;max-height:180px;}
.iq-editor .line-row .li-qty,.iq-editor .line-row .li-rate,.iq-editor .line-row .li-amt{text-align:right;font-variant-numeric:tabular-nums;}
.iq-editor .line-row .li-amt{font-weight:650;background:#f7f9fb;}
.iq-editor .iq-remove-button{width:32px;height:42px;border:0;background:transparent;font-size:22px;line-height:1;color:#91a0b2;border-radius:6px;}
.iq-editor .iq-remove-button:hover{color:#b42318;background:#fff1ee;}
.iq-editor .iq-mobile-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.iq-editor .iq-empty-items{color:#7a8798;font-size:12px;margin:18px 0;}
.iq-editor .iq-bottom-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:32px;}
.iq-editor .iq-summary{border:1px solid #e1e6ed;border-radius:10px;background:#f8fafc;padding:14px 16px;}
.iq-editor .iq-subtotal{display:flex;justify-content:space-between;gap:10px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid #e1e6ed;font-size:12px;color:#607087;}
.iq-editor .iq-subtotal strong{font-size:13px;color:#253349;font-variant-numeric:tabular-nums;}
.iq-editor .iq-summary input{text-align:right;font-variant-numeric:tabular-nums;}
.iq-editor .iq-summary-hint{margin:5px 0 0;font-size:10px;line-height:1.5;color:#7a8798;}
.iq-editor .iq-payment-date{max-width:250px;margin-top:12px;}
.iq-editor .iq-actions{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:15px 24px;border-top:1px solid #dce3eb;background:#fff;box-shadow:0 -5px 16px #24364b07;flex-shrink:0;}
.iq-editor .iq-total{display:flex;flex-direction:column;gap:3px;min-width:0;}
.iq-editor .iq-total>span{font-size:10px;color:#718097;text-transform:uppercase;letter-spacing:.09em;font-weight:700;}
.iq-editor .iq-total>strong{font:750 24px/1.2 Inter,Arial,sans-serif;letter-spacing:-.03em;color:#20334b;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
.iq-editor .iq-action-buttons{display:flex;gap:10px;flex-shrink:0;}
.iq-editor .iq-cancel-button,.iq-editor .iq-save-button{padding:12px 19px;border-radius:8px;font-size:13px;font-weight:650;line-height:1.3;min-height:44px;}
.iq-editor .iq-cancel-button{background:#fff;border:1px solid #d9e0e8;color:#53647a;}
.iq-editor .iq-save-button{background:#ed6b1b;border:1px solid #ed6b1b;color:#fff;}
.iq-editor .iq-cancel-button:hover{background:#f5f7fa;}
.iq-editor .iq-save-button:hover{background:#d75b10;border-color:#d75b10;}
@media(max-width:900px){
  .iq-editor .iq-details-grid{grid-template-columns:1fr;}
  .iq-editor .iq-items-head,.iq-editor .line-row{grid-template-columns:18px minmax(130px,1fr) 65px 95px 106px 28px;gap:7px;}
  .iq-editor .iq-bottom-grid{grid-template-columns:minmax(0,1fr) 260px;gap:20px;}
}
@media(max-width:640px){
  #modal:has(.iq-editor){padding:0;align-items:stretch;}
  #modalCard:has(.iq-editor){width:100%;max-width:100%;height:100dvh;max-height:100dvh;border-radius:0;}
  #modalCard:has(.iq-editor) .modal-head{padding:16px;}
  #modalCard:has(.iq-editor) .modal-head h3{font-size:20px;}
  .iq-editor .iq-scroll{padding:14px 16px 20px;scrollbar-gutter:auto;}
  .iq-editor .iq-intro{font-size:12px;margin-bottom:14px;}
  .iq-editor .iq-meta-grid{grid-template-columns:1fr 1fr;padding:12px;gap:12px;margin-bottom:14px;}
  .iq-editor .iq-meta-grid>.iq-field:first-child{grid-column:1/-1;}
  .iq-editor .iq-details-grid{gap:14px;margin-bottom:14px;}
  .iq-editor .iq-section{padding:14px 12px;}
  .iq-editor .iq-fields-grid{gap:12px 10px;}
  .iq-editor .iq-field input,.iq-editor .iq-field select,.iq-editor .iq-field textarea,.iq-editor .line-row input,.iq-editor .line-row .li-desc{font-size:16px;}
  .iq-editor .iq-field-label{font-size:11px;}
  .iq-editor .iq-items-head{display:none;}
  .iq-editor .iq-items-section{margin-bottom:14px;}
  .iq-editor .line-row{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 8px;position:relative;padding-top:30px;}
  .iq-editor .iq-description-field{grid-column:1/-1;}
  .iq-editor .iq-mobile-label{position:static;display:block;width:auto;height:auto;margin:0 0 5px;overflow:visible;clip:auto;white-space:normal;font-size:10px;line-height:1.4;color:#64748a;font-weight:600;}
  .iq-editor .iq-row-number{position:absolute;left:0;top:3px;padding:0;font-size:10px;font-weight:700;}
  .iq-editor .iq-row-number::before{content:'Item ';}
  .iq-editor .iq-remove-button{position:absolute;right:0;top:-6px;width:34px;height:34px;}
  .iq-editor .line-row .li-desc{height:64px;min-height:64px;}
  .iq-editor .line-row input{padding:10px 7px;}
  .iq-editor .iq-bottom-grid{grid-template-columns:1fr;gap:14px;}
  .iq-editor .iq-actions{padding:12px 16px max(12px,env(safe-area-inset-bottom));gap:10px;}
  .iq-editor .iq-total>strong{font-size:19px;}
  .iq-editor .iq-action-buttons{gap:6px;}
  .iq-editor .iq-save-button,.iq-editor .iq-cancel-button{padding:11px 12px;font-size:12px;}
}
@media(max-width:380px){
  .iq-editor .iq-actions{flex-wrap:wrap;}
  .iq-editor .iq-action-buttons{margin-left:auto;}
  .iq-editor .iq-fields-grid{grid-template-columns:1fr;}
}
