/* Invoice reference layout. Every rule belongs only to the billing editor. */
#client-billing-editor.v5-invoice-form{--iv-border:#d8e3f0;--iv-muted:#5b7091;--iv-blue:#2f5d9b;--v5-bg:#fff;width:min(1000px,96vw);max-width:1000px;max-height:90dvh;border-radius:12px;border:1px solid #d8e3f0;background:#fff;box-shadow:0 14px 42px #123b6b29}
#client-billing-editor.v5-invoice-form > .invoice-editor-header{min-height:64px;padding:10px 24px;margin:0;border-radius:0;background:#153f73;border-bottom:2px solid #d8b24a}
#client-billing-editor.v5-invoice-form > .invoice-editor-header h2{font-size:19px;font-weight:700;letter-spacing:-.015em}
#client-billing-editor.v5-invoice-form > .invoice-editor-header small{font-size:12px;font-weight:500;color:#ffffffde;margin-top:3px}
#client-billing-editor.v5-invoice-form > .invoice-editor-header button{height:38px;min-height:38px;padding:8px 16px;border-radius:10px;border:1px solid #ffffff40;background:#ffffff0c;color:#fff!important;font-size:13px}
#client-billing-editor.v5-invoice-form form.grid{gap:16px;padding:18px 24px 0}
#client-billing-editor.v5-invoice-form .iv-section{padding:0;gap:10px 12px;border:0;border-radius:0;background:#fff;box-shadow:none;min-width:0}
#client-billing-editor.v5-invoice-form .iv-section > h3,#client-billing-editor.v5-invoice-form .iv-fiscal-heading{font-size:14px;font-weight:600;line-height:20px;color:#2f5d9b;background:transparent;border:0;border-bottom:1px solid #e6edf7;border-radius:0;padding:0 0 7px;margin:0}
#client-billing-editor.v5-invoice-form .iv-section > h3 .ui-icon{width:16px;height:16px;color:#2f5d9b}
#client-billing-editor.v5-invoice-form label{font-size:12px;line-height:16px;font-weight:600;gap:6px;color:#3e5d82}
#client-billing-editor.v5-invoice-form :is(input:not([type=checkbox]),select){height:36px;min-height:36px;font-size:13px;line-height:18px;font-weight:500;padding:8px 9px;border:1px solid #d8e3f0;border-radius:8px;background:#fff;color:#1e3557}
#client-billing-editor.v5-invoice-form :is(input:required,select:required,textarea:required){border-left:1px solid #d8e3f0}
#client-billing-editor.v5-invoice-form :is(input:disabled,input[readonly],select:disabled){background:#f5f9ff;color:#5b7091}
#client-billing-editor.v5-invoice-form :is(input,select,textarea):focus{border-color:#7c9cc6;box-shadow:0 0 0 2px #2f5d9b15}
#client-billing-editor.v5-invoice-form .iv-general label::after,#client-billing-editor.v5-invoice-form .iv-bottom label::after{display:none}
#client-billing-editor.v5-invoice-form button{min-height:34px;padding:6px 12px;font-size:13px;font-weight:600;line-height:20px;border-radius:8px;transform:none;transition:background-color .15s}
#client-billing-editor.v5-invoice-form button:hover:not(:disabled){transform:none;box-shadow:none}
#client-billing-editor.v5-invoice-form button:disabled{opacity:1;background:#f0f3f7!important;color:#8090a5!important;border-color:#dce4ee;box-shadow:none;transform:none}
#client-billing-editor.v5-invoice-form button:focus-visible{outline:2px solid #7c9cc6;outline-offset:2px}
#client-billing-editor.v5-invoice-form small{font-size:11px;line-height:16px;color:#5b7091}
#client-billing-editor.v5-invoice-form .search-combobox > input{padding:8px 28px 8px 9px!important}
#client-billing-editor.v5-invoice-form .search-combobox.ui-search-field::before,#client-billing-editor.v5-invoice-form .search-combobox.ui-search-field::after{display:none}
#client-billing-editor.v5-invoice-form .search-combobox > .combobox-toggle{width:26px;height:34px;min-height:34px!important;padding:6px!important}
/* Two primary rows, fiscal band, then secondary registration controls. */
#client-billing-editor.v5-invoice-form .iv-general{position:relative;grid-template-columns:1.15fr .95fr .95fr 1.4fr;gap:10px 12px;align-items:start}
#client-billing-editor.v5-invoice-form .iv-general > h3{grid-column:1/-1;grid-row:1}
#client-billing-editor.v5-invoice-form .iv-number-pair{display:grid;grid-template-columns:66px minmax(0,1fr);gap:7px;grid-column:1;grid-row:2;min-width:0}
#client-billing-editor.v5-invoice-form .iv-number-pair label{overflow:hidden;white-space:nowrap}
#client-billing-editor.v5-invoice-form .iv-general > label:has([name=date]){grid-column:2;grid-row:2}
#client-billing-editor.v5-invoice-form .iv-general > label:has([name=due]){grid-column:3;grid-row:2}
#client-billing-editor.v5-invoice-form .iv-general > label:has([name=documentType]){grid-column:1;grid-row:3}
#client-billing-editor.v5-invoice-form .iv-general > label:has([name=category]){grid-column:2;grid-row:3}
#client-billing-editor.v5-invoice-form .iv-general > label:has([name=status]){grid-column:3;grid-row:3}
#client-billing-editor.v5-invoice-form .iv-general-concept{grid-column:4;grid-row:3}
#client-billing-editor.v5-invoice-form .iv-general-concept label{margin:0}
#client-billing-editor.v5-invoice-form .iv-party-finder{display:contents}
#client-billing-editor.v5-invoice-form .iv-party-finder > label{grid-column:4;grid-row:2;align-self:start;margin:0}
#client-billing-editor.v5-invoice-form .iv-party-compact > .party-search-controls{grid-column:4;grid-row:2;align-self:end;display:flex;gap:5px;min-width:0;height:36px}
#client-billing-editor.v5-invoice-form .iv-party-compact > .party-search-controls input{flex:1;min-width:0;width:100%}
#client-billing-editor.v5-invoice-form .iv-party-compact > .party-search-controls button{height:36px;min-height:36px;padding:4px 8px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-party-compact [data-party-dropdown]{width:28px;padding:4px}
#client-billing-editor.v5-invoice-form .iv-party-finder > #ac-party-search-status{grid-column:1/-1;grid-row:7;padding:0;margin:0;font-size:11px;min-width:0}
#client-billing-editor.v5-invoice-form .iv-party-finder > #ac-party-search-status:empty{display:none}
#client-billing-editor.v5-invoice-form .iv-fiscal-heading{grid-column:1/-1;grid-row:4;margin-top:4px;padding-bottom:7px}
#client-billing-editor.v5-invoice-form .iv-party-selected{grid-column:1/-1;grid-row:5;display:grid;grid-template-columns:130px 1.15fr 1.4fr auto;gap:10px;align-items:end;padding:0;border:0;border-radius:0;background:transparent}
#client-billing-editor.v5-invoice-form .iv-party-taxid{grid-column:1;grid-row:1}
#client-billing-editor.v5-invoice-form .iv-party-name{grid-column:2;grid-row:1}
#client-billing-editor.v5-invoice-form .iv-party-address{grid-column:3;grid-row:1}
#client-billing-editor.v5-invoice-form .iv-party-actions{grid-column:4;grid-row:1;display:flex;gap:5px;flex-wrap:nowrap;margin:0}
#client-billing-editor.v5-invoice-form .iv-party-selected small{display:block;margin:0 0 5px;font-size:11px;line-height:16px}
#client-billing-editor.v5-invoice-form .iv-party-selected :is(strong,span){display:block;box-sizing:border-box;height:32px;padding:6px 8px;border:1px solid #d8e3f0;border-radius:6px;font-size:12px;line-height:18px;font-weight:500;background:#f8fbff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#client-billing-editor.v5-invoice-form .iv-party-actions button{height:32px;min-height:32px;padding:5px 8px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-book{grid-column:1;grid-row:6;align-self:start}
#client-billing-editor.v5-invoice-form .iv-register-details{grid-column:2;grid-row:6;padding:0;border:0;min-width:0;align-self:end}
#client-billing-editor.v5-invoice-form .iv-register-details > summary{padding:8px 9px;border:1px solid #d8e3f0;border-radius:8px;background:#f8fbff;font-size:11px;line-height:18px;color:#3e5d82}
#client-billing-editor.v5-invoice-form .iv-register-fields{display:grid;gap:10px;padding-top:10px}
#client-billing-editor.v5-invoice-form .iv-register{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;padding:10px;border:1px solid #e6edf7;border-radius:8px;background:#fafcff}
#client-billing-editor.v5-invoice-form .iv-register :is(label,button,strong,small){grid-column:1;font-size:11px;min-width:0}
#client-billing-editor.v5-invoice-form .iv-register label{display:flex;flex-direction:column;align-items:stretch;gap:5px}
#client-billing-editor.v5-invoice-form .iv-register > span{font-size:12px}
#client-billing-editor.v5-invoice-form .iv-register button{min-height:28px;padding:4px 0;white-space:normal}
#client-billing-editor.v5-invoice-form .invoice-advanced,#client-billing-editor.v5-invoice-form .invoice-advanced:has([data-iv=enabled]:checked){grid-column:3/5;grid-row:6;align-self:end}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap;gap:8px;min-height:36px;width:100%;padding:7px 10px;border:1px solid #d8e3f0;border-radius:8px;background:#f8fbff;font-size:12px;line-height:20px;box-sizing:border-box}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle > span{white-space:nowrap}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle > [role=note]{margin-left:auto}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle input[role=switch]{flex:0 0 32px;width:32px;height:18px;min-height:18px}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle input[role=switch]::after{width:12px;height:12px}
#client-billing-editor.v5-invoice-form .invoice-advanced > .grid{gap:10px;margin-top:10px}
/* Actual table: the original controls and their event listeners stay attached. */
#client-billing-editor.v5-invoice-form .iv-lines > p:first-of-type{font-size:11px;line-height:16px;margin:6px 0 8px}
#client-billing-editor.v5-invoice-form .iv-line-scroll{overflow:auto;border:1px solid #d8e3f0;border-radius:7px;min-width:0}
#client-billing-editor.v5-invoice-form .iv-invoice-table{display:table;border-collapse:separate;border-spacing:0;table-layout:fixed;width:1174px;max-width:none;margin:0}
#client-billing-editor.v5-invoice-form[data-direction=received] .iv-invoice-table{width:1040px}
#client-billing-editor.v5-invoice-form .iv-invoice-table thead{display:table-header-group}
#client-billing-editor.v5-invoice-form .iv-invoice-table .invoice-lines{display:table-row-group}
#client-billing-editor.v5-invoice-form .iv-invoice-table .invoice-line{display:table-row!important;min-width:0!important;padding:0;margin:0;border:0;border-radius:0;background:#fff}
#client-billing-editor.v5-invoice-form .iv-invoice-table th{font-size:12px;font-weight:600;color:#2f5d9b;background:#edf5ff;padding:7px 6px;line-height:16px;text-align:left;border:0;border-right:1px solid #e6edf7;border-bottom:1px solid #d8e3f0;white-space:nowrap}
#client-billing-editor.v5-invoice-form .iv-invoice-table td{display:table-cell;padding:2px 3px;height:36px;box-sizing:border-box;border:0;border-right:1px solid #edf2f9;border-bottom:1px solid #edf2f9;background:#fff;vertical-align:middle}
#client-billing-editor.v5-invoice-form .iv-invoice-table tr:nth-child(even) td{background:#fafcff}
#client-billing-editor.v5-invoice-form .iv-invoice-table .iv-row-legend,#client-billing-editor.v5-invoice-form .iv-invoice-table td:has(> [hidden]){display:none}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=concept]{width:270px}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-invoice-table [data-iv-cell=concept]{width:310px}
#client-billing-editor.v5-invoice-form .iv-invoice-table th[data-iv-cell=remove]{font-size:0}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=quantity]{width:65px}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=price],#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=base]{width:90px}
#client-billing-editor.v5-invoice-form .iv-invoice-table :is([data-iv-cell=vat],[data-iv-cell=retention],[data-iv-cell=discount],[data-iv-cell=unit],[data-iv-cell=surcharge]){width:60px}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=deductible]{width:84px}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=total]{width:96px;position:sticky;right:38px;z-index:2;text-align:right;border-left:1px solid #d8e3f0}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=remove]{width:38px;position:sticky;right:0;z-index:2}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=category]{width:150px}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=catalog]{width:130px}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=legacy]{width:270px;display:none}
#client-billing-editor.v5-invoice-form .iv-invoice-table:has([data-legacy-amounts]:not([hidden])) [data-iv-cell=legacy]{display:table-cell}
#client-billing-editor.v5-invoice-form .iv-invoice-table label{display:block;min-width:0;max-width:none;padding:0;margin:0;font-size:0;line-height:0}
#client-billing-editor.v5-invoice-form .iv-invoice-table label > small{display:none}
#client-billing-editor.v5-invoice-form .iv-invoice-table :is(input,select){height:32px;min-height:32px;width:100%;padding:5px 6px;font-size:13px;line-height:20px;border:1px solid #e6edf7;border-radius:4px;background:#fff;box-sizing:border-box}
#client-billing-editor.v5-invoice-form .iv-invoice-table input[type=number]{text-align:right;font-variant-numeric:tabular-nums}
#client-billing-editor.v5-invoice-form .iv-invoice-table .iv-row-total{display:block;font-size:13px;font-weight:600;padding:0 5px;line-height:30px;white-space:nowrap;text-align:right}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-remove]{display:block;width:30px;min-width:30px;height:30px;min-height:30px;font-size:0;line-height:0;padding:6px;border:0;background:transparent;color:#527caf!important}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-remove]::after{content:'';display:block;width:15px;height:16px;margin:auto;background:currentColor;clip-path:polygon(26% 0,74% 0,74% 14%,100% 14%,100% 26%,88% 26%,82% 100%,18% 100%,12% 26%,0 26%,0 14%,26% 14%,26% 0)}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-remove] > *{display:none}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-legacy-amounts]:not([hidden]){display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:0}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-invoice-table [data-column-direction=received],#client-billing-editor.v5-invoice-form[data-direction=received] .iv-invoice-table [data-column-direction=issued]{display:none}
#client-billing-editor.v5-invoice-form .iv-line-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px}
#client-billing-editor.v5-invoice-form .iv-line-tools button{height:34px;min-height:34px;padding:6px 12px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-line-tools .line-total{margin:0 0 0 auto;font-size:12px;font-weight:600}
#client-billing-editor.v5-invoice-form .iv-table-hint{flex-basis:100%;text-align:right;font-size:11px;line-height:14px}
#client-billing-editor.v5-invoice-form .iv-retention{margin-top:8px;padding-top:8px;gap:10px;border-top:1px solid #e6edf7}
#client-billing-editor.v5-invoice-form .iv-retention > label:first-child{display:flex;flex-direction:row;align-items:center;gap:8px;flex:0 1 310px;min-width:0}
#client-billing-editor.v5-invoice-form .iv-retention select{height:32px;min-height:32px;font-size:12px}
/* Reference bottom strip: notes 40%, summary 32%, payment 28%. */
#client-billing-editor.v5-invoice-form .iv-bottom{display:grid;grid-template-columns:40fr 32fr 28fr;gap:12px}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section{padding:10px;border:1px solid #e6edf7;border-radius:8px;background:#fff;min-height:120px}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section > h3{font-size:12px;line-height:18px;padding:0 0 6px;margin:0 0 6px}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section > label{margin:0}
#client-billing-editor.v5-invoice-form .iv-bottom label:has(textarea){font-size:0;line-height:0;gap:0}
#client-billing-editor.v5-invoice-form textarea{min-height:84px;height:84px;font-size:12px;line-height:18px;padding:8px;border-color:#d8e3f0;border-radius:6px;resize:vertical}
#client-billing-editor.v5-invoice-form .iv-editing-context{font-size:10px;line-height:14px;color:#5b7091;margin:0 0 4px}
#client-billing-editor.v5-invoice-form .iv-summary dl{margin:0;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-summary dl > div{padding:1px 0;line-height:17px}
#client-billing-editor.v5-invoice-form .iv-summary dl > div:last-child{font-size:20px;line-height:24px;margin-top:5px;padding:5px 6px;background:#edf5ff;border:0;border-radius:4px}
#client-billing-editor.v5-invoice-form .iv-settlement label{font-size:0;line-height:0;gap:0}
#client-billing-editor.v5-invoice-form .iv-settlement .search-combobox > input{height:30px;min-height:30px;background:#fff6e4;color:#866318;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-settlement .combobox-toggle{height:28px;min-height:28px!important}
#client-billing-editor.v5-invoice-form .iv-settlement p{font-size:12px;line-height:18px;margin:5px 0;text-align:right;font-variant-numeric:tabular-nums}
#client-billing-editor.v5-invoice-form .iv-settlement > small{display:none}
#client-billing-editor.v5-invoice-form .iv-footer{gap:10px;align-items:center;flex-wrap:wrap;margin-top:0;padding:10px 0;background:#fff;border-top:1px solid #e6edf7;box-shadow:0 -3px 8px #123b6b05}
#client-billing-editor.v5-invoice-form .iv-footer button{height:40px;min-height:40px;padding:9px 15px;font-size:13px;line-height:20px;border-radius:10px;white-space:nowrap;flex:0 0 auto;box-sizing:border-box}
#client-billing-editor.v5-invoice-form .iv-footer .iv-cancel,#client-billing-editor.v5-invoice-form .iv-footer .iv-draft{background:#fff;border:1px solid #d8e3f0;color:#2f5d9b}
#client-billing-editor.v5-invoice-form .iv-footer button.primary{background:#d9a51f;border:1px solid #cb9717;color:#173451}
#client-billing-editor.v5-invoice-form .iv-footer button:disabled{background:#f0f3f7!important;color:#8090a5!important;border-color:#dce4ee;opacity:1;transition:none;cursor:not-allowed}
#client-billing-editor.v5-invoice-form .iv-attachment{width:170px;margin-right:auto;font-size:11px;line-height:14px;gap:2px}
#client-billing-editor.v5-invoice-form .iv-attachment input{height:28px;min-height:28px;padding:3px;font-size:10px}
#client-billing-editor.v5-invoice-form [data-issue-help]{font-size:10px;line-height:12px;margin:0}
@media(max-width:767px){
 #client-billing-editor.v5-invoice-form{width:100vw;max-height:100dvh;border-radius:0}
 #client-billing-editor.v5-invoice-form form.grid{padding:12px 14px 0}
 #client-billing-editor.v5-invoice-form .iv-general{grid-template-columns:repeat(2,minmax(0,1fr))}
 #client-billing-editor.v5-invoice-form .iv-general > *,#client-billing-editor.v5-invoice-form .iv-party-finder > *{grid-row:auto!important;grid-column:1/-1!important}
 #client-billing-editor.v5-invoice-form .iv-party-finder{display:grid!important;gap:8px}
 #client-billing-editor.v5-invoice-form .iv-party-compact > .party-search-controls button:last-child:not([data-party-dropdown]){position:static}
 #client-billing-editor.v5-invoice-form .iv-party-selected{grid-template-columns:1fr 1fr}
 #client-billing-editor.v5-invoice-form .iv-party-selected > div{grid-column:auto;grid-row:auto}
 #client-billing-editor.v5-invoice-form .iv-bottom{grid-template-columns:1fr}
 #client-billing-editor.v5-invoice-form .iv-attachment{width:100%}
 #client-billing-editor.v5-invoice-form .iv-footer button{padding:8px 10px;font-size:12px}
}
#client-billing-editor.v5-invoice-form .invoice-advanced,#client-billing-editor.v5-invoice-form .invoice-advanced:has([data-iv=enabled]:checked){align-self:start;padding-top:22px}
#client-billing-editor.v5-invoice-form .iv-register-details{align-self:start;padding-top:22px}
#client-billing-editor.v5-invoice-form .iv-party-finder > label{font-size:0}
#client-billing-editor.v5-invoice-form .iv-party-finder > label::before{content:'Proveedor';font-size:12px}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-party-finder > label::before{content:'Cliente / destinatario'}
/* Secondary settings remain available without dominating the reference form. */
#client-billing-editor.v5-invoice-form .iv-general > h3{align-self:start}
#client-billing-editor.v5-invoice-form .iv-secondary{grid-column:1/-1;grid-row:1;justify-self:end;max-width:100%;padding:0;border:0}
#client-billing-editor.v5-invoice-form .iv-secondary > summary{width:max-content;margin-left:auto;padding:0 0 7px 10px;font-size:12px;line-height:20px;color:#5b7091;background:#fff;border:0;border-radius:0}
#client-billing-editor.v5-invoice-form .iv-secondary[open]{width:100%;padding-top:0}
#client-billing-editor.v5-invoice-form .iv-secondary-fields{display:grid;grid-template-columns:1fr 1fr 2fr;align-items:start;gap:12px;padding:12px;border:1px solid #e6edf7;border-radius:8px;margin:8px 0;background:#fafcff}
#client-billing-editor.v5-invoice-form .iv-secondary-fields > *{grid-column:auto;grid-row:auto}
#client-billing-editor.v5-invoice-form .iv-secondary-fields .invoice-advanced,#client-billing-editor.v5-invoice-form .iv-secondary-fields .invoice-advanced:has([data-iv=enabled]:checked){grid-column:3;grid-row:1;align-self:start;padding-top:22px}
#client-billing-editor.v5-invoice-form .iv-secondary-fields .iv-register-details{padding-top:22px;align-self:start}
#client-billing-editor.v5-invoice-form .iv-party-selected[hidden]{display:grid!important}
#client-billing-editor.v5-invoice-form .iv-general .iv-number-pair{gap:6px 7px}
#client-billing-editor.v5-invoice-form .iv-number-pair::before{content:'Serie / Número';grid-column:1/-1;font-size:12px;line-height:16px;font-weight:600;color:#3e5d82}
#client-billing-editor.v5-invoice-form .iv-number-pair label{font-size:0;line-height:0;gap:0}
#client-billing-editor.v5-invoice-form[data-direction=received] .iv-general{grid-template-columns:1.25fr .9fr .9fr .9fr 1.4fr}
#client-billing-editor.v5-invoice-form[data-direction=received] .iv-general > label:has([name=bookingDate]){grid-column:3;grid-row:2}
#client-billing-editor.v5-invoice-form[data-direction=received] .iv-general > label:has([name=due]){grid-column:4}
#client-billing-editor.v5-invoice-form[data-direction=received] .iv-party-finder > label,#client-billing-editor.v5-invoice-form[data-direction=received] .iv-party-compact > .party-search-controls{grid-column:5}
#client-billing-editor.v5-invoice-form[data-direction=received] .iv-general-concept{grid-column:4/6}
#client-billing-editor.v5-invoice-form .iv-lines > h3{display:flex;align-items:center;gap:8px}
#client-billing-editor.v5-invoice-form .iv-table-hint{margin-left:auto;font-size:11px;line-height:18px;flex-basis:auto;font-weight:400}
#client-billing-editor.v5-invoice-form .iv-line-tools{position:relative}
#client-billing-editor.v5-invoice-form .iv-line-help{padding:0;border:0;font-size:11px;line-height:16px}
#client-billing-editor.v5-invoice-form .iv-line-help > summary{font-size:11px;line-height:20px;border:0;background:#fff;padding:0 3px;color:#5b7091}
#client-billing-editor.v5-invoice-form .iv-line-help > p{position:absolute;z-index:10;right:0;width:420px;max-width:100%;padding:10px;background:#fff;border:1px solid #d8e3f0;border-radius:8px;box-shadow:0 6px 16px #123b6b22;font-size:12px;line-height:18px}
/* Fit the original retention control beside the line actions. Extra validation
   and confirmation controls wrap only when the existing logic shows them. */
#client-billing-editor.v5-invoice-form .iv-fiscal-heading{display:flex;align-items:center;gap:10px}
#client-billing-editor.v5-invoice-form .iv-fiscal-heading > button{margin-left:auto;height:28px;min-height:28px;padding:2px 8px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention{display:contents}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention > label:first-child{flex:0 1 240px;display:flex;white-space:nowrap;font-size:11px;gap:6px}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention select{flex:1;min-width:0}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention > :not(:first-child){order:1}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention > .iv-check{flex-basis:100%}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section{padding:8px;position:relative}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section > h3{line-height:18px;padding-bottom:5px;margin-bottom:5px}
#client-billing-editor.v5-invoice-form .iv-bottom .iv-editing-context{position:absolute;right:9px;top:11px;font-size:9px;line-height:12px;margin:0;background:#fff;padding-left:4px}
#client-billing-editor.v5-invoice-form .iv-summary > h3{padding-right:90px;font-size:11px}
#client-billing-editor.v5-invoice-form .iv-summary dl > div:last-child{margin-top:3px;padding:3px 5px}
#client-billing-editor.v5-invoice-form .iv-bottom textarea{height:91px;min-height:91px}
/* Final reference correction: scoped geometry, no business state or controls. */
#client-billing-editor.v5-invoice-form{--iv-border:#d7e2f0;--iv-muted:#687c98;--iv-blue:#315c96;width:min(980px,76vw);max-width:1020px;max-height:90dvh;border-radius:13px;background:#fff;box-shadow:0 12px 36px #123b6b26;color:#24364b}
#client-billing-editor.v5-invoice-form > .invoice-editor-header{height:56px;min-height:56px;padding:7px 22px;background:#123b6b;border-bottom:2px solid #d4a62a}
#client-billing-editor.v5-invoice-form > .invoice-editor-header small{font-size:11px;line-height:14px;margin-top:1px}
#client-billing-editor.v5-invoice-form > .invoice-editor-header button{height:36px;min-height:36px;padding:6px 13px}
#client-billing-editor.v5-invoice-form > .card{scrollbar-gutter:auto;scrollbar-width:thin;scrollbar-color:#c6d2e1 #f8fafd}
#client-billing-editor.v5-invoice-form form.grid{gap:14px;padding:10px 22px 0}
#client-billing-editor.v5-invoice-form .iv-section > h3,#client-billing-editor.v5-invoice-form .iv-fiscal-heading{font-size:13px;line-height:18px;font-weight:650;padding:0 0 4px;color:#315c96;min-height:0}
#client-billing-editor.v5-invoice-form .iv-general{gap:8px 10px}
#client-billing-editor.v5-invoice-form label{font-size:11.5px;line-height:14px;gap:4px;color:#536b8c}
#client-billing-editor.v5-invoice-form :is(input:not([type=checkbox]),select){height:36px;min-height:36px;padding:7px 8px;font-size:13px;color:#24364b;border-color:#d7e2f0;border-radius:7px}
#client-billing-editor.v5-invoice-form .iv-general-concept label{margin:0}
#client-billing-editor.v5-invoice-form .iv-number-pair{gap:4px 7px!important}
#client-billing-editor.v5-invoice-form .iv-number-pair::before{font-size:11.5px;line-height:14px;color:#536b8c}
#client-billing-editor.v5-invoice-form .iv-party-finder > label::before{font-size:11.5px}
#client-billing-editor.v5-invoice-form .iv-fiscal-heading{margin-top:6px;padding-bottom:4px;gap:6px}
#client-billing-editor.v5-invoice-form .iv-fiscal-heading > button{height:24px;min-height:24px;padding:2px 7px;font-size:11px;line-height:18px}
#client-billing-editor.v5-invoice-form .iv-fiscal-heading .iv-party-actions{margin:0;display:flex;gap:4px}
#client-billing-editor.v5-invoice-form .iv-fiscal-heading .iv-party-actions button{height:24px;min-height:24px;padding:2px 7px;font-size:11px;line-height:18px}
#client-billing-editor.v5-invoice-form .iv-general:has(.iv-party-selected[hidden]) .iv-party-actions [data-party-clear]{visibility:hidden}
#client-billing-editor.v5-invoice-form .iv-party-selected{grid-template-columns:160px minmax(0,1.5fr) 72px minmax(0,1fr) minmax(0,1fr) 110px;gap:6px 10px;align-items:start}
#client-billing-editor.v5-invoice-form .iv-party-taxid{grid-column:1;grid-row:1}
#client-billing-editor.v5-invoice-form .iv-party-name{grid-column:2/-1;grid-row:1}
#client-billing-editor.v5-invoice-form .iv-party-address{grid-column:1/3;grid-row:2}
#client-billing-editor.v5-invoice-form .iv-party-postalCode{grid-column:3;grid-row:2}
#client-billing-editor.v5-invoice-form .iv-party-municipality{grid-column:4;grid-row:2}
#client-billing-editor.v5-invoice-form .iv-party-region{grid-column:5;grid-row:2}
#client-billing-editor.v5-invoice-form .iv-party-country{grid-column:6;grid-row:2}
#client-billing-editor.v5-invoice-form .iv-party-selected small{font-size:10.5px;line-height:12px;margin:0 0 3px;color:#687c98}
#client-billing-editor.v5-invoice-form .iv-party-selected :is(strong,span){height:24px;padding:3px 7px;border-radius:5px;font-size:12px;line-height:16px;background:#f8fafd}
#client-billing-editor.v5-invoice-form .iv-party-finder > #ac-party-search-status{font-size:10.5px;line-height:12px;background:transparent}
/* Full-width, closed by default. Its fixed open viewport prevents the advanced
   switch from moving surrounding fields when it reveals its existing controls. */
#client-billing-editor.v5-invoice-form .iv-secondary{grid-column:auto;grid-row:auto;justify-self:stretch;max-width:none;width:100%;margin:-6px 0;padding:0;border:1px solid #d7e2f0;border-radius:7px;background:#f8fafd;box-sizing:border-box}
#client-billing-editor.v5-invoice-form .iv-secondary > summary{width:auto;box-sizing:border-box;height:36px;margin:0;padding:8px 11px;font-size:12px;line-height:20px;border:0;background:transparent;color:#536b8c}
#client-billing-editor.v5-invoice-form .iv-secondary[open]{padding:0;width:100%}
#client-billing-editor.v5-invoice-form .iv-secondary-fields{grid-template-columns:1fr 1fr 2fr;box-sizing:border-box;height:230px;overflow:auto;scrollbar-width:thin;gap:10px;margin:0;padding:10px;border:0;border-top:1px solid #d7e2f0;border-radius:0;background:white;align-content:start}
#client-billing-editor.v5-invoice-form .iv-secondary-fields .iv-advanced-toggle{height:36px;min-height:36px;padding:6px 8px;font-size:11.5px}
#client-billing-editor.v5-invoice-form .iv-secondary-fields .iv-advanced-toggle > span{white-space:normal}
#client-billing-editor.v5-invoice-form .iv-secondary-fields .iv-register-details,#client-billing-editor.v5-invoice-form .iv-secondary-fields .invoice-advanced{padding-top:18px}
#client-billing-editor.v5-invoice-form .iv-secondary-fields .invoice-advanced:has([data-iv=enabled]:checked){padding-top:18px}
/* Fit every existing column to the available width, without a scroll surface.
   Row nodes, fields, handlers, font sizes and controls retain their identity. */
#client-billing-editor.v5-invoice-form .iv-line-scroll{container-type:inline-size;overflow:visible;border-radius:6px}
#client-billing-editor.v5-invoice-form .iv-invoice-table{--iv-columns:minmax(0,235fr) minmax(0,60fr) minmax(0,80fr) minmax(0,65fr) minmax(0,60fr) minmax(0,96fr) minmax(0,38fr) minmax(0,70fr) minmax(0,50fr) minmax(0,58fr) minmax(0,48fr) minmax(0,74fr);display:block;width:100%!important;min-width:0!important;max-width:100%;box-sizing:border-box}
#client-billing-editor.v5-invoice-form[data-direction=received] .iv-invoice-table{--iv-columns:minmax(0,289fr) minmax(0,100fr) minmax(0,70fr) minmax(0,95fr) minmax(0,70fr) minmax(0,100fr) minmax(0,38fr) minmax(0,98fr) minmax(0,74fr)}
#client-billing-editor.v5-invoice-form .iv-invoice-table :is(thead,.invoice-lines){display:block}
#client-billing-editor.v5-invoice-form .iv-invoice-table :is(thead tr,.invoice-line){display:grid!important;grid-template-columns:var(--iv-columns);gap:0!important}
#client-billing-editor.v5-invoice-form .iv-invoice-table :is(th,td){width:auto!important;min-width:0;max-width:100%;box-sizing:border-box;position:static;border-left:0}
#client-billing-editor.v5-invoice-form .iv-invoice-table th{height:30px;padding:6px 3px;font-size:12px;line-height:17px;background:#eef5fd}
#client-billing-editor.v5-invoice-form .iv-invoice-table td{height:36px;padding:2px 2px}
#client-billing-editor.v5-invoice-form .iv-invoice-table :is(input,select){width:100%;min-width:0;max-width:100%;height:32px;min-height:32px;font-size:13px;padding:5px 3px;border-radius:4px;box-sizing:border-box}
#client-billing-editor.v5-invoice-form .iv-invoice-table .iv-row-total{padding:0 2px}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=legacy]{grid-column:1/-1;grid-row:2;height:auto}
#client-billing-editor.v5-invoice-form .iv-invoice-table [data-iv-cell=legacy] label{font-size:12px;line-height:16px}
/* Position from the input/button wrapper, never from the modal or viewport. */
#client-billing-editor.v5-invoice-form .iv-party-compact > .party-search-controls{position:relative;gap:0;flex-wrap:nowrap}
#client-billing-editor.v5-invoice-form .iv-party-compact > .party-search-controls input{padding-right:34px}
#client-billing-editor.v5-invoice-form .iv-party-compact > .party-search-controls > [data-party-dropdown]{position:absolute;right:1px;top:1px;width:30px;height:34px;min-height:34px;padding:0;border:0;border-left:1px solid #d7e2f0;border-radius:0 6px 6px 0;background:transparent;color:#536b8c;font-size:0;line-height:0;display:flex;align-items:center;justify-content:center}
#client-billing-editor.v5-invoice-form .iv-party-compact [data-party-dropdown]::after{content:'';width:6px;height:6px;border-right:1px solid currentColor;border-bottom:1px solid currentColor;transform:translateY(-2px) rotate(45deg)}
#client-billing-editor.v5-invoice-form .iv-party-compact [data-party-dropdown][aria-expanded=true]::after{transform:translateY(2px) rotate(225deg)}
#client-billing-editor.v5-invoice-form .party-search-controls > .party-search-results{position:absolute;top:calc(100% + 4px);left:0;right:auto;width:100%;box-sizing:border-box;max-height:280px;overflow-y:auto;margin:0;padding:4px;border:1px solid #d8e3f0;border-radius:7px;background:#fff;box-shadow:0 4px 12px #06233f18;z-index:3}
#client-billing-editor.v5-invoice-form .party-search-controls > .party-search-results [role=option]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start;gap:6px;height:auto;padding:6px;font-size:13px;line-height:18px;white-space:normal}
#client-billing-editor.v5-invoice-form .party-search-controls > .party-search-results [role=option] span{white-space:normal;text-align:right}
#client-billing-editor.v5-invoice-form .party-search-controls > .party-search-results [role=option]:is(:hover,[aria-selected=true]){box-shadow:none}
#client-billing-editor.v5-invoice-form .iv-line-tools{gap:8px;margin-top:6px}
#client-billing-editor.v5-invoice-form .iv-line-tools button{height:32px;min-height:32px;padding:5px 10px;font-size:12px;background:white;border-color:#d7e2f0;color:#315c96}
#client-billing-editor.v5-invoice-form .iv-line-tools .line-total{font-size:11px;font-weight:500}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention > label:first-child{flex-basis:225px;font-size:10.5px}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention select{height:30px;min-height:30px;font-size:11.5px}
#client-billing-editor.v5-invoice-form .iv-bottom{gap:10px}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section{padding:7px;min-height:112px;border-radius:6px}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section > h3{font-size:12px;line-height:16px;padding:0 0 4px;margin:0 0 4px}
#client-billing-editor.v5-invoice-form .iv-bottom textarea{height:72px;min-height:72px;padding:6px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-bottom .iv-editing-context{display:none}
#client-billing-editor.v5-invoice-form .iv-summary dl > div{line-height:15px;padding:0}
#client-billing-editor.v5-invoice-form .iv-summary dl > div:last-child{font-size:19px;line-height:23px;margin-top:2px;padding:3px 5px}
#client-billing-editor.v5-invoice-form .iv-settlement .search-combobox > input{height:28px;min-height:28px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-settlement .combobox-toggle{height:26px;min-height:26px!important}
#client-billing-editor.v5-invoice-form .iv-settlement p{font-size:11.5px;line-height:16px;margin:4px 0}
#client-billing-editor.v5-invoice-form .iv-footer{position:sticky;bottom:0;gap:8px;min-height:58px;box-sizing:border-box;padding:8px 0;margin-top:-4px;box-shadow:none}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-footer{padding-bottom:14px}
#client-billing-editor.v5-invoice-form .iv-footer button{height:38px;min-height:38px;font-size:12.5px;padding:8px 12px;border-radius:9px;gap:6px}
#client-billing-editor.v5-invoice-form .iv-footer button.primary{background:#d4a62a;border-color:#c79a21;color:#17375e}
#client-billing-editor.v5-invoice-form .iv-attachment{width:160px;font-size:10.5px;line-height:12px;gap:2px}
#client-billing-editor.v5-invoice-form .iv-attachment input{height:24px;min-height:24px;font-size:10px;padding:2px}
#client-billing-editor.v5-invoice-form [data-issue-help]{position:absolute;right:0;bottom:0;margin:0;font-size:9.5px;line-height:11px}
@media(min-width:768px) and (max-width:1100px){#client-billing-editor.v5-invoice-form{width:96vw;max-width:980px}}
@media(max-width:767px){#client-billing-editor.v5-invoice-form{width:100vw;max-height:100dvh}#client-billing-editor.v5-invoice-form .iv-party-selected{grid-template-columns:repeat(2,minmax(0,1fr))}#client-billing-editor.v5-invoice-form .iv-party-selected > div{grid-column:auto!important;grid-row:auto!important}#client-billing-editor.v5-invoice-form .iv-fiscal-heading{flex-wrap:wrap}#client-billing-editor.v5-invoice-form .iv-secondary-fields{grid-template-columns:1fr;height:300px}#client-billing-editor.v5-invoice-form .iv-secondary-fields > *{grid-column:1!important;grid-row:auto!important}}
/* Height budget for 768px screens, without reducing editable input typography. */
#client-billing-editor.v5-invoice-form > .invoice-editor-header{height:52px;min-height:52px;padding-top:5px;padding-bottom:5px}
#client-billing-editor.v5-invoice-form form.grid{gap:12px;padding-top:8px}
#client-billing-editor.v5-invoice-form .iv-section > h3,#client-billing-editor.v5-invoice-form .iv-fiscal-heading{padding-bottom:2px}
#client-billing-editor.v5-invoice-form .iv-party-selected{row-gap:4px}
#client-billing-editor.v5-invoice-form .iv-party-selected :is(strong,span){height:20px;padding:1px 7px}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section{padding:6px;min-height:110px}
#client-billing-editor.v5-invoice-form .iv-bottom > .iv-section > h3{line-height:16px;padding-bottom:2px;margin-bottom:3px}
#client-billing-editor.v5-invoice-form .iv-bottom textarea{height:68px;min-height:68px}
#client-billing-editor.v5-invoice-form .iv-summary dl > div:last-child{font-size:18px;line-height:22px;padding:2px 5px}
#client-billing-editor.v5-invoice-form .iv-footer{min-height:56px}
#client-billing-editor.v5-invoice-form .iv-party-finder > #ac-party-search-status{grid-column:2/-1;grid-row:1;align-self:center;justify-self:end;text-align:right;background:#fff;max-width:100%;padding-left:8px}
#client-billing-editor.v5-invoice-form [data-issue-help]{font-size:10.5px;line-height:12px}
#client-billing-editor.v5-invoice-form .iv-secondary-fields{height:144px;scrollbar-gutter:stable}
/* Stable viewport: native form controls keep their nodes, focus and tab order. */
#client-billing-editor.v5-invoice-form{position:fixed;inset:0;margin:auto;height:min(700px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);overflow:clip;overflow-anchor:none}
#client-billing-editor.v5-invoice-form > .invoice-editor-header{flex:0 0 52px}
#client-billing-editor.v5-invoice-form > .card{display:flex;flex-direction:column;flex:1;min-height:0;overflow:clip;scrollbar-gutter:auto}
#client-billing-editor.v5-invoice-form form.grid{display:flex;flex-direction:column;flex:1;min-height:0;overflow:clip;gap:0;padding:0}
#client-billing-editor.v5-invoice-form .iv-editor-body{display:grid;grid-template-columns:minmax(0,1fr);align-content:start;gap:12px;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;overflow-anchor:none;padding:8px 24px 12px}
#client-billing-editor.v5-invoice-form .iv-footer{position:relative;flex:0 0 auto;margin:0 24px;padding-top:8px;background:#fff;backdrop-filter:none}
#client-billing-editor.v5-invoice-form :is([name=number],#ac-party-search,[name=status],.iv-party-selected,[data-key=base],[data-key=vat],[data-key=deductible],[data-key=retention]){border-color:#a9bfdd;background-color:#f8fbff}
#client-billing-editor.v5-invoice-form :is(input,select,textarea,button){scroll-margin-block:8px}
@media(max-width:767px){#client-billing-editor.v5-invoice-form{width:calc(100vw - 20px);height:calc(100dvh - 32px);max-height:calc(100dvh - 32px)}#client-billing-editor.v5-invoice-form .iv-editor-body{padding-inline:10px}#client-billing-editor.v5-invoice-form .iv-footer{margin-inline:10px}}
/* Emphasis does not change metrics in normal/focus/selected states. */
#client-billing-editor.v5-invoice-form :is([name=number],#ac-party-search,label:has(>[name=status]) .search-combobox input,[data-key=base],[data-unit-price],[data-key=vat],[data-key=deductible],[data-key=retention],[data-key=surcharge]){border-color:#89a8cf;background:#f3f7fe;box-shadow:inset 0 1px 2px #173f7309}
#client-billing-editor.v5-invoice-form :is(.iv-party-taxid,.iv-party-name) :is(strong,span){border:1px solid #b2c8e4;background:#f3f7fe}
#client-billing-editor.v5-invoice-form :is(label:has([name=number]),label:has([name=status]),.iv-party-taxid small,.iv-party-name small,.iv-invoice-table th){color:#214d80}
#client-billing-editor.v5-invoice-form :is(input,select,textarea):focus{border-color:#477fb8;box-shadow:0 0 0 2px #2f5d9b22}
#client-billing-editor.v5-invoice-form .party-search-results[popover]{inset:auto;margin:0;position:fixed;overscroll-behavior:contain}
#client-billing-editor.v5-invoice-form .iv-editor-body > [role=alert]:empty{display:none}
html:has(#client-billing-editor[open]){overflow:hidden;scrollbar-gutter:stable}
/* Async duplicate checks never take height from the form. Detailed warnings
   overlay it from the same rail; validation and duplicate controls are retained. */
#client-billing-editor.v5-invoice-form > .iv-duplicate-rail{position:relative;flex:0 0 24px;height:24px;min-height:24px;margin:0 24px;z-index:5}
#client-billing-editor.v5-invoice-form .iv-duplicate-rail > .iv-duplicate{position:absolute;inset:0 0 auto;box-sizing:border-box;min-height:24px;max-height:min(240px,45dvh);overflow:auto;overscroll-behavior:contain;margin:0;padding:3px 0;border:0;border-radius:0;background:#fff;color:#526a88;font:12px/18px Inter,Arial,sans-serif}
#client-billing-editor.v5-invoice-form .iv-duplicate-rail > .iv-duplicate[hidden]{display:none}
#client-billing-editor.v5-invoice-form .iv-duplicate-rail > .iv-duplicate:is([data-level=exact],[data-level=similar]){padding:10px 12px;border:1px solid #eadbb3;border-left:3px solid #b48622;border-radius:6px;background:#fffbef;color:#173451;box-shadow:0 5px 14px #102d5526}
#client-billing-editor.v5-invoice-form .iv-duplicate-rail > .iv-duplicate[data-level=exact]{border-color:#ecd7d3;border-left-color:#d65a5a;background:#fff6f5}
#client-billing-editor.v5-invoice-form .iv-duplicate-rail .iv-duplicate-actions{flex-wrap:wrap}
/* Reserve every result row before typing; amounts only replace text nodes. */
#client-billing-editor.v5-invoice-form .iv-bottom{align-items:start}
#client-billing-editor.v5-invoice-form .iv-bottom > :is(.iv-summary,.iv-settlement){box-sizing:border-box;height:132px;min-height:132px;max-height:132px;overflow:hidden}
#client-billing-editor.v5-invoice-form .iv-summary > h3{padding-right:0;white-space:nowrap}
#client-billing-editor.v5-invoice-form .iv-summary dl{display:grid;grid-template-rows:repeat(4,16px) 28px;margin:0}
#client-billing-editor.v5-invoice-form .iv-summary dl > div{display:grid;grid-template-columns:minmax(0,1fr) max-content;align-items:center;height:16px;min-height:16px;box-sizing:border-box;margin:0;padding:0;line-height:16px}
#client-billing-editor.v5-invoice-form .iv-summary dl > div:last-child{height:28px;min-height:28px;margin:0;padding:2px 5px;line-height:24px}
#client-billing-editor.v5-invoice-form .iv-summary :is(dt,dd){min-width:0;margin:0;white-space:nowrap;font-variant-numeric:tabular-nums}
#client-billing-editor.v5-invoice-form .iv-summary dd{text-align:right}
#client-billing-editor.v5-invoice-form .iv-settlement :is([data-paid],[data-outstanding]){height:16px;min-height:16px;max-height:16px;white-space:nowrap}
#client-billing-editor.v5-invoice-form .iv-invoice-table .invoice-line:not(:has([data-legacy-amounts]:not([hidden]))){height:36px;min-height:36px;max-height:36px;grid-auto-rows:36px}
@media(max-width:767px){#client-billing-editor.v5-invoice-form > .iv-duplicate-rail{margin-inline:10px}}
/* Retention feedback occupies reserved slots, including while it is hidden.
   Typing the first nonzero digit cannot push the economic/payment summaries. */
#client-billing-editor.v5-invoice-form .iv-line-tools{box-sizing:border-box;height:96px;min-height:96px;max-height:96px;align-content:start;align-items:start;padding-bottom:64px}
#client-billing-editor.v5-invoice-form .iv-line-tools .iv-retention > .iv-check{position:absolute;top:40px;left:0;margin:0;height:24px;line-height:24px}
#client-billing-editor.v5-invoice-form .iv-line-tools [data-retention-suggest]{position:absolute;top:36px;right:0;margin:0}
#client-billing-editor.v5-invoice-form .iv-line-tools [data-retention-note]{position:absolute;top:74px;left:0;right:0;margin:0;height:18px;line-height:18px}
/* Approved reference, 11 October: one stable viewport and matching grids in both books. */
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true]{--iv-blue:#0062ff;--iv-ink:#002b83;--iv-border:#d5e4fa;--iv-control:clamp(34px,4.69dvh,48px);--iv-font:clamp(13px,1.57dvh,16px);--iv-gap:clamp(10px,1.56dvh,16px);width:min(1280px,94vw);max-width:1280px;height:calc(100dvh - clamp(32px,6.25dvh,64px));max-height:calc(100dvh - 32px);padding:0;border:1px solid #aecbfa;border-radius:15px;background:#fff;color:var(--iv-ink);box-shadow:0 18px 60px #073b7a40;font-family:Inter,Arial,sans-serif}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true]::backdrop{background:#103b7659;backdrop-filter:blur(5px)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header{height:clamp(56px,7.42dvh,76px);min-height:0;flex:0 0 clamp(56px,7.42dvh,76px);box-sizing:border-box;padding:10px 22px 10px 28px;gap:16px;background:linear-gradient(110deg,#193d77,#1b407b 60%,#163665);border-bottom:1px solid #7298d4;color:#fff}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header > div:first-child{position:relative;padding-left:47px;min-width:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header > div:first-child::before{content:'';position:absolute;left:0;top:1px;width:30px;height:40px;border:2px solid #c8ddff;border-radius:2px;background:linear-gradient(#c8ddff,#c8ddff) 7px 16px/15px 2px no-repeat,linear-gradient(#c8ddff,#c8ddff) 7px 23px/15px 2px no-repeat,linear-gradient(#c8ddff,#c8ddff) 7px 30px/11px 2px no-repeat;box-shadow:2px 2px 7px #081f5040}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header h2{font-size:clamp(20px,2.54dvh,26px);line-height:1.15;letter-spacing:0;font-weight:700;color:#fff;margin:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header small{font-size:clamp(11px,1.37dvh,14px);line-height:18px;font-weight:400;letter-spacing:.02em;color:#cadbfa;margin-top:3px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header button{height:var(--iv-control);min-height:var(--iv-control);font-size:var(--iv-font);font-weight:600;padding:8px 20px;gap:10px;border:1px solid #5d81b3;border-radius:9px;background:#ffffff05;box-shadow:inset 0 0 8px #ffffff08;color:#fff!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] [data-registration-options]::before{content:'⚙';font-size:23px;font-weight:400}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] [data-close]::before{content:'×';font-size:27px;font-weight:300;line-height:20px;margin-right:5px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-editor-body{padding:var(--iv-gap) 28px 0;gap:var(--iv-gap);grid-template-rows:auto auto auto;align-content:start;overflow-x:hidden;overflow-y:auto;scrollbar-gutter:stable;scrollbar-width:thin}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(.iv-section > h3,.iv-fiscal-heading){font-size:clamp(15px,1.76dvh,18px);line-height:24px;font-weight:650;color:var(--iv-ink);padding:0 0 3px;margin:0;border-color:#e1ecfa}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(.iv-section > h3,.iv-fiscal-heading)::before{content:'▤';display:inline-block;width:28px;margin-right:10px;font-size:25px;line-height:22px;vertical-align:middle;color:#1474ff;font-weight:400}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading::before{content:'♙';font-size:29px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section > h3::before{width:24px;margin-right:14px;font-size:23px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general{grid-template-columns:1.24fr 1.04fr 1fr 1fr 1.49fr;gap:clamp(9px,1.57dvh,16px) 14px;align-items:start}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true][data-direction=issued] .iv-general{grid-template-columns:1.24fr 1.04fr 1fr 2.53fr}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] label{font-size:clamp(12px,1.47dvh,15px);line-height:18px;font-weight:600;gap:5px;color:var(--iv-ink)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(input:not([type=checkbox]),select){height:var(--iv-control);min-height:var(--iv-control);box-sizing:border-box;border:1px solid #c8dcfb;border-radius:8px;padding:8px 13px;font-size:var(--iv-font);line-height:22px;font-weight:400;color:#002469;background:#fff;box-shadow:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(input,textarea)::placeholder{color:#6c88bb;opacity:1}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general :is(input:not([type=checkbox]),select){border-color:#7aa8ff;background:linear-gradient(135deg,#fff,#f2f7ff);box-shadow:0 3px 8px #006aff09}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general .iv-general-concept input{border-color:#c8dcfb;background:#fff;box-shadow:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-number-pair{display:block;grid-column:1;grid-row:2}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-number-pair::before{content:'Serie / Número';display:block;margin-bottom:5px;font-size:clamp(12px,1.47dvh,15px);line-height:18px;font-weight:600;color:var(--iv-ink)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-number-pair label{font-size:0;line-height:0;gap:0;display:block}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general-concept{grid-column:4/-1;grid-row:3}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-finder > label{font-size:0;line-height:18px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-finder > label::before{content:'Proveedor';font-size:clamp(12px,1.47dvh,15px);color:var(--iv-ink)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true][data-direction=issued] .iv-party-finder > label::before{content:'Cliente'}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-compact > .party-search-controls{height:var(--iv-control)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-compact > .party-search-controls input{padding-right:38px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-compact > .party-search-controls > [data-party-dropdown]{height:calc(var(--iv-control) - 2px);min-height:0;width:36px;right:1px;top:1px;border:0;background:transparent;color:#004bc5}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-finder > #ac-party-search-status{font-size:clamp(10px,1.27dvh,13px);line-height:20px;grid-row:1;grid-column:2/-1;color:#6583b6;padding:0;max-height:24px;overflow:hidden}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .search-combobox > .combobox-toggle{height:calc(var(--iv-control) - 2px)!important;min-height:0!important;width:32px;top:1px;right:1px;background:transparent;border:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading{margin-top:clamp(0px,.6dvh,6px);height:clamp(30px,4.5dvh,46px);box-sizing:border-box;gap:10px;align-items:center}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading button{height:clamp(30px,3.91dvh,40px);min-height:0;padding:6px 15px;border:1px solid #c5dcff;border-radius:7px;background:linear-gradient(#f8fbff,#f0f6ff);color:#0062ff!important;font-size:var(--iv-font);font-weight:500;white-space:nowrap}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading .iv-party-actions button{height:clamp(30px,3.91dvh,40px);min-height:0;padding:6px 15px;font-size:var(--iv-font)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading .iv-party-actions [data-party-clear]{width:24px;padding:0;font-size:20px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general:has(.iv-party-selected[hidden]) .iv-party-actions [data-party-clear]{display:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-selected{display:grid!important;grid-template-columns:1.1fr 1.54fr .5fr 1.1fr 1.1fr .84fr;gap:clamp(6px,.78dvh,8px) 14px;padding:0;margin:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-selected small{font-size:clamp(12px,1.47dvh,15px);line-height:18px;font-weight:400;color:#14458f;margin-bottom:4px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-selected :is(strong,span){height:clamp(24px,3.12dvh,32px);font-size:clamp(12px,1.47dvh,15px);line-height:22px;padding:3px 10px;font-weight:400;border:1px solid #d9e8fc;border-radius:5px;background:#f8fbff;color:#6589c3}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-period-strip{margin:0;min-height:30px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table{--iv-columns:minmax(0,355fr) minmax(0,136fr) minmax(0,92fr) minmax(0,105fr) minmax(0,96fr) minmax(0,106fr) minmax(0,38fr) minmax(0,154fr) minmax(0,98fr)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true][data-direction=received] .iv-invoice-table{--iv-columns:minmax(0,355fr) minmax(0,136fr) minmax(0,92fr) minmax(0,105fr) minmax(0,96fr) minmax(0,106fr) minmax(0,38fr) minmax(0,154fr) minmax(0,98fr)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table [data-column-direction=issued]{display:none!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table th{height:clamp(28px,3.7dvh,38px);padding:8px 10px;font-size:clamp(12px,1.47dvh,15px);line-height:20px;border-right:0;color:var(--iv-ink);background:linear-gradient(#f3f8fe,#edf5ff)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table .invoice-line:not(:has([data-legacy-amounts]:not([hidden]))){height:calc(var(--iv-control) + 8px);min-height:calc(var(--iv-control) + 8px);max-height:calc(var(--iv-control) + 8px);grid-auto-rows:calc(var(--iv-control) + 8px)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table td{height:calc(var(--iv-control) + 8px);padding:4px 6px;border-right:1px solid #edf2fb}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table :is(input,select){height:calc(var(--iv-control) - 4px);min-height:calc(var(--iv-control) - 4px);font-size:var(--iv-font);line-height:22px;padding:7px 10px;border:1px solid #cbdcf8;border-radius:7px;background:#fff;box-shadow:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table .iv-row-total{font-size:clamp(14px,1.76dvh,18px);line-height:calc(var(--iv-control) - 4px);padding:0;color:#002d87}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table [data-remove]{height:calc(var(--iv-control) - 4px);min-height:0;width:24px;padding:4px 0;color:#1173ff!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools{height:var(--iv-control);min-height:var(--iv-control);max-height:var(--iv-control);margin-top:12px;padding:0;gap:10px;align-items:center;align-content:center;flex-wrap:nowrap;z-index:2}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools button{height:calc(var(--iv-control) - 8px);min-height:0;white-space:nowrap;padding:6px 12px;font-size:clamp(12px,1.47dvh,15px);font-weight:500;border-color:#c4daff;color:#0060ff;background:linear-gradient(#f9fbff,#f1f7ff)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools [data-add]::before{content:'+';font-size:25px;line-height:16px;vertical-align:middle;margin-right:10px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools [data-continue]::before{content:'→';font-size:24px;line-height:16px;vertical-align:middle;margin-right:10px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools .iv-retention > label:first-child{flex:1 1 330px;max-width:390px;min-width:200px;gap:12px;font-size:clamp(11px,1.37dvh,14px);font-weight:400;color:#355da1}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools .iv-retention select{height:calc(var(--iv-control) - 8px);min-height:0;font-size:clamp(12px,1.47dvh,15px);color:#5577ab}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools .line-total{font-size:clamp(11px,1.47dvh,15px);line-height:20px;color:#375c9d;white-space:nowrap}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-help summary{font-size:clamp(11px,1.47dvh,15px);color:#0062ff;white-space:nowrap;border-left:1px solid #deebff;padding-left:18px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-help summary::before{content:'+ ';font-size:21px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools .iv-retention > .iv-check{top:100%;padding:5px 10px;height:30px;box-sizing:border-box;border:1px solid #d6e4f7;border-bottom:0;border-radius:7px 7px 0 0;background:#f5f9ff;right:0;z-index:3}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools [data-retention-note]{top:calc(100% + 30px);height:24px;padding:1px 10px;box-sizing:border-box;border:1px solid #d6e4f7;border-top:0;border-radius:0 0 7px 7px;background:#f5f9ff;z-index:3}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools [data-retention-suggest]{top:calc(100% + 3px);right:8px;z-index:4}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom{grid-template-columns:36fr 31fr 33fr;gap:0;margin:0 -28px;border-top:1px solid #d9e7fa;border-bottom:1px solid #d9e7fa;background:#fff}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section{height:clamp(128px,15.23dvh,156px);min-height:clamp(128px,15.23dvh,156px);max-height:clamp(128px,15.23dvh,156px);box-sizing:border-box;border:0;border-right:1px solid #d9e7fa;border-radius:0;padding:12px 20px;overflow:hidden}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section:first-child{padding-left:28px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section:last-child{border-right:0;padding-right:28px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section > h3{font-size:clamp(13px,1.57dvh,16px);line-height:22px;font-weight:600;margin:0 0 7px;padding:0;border:0;color:var(--iv-ink)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom .iv-attachment{width:100%;height:clamp(80px,9.37dvh,96px);min-height:0;padding:12px 16px;box-sizing:border-box;border:1px dashed #b8d3fd;border-radius:9px;display:flex;flex-direction:column;align-items:start;justify-content:center;font-size:clamp(12px,1.47dvh,15px);font-weight:400;line-height:20px;gap:7px;color:#3a60a6}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-attachment input{height:32px;min-height:32px;padding:0;border:0;border-radius:0;font-size:clamp(11px,1.37dvh,14px);color:#325caa;background:transparent}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-attachment input::file-selector-button{height:32px;border:1px solid #c5dcff;border-radius:6px;padding:4px 12px;background:#f1f7ff;color:#0063ff;font:inherit}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary dl{grid-template-rows:repeat(3,clamp(16px,2.1dvh,22px)) clamp(24px,3.12dvh,32px)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary dl > div{height:clamp(16px,2.1dvh,22px);min-height:0;font-size:clamp(11px,1.37dvh,14px);line-height:clamp(16px,2.1dvh,22px);color:#3c62a9}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary dl > div[data-summary-key=Recargo]{display:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary dl > div:last-child{height:clamp(24px,3.12dvh,32px);min-height:0;margin-top:3px;border:0;border-radius:7px;font-size:clamp(13px,1.57dvh,16px);line-height:22px;font-weight:650;background:linear-gradient(100deg,#eaf3ff,#e1edff);color:#004bc7;padding:4px 10px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement :is([data-paid],[data-outstanding]),#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement > small{display:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement :is([data-state-label],.iv-settlement-date){display:grid;grid-template-columns:1fr 1.3fr;align-items:center;gap:8px;font-weight:400;font-size:clamp(11px,1.37dvh,14px);line-height:20px;color:#355b9f;margin:4px 0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement [data-state-label] select,#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement .search-combobox > input,#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement-date input{height:clamp(30px,4dvh,42px);min-height:0;padding:6px 12px;font-size:clamp(12px,1.47dvh,15px);background:#fff;color:#123e86;opacity:1}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-footer{height:clamp(60px,7.42dvh,76px);min-height:0;flex:0 0 clamp(60px,7.42dvh,76px);box-sizing:border-box;margin:0;padding:12px 26px;gap:12px;align-items:center;border:0;background:#fff}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true][data-direction=issued] .iv-footer{padding-bottom:12px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-footer button{height:var(--iv-control);min-height:var(--iv-control);padding:10px 20px;border:1px solid #c5d9fb;border-radius:9px;font-size:var(--iv-font);font-weight:600;gap:12px;color:#005bff;background:#fff}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-footer button.primary{padding-inline:24px;background:#1767ff;color:#fff;border-color:#0758f0;box-shadow:0 3px 7px #005cff24}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is([data-fiscal-issue],[data-issue-help]){display:none!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-footer svg{height:22px;width:22px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .iv-duplicate-rail{height:0;min-height:0;flex:0 0 0;margin:0 28px;z-index:5}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-duplicate-rail > .iv-duplicate{left:auto;right:0;top:4px;width:max-content;max-width:75%;min-height:0;font-size:12px;background:#fff;padding:3px 5px;box-shadow:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-duplicate-rail > .iv-duplicate:is([data-level=exact],[data-level=similar]){top:8px;width:min(650px,100%);max-width:100%}
/* Focus ring uses only paint, never border width or control metrics. */
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(input,select,textarea,button,summary,[tabindex]):focus-visible{outline:2px solid #087bff;outline-offset:-2px;border-color:#087bff!important;box-shadow:0 0 0 4px #1679ff36,0 0 10px #1679ff24!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(input,select,textarea):focus{border-color:#087bff;box-shadow:0 0 0 4px #1679ff36,0 0 10px #1679ff24}
@media(max-width:767px){#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true]{width:calc(100vw - 20px)}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-editor-body{padding-inline:12px}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom{margin-inline:-12px;grid-template-columns:1fr}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section{border-right:0;border-bottom:1px solid #d9e7fa}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools{height:auto;max-height:none;flex-wrap:wrap}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table{min-width:920px!important}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-scroll{overflow-x:auto}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header > div:first-child{padding-left:0}#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] > .invoice-editor-header > div:first-child::before{display:none}}

#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true]{left:50vw;right:auto;top:50dvh;bottom:auto;margin:0;transform:translate(-50%,-50%)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(.iv-section > h3,.iv-fiscal-heading) > .ui-icon{display:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general{grid-template-columns:1.24fr 1.04fr 1fr .98fr 1.49fr;row-gap:12px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true][data-direction=issued] .iv-general{grid-template-columns:1.24fr 1.04fr 1fr 2.53fr}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-editor-body{padding-top:16px;gap:12px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-selected{background:transparent}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-party-selected small{font-weight:400}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general > h3{margin-bottom:-4px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-help summary{list-style:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-help summary::-webkit-details-marker{display:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools [data-add]:has(svg)::before{display:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools button svg{height:22px;width:22px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading > button{font-size:0;gap:10px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading > button::after{content:'Nuevo tercero';font-size:var(--iv-font)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true][data-direction=issued] .iv-fiscal-heading > button::after{content:'Nuevo cliente'}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading .iv-party-actions button:not([data-party-clear]){font-size:0;gap:10px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading .iv-party-actions button:not([data-party-clear])::after{content:'Editar tercero';font-size:var(--iv-font)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true][data-direction=issued] .iv-fiscal-heading .iv-party-actions button:not([data-party-clear])::after{content:'Editar cliente'}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading button svg{height:22px;width:22px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section{background:#fff;border-radius:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement .search-combobox input{font-weight:400;color:#123e86!important;background:#fff!important;border-color:#c8dcfb!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement .combobox-toggle{background:transparent;border:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement [data-state-label]{font-size:clamp(11px,1.37dvh,14px)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table [data-remove]{background:transparent!important;box-shadow:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary:has([data-has-surcharge=true]) dl{grid-template-rows:repeat(4,16px) 28px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary:has([data-has-surcharge=true]) dl > div{height:16px;line-height:16px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary dl > div[data-summary-key=Recargo][data-has-surcharge=true]{display:grid}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary:has([data-has-surcharge=true]) dl > div:last-child{height:28px;line-height:20px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] :is(.iv-section > h3,.iv-fiscal-heading)::before{content:'';flex:0 0 26px;width:26px;height:26px;display:inline-block;background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%231474ff%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%202h9l5%205v15H5z%20M14%202v6h5%20M8%2012h8%20M8%2016h8%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;vertical-align:middle}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general .iv-fiscal-heading::before{content:'';flex:0 0 26px;width:26px;height:26px;display:inline-block;background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%231474ff%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M16%2021v-2a4%204%200%200%200-4-4H6a4%204%200%200%200-4%204v2%20M9%2011a4%204%200%201%200%200-8%204%204%200%200%200%200%208%20M17%204a4%204%200%200%201%200%208%20M22%2021v-2a4%204%200%200%200-3-4%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;vertical-align:middle}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section:first-child > h3::before{content:'';flex:0 0 26px;width:26px;height:26px;display:inline-block;background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%231474ff%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M2%206h8l2%203h10v12H2z%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;vertical-align:middle}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary > h3::before{content:'';flex:0 0 26px;width:26px;height:26px;display:inline-block;background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%231474ff%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%2020V10h3v10z%20M11%2020V4h3v16z%20M18%2020V8h3v12z%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;vertical-align:middle}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement > h3::before{content:'';flex:0 0 26px;width:26px;height:26px;display:inline-block;background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%231474ff%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M8%205h13%20M8%2012h13%20M8%2019h13%20M2%205h1%20M2%2012h1%20M2%2019h1%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;vertical-align:middle}

#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table label{font-size:0;line-height:0;gap:0;display:block}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table th[data-iv-cell=remove]{font-size:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-invoice-table [data-iv-cell=total]{border-left:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement [data-state-label] .search-combobox{grid-column:2;grid-row:1}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement [data-state-label] .search-combobox input{width:100%}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading button .ui-icon{display:inline-block!important;flex:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom .iv-section h3{font-weight:600}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-header-actions{gap:12px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] [data-registration-options]::before{margin-right:10px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools .iv-retention{flex:1;min-width:0}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-line-tools .iv-retention > label:first-child{max-width:none}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-summary > h3::before,#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-settlement > h3::before,#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section:first-child > h3::before{height:22px;width:22px;flex-basis:22px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-editor-body{gap:10px}

#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true]{height:calc(100dvh - clamp(32px,5.86dvh,60px));top:calc(50dvh + 6px)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-general{row-gap:14px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-editor-body{gap:9px}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .hf-periods{font-size:clamp(12px,1.47dvh,15px);line-height:22px;color:#355b9f}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .hf-periods button{font-size:clamp(13px,1.66dvh,17px);font-weight:600;color:#0064ff}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-bottom > .iv-section{height:clamp(128px,15.04dvh,154px);min-height:clamp(128px,15.04dvh,154px);max-height:clamp(128px,15.04dvh,154px)}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading button .ui-icon{display:none!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading > button::before{content:'+';font-size:26px;line-height:22px;width:22px;font-weight:400}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout=true] .iv-fiscal-heading .iv-party-actions button:not([data-party-clear])::before{content:'✎';font-size:26px;line-height:22px;width:22px;font-weight:400}

/* Guided correction: header actions stay outside the scrolling invoice body. */
#client-billing-editor.v5-invoice-form > .invoice-editor-header{position:sticky;top:0;z-index:4;height:auto;min-height:64px;flex:0 0 auto;flex-wrap:wrap;gap:8px;padding:10px 18px}
#client-billing-editor.v5-invoice-form > .invoice-editor-header > div:first-child{flex:1 1 220px;min-width:0}
#client-billing-editor.v5-invoice-form > .invoice-editor-header button{white-space:normal;line-height:1.25;height:auto;min-height:38px;flex:0 0 auto}
#client-billing-editor.v5-invoice-form > .invoice-editor-header [data-rent-history]{background:#ffdf8b;border-color:#ffdf8b;color:#17375c!important;font-weight:750;order:1}
#client-billing-editor.v5-invoice-form > .invoice-editor-header [data-close]{margin-left:0;order:4}
#client-billing-editor.v5-invoice-form > .invoice-editor-header [data-invoice-ledger]{order:2}
#client-billing-editor.v5-invoice-form > .invoice-editor-header [data-invoice-preview]{order:3}
.invoice-correction-status{flex:0 0 auto;display:flex;align-items:center;gap:12px;padding:8px 18px;background:#edf4ff;color:#17375c;font-size:13px;border-bottom:1px solid #ccd9ea}
.invoice-correction-status[hidden]{display:none}
.invoice-correction-dialog{padding:0;width:min(900px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:hidden;color:#17375c}
.invoice-correction-dialog[open]{display:flex;flex-direction:column}
.invoice-correction-dialog>header{display:flex;align-items:center;flex-wrap:wrap;gap:12px;flex:0 0 auto;padding:16px 20px;background:#153f73;color:white}
.invoice-correction-dialog>header>div{flex:1 1 240px}.invoice-correction-dialog h2{margin:0;color:inherit;font-size:20px}
.invoice-correction-dialog>header button{background:#fff;color:#17375c!important;border:1px solid #ccd9ea;min-height:40px}
.correction-banner{display:block;margin-top:8px;color:#ffe29c;font-size:15px}
.correction-body{padding:16px 20px;overflow:auto;min-height:0}.correction-body form{margin:0}.correction-body textarea{min-height:76px}
.invoice-correction-dialog>footer{flex:0 0 auto;display:flex;justify-content:flex-end;flex-wrap:wrap;gap:10px;padding:14px 20px;background:white;border-top:1px solid #ccd9ea}
.invoice-correction-dialog [data-result]{flex-basis:100%;margin:0;color:#17375c}.invoice-correction-dialog button{min-height:40px}
.invoice-correction-dialog button.primary{background:#153f73;color:white}
@media(max-width:650px){#client-billing-editor.v5-invoice-form > .invoice-editor-header{padding:8px;gap:6px}#client-billing-editor.v5-invoice-form > .invoice-editor-header > div:first-child{flex-basis:100%}#client-billing-editor.v5-invoice-form > .invoice-editor-header button{font-size:12px;padding:7px 9px;flex:1 1 40%}.invoice-correction-status{font-size:12px;padding:6px 10px}.invoice-correction-dialog>header,.invoice-correction-dialog>footer,.correction-body{padding:12px}.correction-body form.grid{grid-template-columns:1fr}}

/* Visible document choice shares the existing invoice grid position. */
#client-billing-editor.v5-invoice-form .iv-general > label[data-document-choice-label]{grid-column:1;grid-row:3}
#client-billing-editor [data-rental-identities]{grid-column:1/-1;font-weight:600;margin:.3rem 0}
/* Keep the customer/supplier selector alongside the first-row inputs. */
@media(min-width:1001px){
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-party-compact>.party-search-controls{align-self:start;margin-top:23px}
}
/* Scoped restoration: documentary series and invoice number are separate fields. */
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-number-pair::before{content:none!important;display:none!important}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-general .iv-number-pair{display:grid!important;grid-template-columns:minmax(100px,1fr) minmax(140px,1.3fr);gap:8px!important;grid-column:1/3!important;grid-row:2!important;min-width:0}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-number-pair>label{display:flex!important;flex-direction:column;font-size:12px!important;line-height:17px!important;gap:5px!important;width:100%!important;min-width:0}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-number-pair>label[hidden]{display:none!important}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-number-pair:has([data-number-mode]){grid-template-columns:minmax(110px,.8fr) minmax(120px,1fr) minmax(160px,1.3fr);grid-column:1/4!important}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-number-pair:has([data-number-mode-label][hidden]){grid-template-columns:minmax(100px,1fr) minmax(160px,1.5fr);grid-column:1/3!important}
#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-general{grid-template-columns:repeat(5,minmax(0,1fr)) minmax(180px,1.4fr)!important}
#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-general>label:has([name=date]){grid-column:4!important;grid-row:2!important}
#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-general>label:has([name=due]){grid-column:5!important;grid-row:2!important}
#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-party-finder>label,#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-party-compact>.party-search-controls{grid-column:6!important;grid-row:2!important}
#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-general-concept{grid-column:4/7!important;grid-row:3!important}
#client-billing-editor.v5-invoice-form[open][data-direction=received]:not(.ob-billing-editor) .iv-general>label:has([name=date]){grid-column:3!important}
#client-billing-editor.v5-invoice-form[open][data-direction=received]:not(.ob-billing-editor) .iv-general>label:has([name=bookingDate]){grid-column:4!important;grid-row:2!important}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-number-pair .iv-number-help{grid-column:1/-1;color:#365276;font-size:11px;line-height:15px;margin:0}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-series-controls{display:flex;gap:4px;min-width:0}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-series-controls>select{min-width:0;flex:1}
#client-billing-editor.v5-invoice-form[open][data-direction] .iv-series-controls>button{padding:4px 8px;min-width:32px;color:#17456d!important;background:#edf4fc;border:1px solid #90aac8;border-radius:7px}
#client-billing-editor.v5-invoice-form[open][data-direction].ob-billing-editor .iv-general .iv-number-pair{grid-column:1/-1!important;grid-row:auto!important}
.sb-compact-status{font-size:11px;line-height:15px;color:#f1f6ff;max-width:145px;white-space:normal}
.iv-registration-dialog .sb-registration{padding:12px 0;border-top:1px solid #cbd7e5;margin-top:12px;font-size:13px;color:#172536}
.iv-registration-dialog .sb-registration h3{font-size:16px;margin:0}
.iv-registration-dialog .sb-registration .sb-agreement{padding:9px 12px;margin-top:8px}
.iv-registration-dialog .sb-registration>strong{display:block;margin-top:4px}
.iv-registration-dialog .sb-registration button{background:#fff;color:#1e405c!important;border:1px solid #9fb3c9;border-radius:7px;padding:7px 10px;opacity:1}
.iv-registration-dialog .sb-registration button:disabled{background:#e7edf4;color:#4a5f77!important;border-color:#bdcbd9;opacity:1;cursor:not-allowed}
@media(max-width:800px){
 #client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-general{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 #client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-general>label,#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-general-concept{grid-column:auto!important;grid-row:auto!important}
 #client-billing-editor.v5-invoice-form[open][data-direction] .iv-general .iv-number-pair{grid-column:1/-1!important;grid-row:auto!important;grid-template-columns:1fr 1fr!important}
 #client-billing-editor.v5-invoice-form[open][data-direction] [data-number-mode-label]{grid-column:1/-1!important}
 #client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-party-finder>label,#client-billing-editor.v5-invoice-form[open][data-direction]:not(.ob-billing-editor) .iv-party-compact>.party-search-controls{grid-column:1/-1!important;grid-row:auto!important}
 .sb-compact-status{display:none}
}
/* Narrow screens use explicit full rows, avoiding implicit date columns. */
@media(max-width:1000px){
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general{grid-template-columns:repeat(6,minmax(0,1fr))!important;gap:10px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has(input,select){grid-column:span 2!important;grid-row:auto!important;min-width:0}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>h3{grid-column:1/-1!important;grid-row:1!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general .iv-number-pair{grid-column:1/-1!important;grid-row:2!important;grid-template-columns:minmax(0,.8fr) minmax(0,1fr) minmax(0,1.5fr)!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general .iv-number-pair:has([data-number-mode-label][hidden]){grid-template-columns:minmax(0,1fr) minmax(0,1.5fr)!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] [data-number-mode-label]{grid-column:auto!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=date]){grid-column:1/3!important;grid-row:3!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=bookingDate]){grid-column:3/5!important;grid-row:3!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=due]){grid-column:5/7!important;grid-row:3!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=documentType],[data-document-choice]){grid-column:1/3!important;grid-row:4!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=category]){grid-column:3/5!important;grid-row:4!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=status]){grid-column:5/7!important;grid-row:4!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general-concept{grid-column:1/-1!important;grid-row:5!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-party-finder{grid-column:1/-1!important;grid-row:6!important;display:grid!important;grid-template-columns:1fr!important;gap:7px}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-party-finder>*{grid-column:1!important;grid-row:auto!important;min-width:0}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-party-finder>.party-search-controls{grid-column:1!important;grid-row:auto!important;margin:0!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-general :is(input,select,.search-combobox){min-width:0!important;width:100%!important;max-width:100%!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-fiscal-heading{height:auto!important;min-height:32px;flex-wrap:wrap}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-line-scroll{overflow-x:auto!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-invoice-table{min-width:920px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-line-tools{height:auto!important;max-height:none!important;flex-wrap:wrap!important}
}
@media(max-width:550px){
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-editor-body{padding-inline:12px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general .iv-number-pair{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr)!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-general .iv-number-pair>[data-number-mode-label]{grid-column:1/-1!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-party-selected{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-party-selected>div{grid-column:auto!important;grid-row:auto!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-party-selected>.iv-party-name,#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-party-selected>.iv-party-address{grid-column:1/-1!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]>.invoice-editor-header{height:auto!important;min-height:90px!important;flex-wrap:wrap;gap:6px;padding:8px 12px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]>.invoice-editor-header h2{font-size:17px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-header-actions{width:100%;justify-content:flex-end;gap:8px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]>.invoice-editor-header button{padding:5px 10px!important;font-size:12px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-footer{padding:8px!important;gap:5px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-footer button{padding:7px!important;gap:4px!important;font-size:11px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-footer svg{width:15px!important;height:15px!important}
}
#client-billing-editor.v5-invoice-form [data-new-document-series] .ui-icon{display:none!important}
@media(max-width:550px){
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general.iv-general>label:has(input,select){grid-column:auto!important;grid-row:auto!important;order:6}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=date]){order:3!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=bookingDate]){order:4!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>label:has([name=due]){order:5!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general-concept{grid-row:auto!important;grid-column:1/-1!important;order:8}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-party-finder{grid-row:auto!important;grid-column:1/-1!important;order:9}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-general>.hf-periods{order:10}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]:not(.ob-billing-editor) .iv-party-finder>.party-search-controls{padding:0!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout]>.invoice-editor-header{flex:0 0 auto!important;min-height:110px!important}
}
@media(max-width:550px){
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-header-actions [data-registration-options]{flex:1;white-space:nowrap!important;font-size:11px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-header-actions [data-registration-options]::before{font-size:17px!important;margin-right:4px!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-header-actions [data-close]{flex:0 0 78px;white-space:nowrap!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-number-pair>label{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;justify-content:flex-end}
}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout].ob-billing-editor .iv-general .iv-number-pair{grid-template-columns:minmax(120px,.8fr) minmax(150px,1fr) minmax(180px,1.5fr)!important;grid-column:1/-1!important}
#client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout].ob-billing-editor .iv-general .iv-number-pair:has([data-number-mode-label][hidden]){grid-template-columns:minmax(0,1fr) minmax(0,1.5fr)!important}
@media(max-width:550px){
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout].ob-billing-editor .iv-general .iv-number-pair{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr)!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout].ob-billing-editor .iv-header-actions{flex-wrap:wrap}
}

/* Mobile invoice actions must reserve their full wrapped height. */
@media(max-width:550px){
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-footer{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));height:auto!important;flex:0 0 auto!important;min-height:0!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-footer button{width:100%;margin:0!important}
 #client-billing-editor.v5-invoice-form[open][data-direction][data-reference-layout] .iv-footer button.primary{grid-column:1/-1}
}
