#client-billing-editor.v5-invoice-form{--v5-surface-opacity:.94;--v5-glass-blur:12px;--v5-accent:#d9a928;--v5-bg:#f4f8fc;--v5-text:#102d55;--iv-border:#c7d9f5;--iv-blue:#1666e8;--iv-muted:#5d6f8c;width:94vw;max-width:1220px;max-height:min(90dvh,calc(100dvh - 48px));padding:0;border:1px solid rgba(40,90,160,.16);border-radius:14px;background:rgba(255,255,255,var(--v5-surface-opacity));backdrop-filter:blur(var(--v5-glass-blur));box-shadow:0 18px 55px rgba(6,35,63,.22);color:var(--v5-text);overflow:auto}
#client-billing-editor.v5-invoice-form>.card{margin:0;padding:0;background:transparent;border:0;box-shadow:none}
#client-billing-editor.v5-invoice-form header{position:sticky;top:0;z-index:12;min-height:72px;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 20px;background:rgba(255,255,255,.96);border-bottom:1px solid var(--iv-border);color:var(--v5-text)}
#client-billing-editor.v5-invoice-form header h2{font-size:22px;margin:0;color:var(--v5-text)}
#client-billing-editor.v5-invoice-form form.grid{display:flex;flex-direction:column;gap:14px;padding:16px 20px 0}
#client-billing-editor.v5-invoice-form .iv-section{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:16px;border:1px solid var(--iv-border);border-radius:12px;background:rgba(255,255,255,.94);min-width:0}
#client-billing-editor.v5-invoice-form .iv-section>h3{grid-column:1/-1;font-size:16px;font-weight:700;margin:0;color:var(--v5-text)}
#client-billing-editor.v5-invoice-form label{font-size:13px;line-height:1.4;font-weight:600;gap:5px;min-width:0;max-width:none;color:var(--v5-text)}
#client-billing-editor.v5-invoice-form input:not([type=checkbox]),#client-billing-editor.v5-invoice-form select{box-sizing:border-box;height:40px;min-height:40px;width:100%;font-size:14px;padding:8px 10px;border:1px solid var(--iv-border);border-radius:8px;color:var(--v5-text);background:white}
#client-billing-editor.v5-invoice-form input:focus,#client-billing-editor.v5-invoice-form select:focus,#client-billing-editor.v5-invoice-form textarea:focus{outline:0;border-color:var(--iv-blue);box-shadow:0 0 0 3px #1666e81f}
#client-billing-editor.v5-invoice-form textarea{width:100%;box-sizing:border-box;min-height:60px;border:1px solid var(--iv-border);border-radius:8px}
#client-billing-editor.v5-invoice-form button{min-height:38px;border-radius:8px;font-size:14px;transition:transform 160ms,box-shadow 160ms}
#client-billing-editor.v5-invoice-form button:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 3px 8px #06233f18}
#client-billing-editor.v5-invoice-form button.primary{background:var(--v5-accent);color:var(--v5-text)}
#client-billing-editor.v5-invoice-form .invoice-advanced{grid-column:1/-1;margin:0;padding:0;border:0;box-shadow:none;background:transparent}
#client-billing-editor.v5-invoice-form .invoice-advanced>label,#client-billing-editor.v5-invoice-form .iv-check{display:flex;flex-direction:row;align-items:center;gap:8px}
#client-billing-editor.v5-invoice-form input[type=checkbox]{width:16px;height:16px;min-height:0;margin:0;flex:none}
#client-billing-editor.v5-invoice-form .iv-party-finder{position:relative;grid-column:1/-1;display:grid;gap:8px}
#client-billing-editor.v5-invoice-form .party-search-controls{display:flex;gap:8px;flex-wrap:nowrap}
#client-billing-editor.v5-invoice-form .party-search-controls input{flex:1;min-width:0}
#client-billing-editor.v5-invoice-form .party-search-controls button{flex:none}
#client-billing-editor.v5-invoice-form .party-search-results{position:static;max-height:210px;box-shadow:0 4px 12px #06233f18;margin:0;padding:4px}
#client-billing-editor.v5-invoice-form .iv-party-finder>button{justify-self:start;width:auto;padding:6px 12px}
#client-billing-editor.v5-invoice-form #ac-party-search-status{justify-self:start;font-size:12px;padding:6px 10px;border-radius:16px;background:#eef5ff;color:var(--iv-muted)}
#client-billing-editor.v5-invoice-form .iv-lines{display:block;overflow-x:auto}
#client-billing-editor.v5-invoice-form .iv-lines>p{font-size:12px;line-height:1.5;color:var(--iv-muted);margin:8px 0}
#client-billing-editor.v5-invoice-form .invoice-line{grid-template-columns:2fr repeat(5,minmax(88px,1fr)) minmax(85px,1fr) auto;padding:10px;gap:8px;min-width:820px;border-color:var(--iv-border)}
#client-billing-editor.v5-invoice-form[data-direction=issued] .invoice-line{grid-template-columns:2fr repeat(5,minmax(88px,1fr)) minmax(85px,1fr) auto}
#client-billing-editor.v5-invoice-form .invoice-line input,#client-billing-editor.v5-invoice-form .invoice-line select{height:38px;min-height:38px}
#client-billing-editor.v5-invoice-form .iv-retention{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:14px;padding-top:12px;border-top:1px solid var(--iv-border)}
#client-billing-editor.v5-invoice-form .iv-retention>label:first-child{min-width:270px;flex:1}
#client-billing-editor.v5-invoice-form .iv-retention>small{flex-basis:100%;font-size:12px;color:var(--iv-muted)}
#client-billing-editor.v5-invoice-form .iv-bottom{display:grid;grid-template-columns:1fr 1fr;gap:14px}
#client-billing-editor.v5-invoice-form .iv-bottom>.iv-section{display:block}
#client-billing-editor.v5-invoice-form dl{margin:12px 0 0}#client-billing-editor.v5-invoice-form dl>div{display:flex;justify-content:space-between;padding:5px 0}#client-billing-editor.v5-invoice-form dd{margin:0;font-variant-numeric:tabular-nums}
#client-billing-editor.v5-invoice-form dl>div:last-child{font-size:22px;font-weight:700;border-top:1px solid var(--iv-border);margin-top:8px;padding-top:12px}
#client-billing-editor.v5-invoice-form .iv-pending{color:#b72d32}
#client-billing-editor.v5-invoice-form .iv-footer{position:sticky;bottom:0;z-index:11;display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;padding:12px 0;background:rgba(255,255,255,.96);border-top:1px solid var(--iv-border)}
#client-billing-editor.v5-invoice-form small{font-size:12px;color:var(--iv-muted)}
@media(max-width:1199px){#client-billing-editor.v5-invoice-form .iv-section{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:767px){#client-billing-editor.v5-invoice-form{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;border-radius:0}#client-billing-editor.v5-invoice-form form.grid{padding:12px 10px 0}#client-billing-editor.v5-invoice-form .iv-section,#client-billing-editor.v5-invoice-form .iv-bottom{grid-template-columns:minmax(0,1fr)}#client-billing-editor.v5-invoice-form header{padding:12px;min-height:68px}#client-billing-editor.v5-invoice-form header h2{font-size:20px}#client-billing-editor.v5-invoice-form .iv-section{padding:12px}#client-billing-editor.v5-invoice-form .iv-footer{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}#client-billing-editor.v5-invoice-form .iv-footer button{flex:1}#client-billing-editor.v5-invoice-form input:not([type=checkbox]),#client-billing-editor.v5-invoice-form select{font-size:16px}#client-billing-editor.v5-invoice-form .iv-retention>label:first-child{min-width:0;width:100%}}
@media(prefers-reduced-motion:reduce){#client-billing-editor.v5-invoice-form button{transition:none;transform:none!important}}

#client-billing-editor.v5-invoice-form .iv-row-total{align-self:end;padding:10px 0;font-size:14px;font-weight:700;white-space:nowrap}

#client-billing-editor.v5-invoice-form .invoice-advanced>.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;margin-top:10px}
#client-billing-editor.v5-invoice-form .invoice-advanced [data-identities]{font-size:12px;color:var(--iv-muted);padding:6px 0;overflow-wrap:anywhere}
#client-billing-editor.v5-invoice-form .invoice-advanced [data-iv-status]:empty{display:none}
#client-billing-editor.v5-invoice-form .iv-attachment{margin-right:auto;width:235px}
#client-billing-editor.v5-invoice-form .iv-footer{align-items:center;backdrop-filter:blur(12px)}
#client-billing-editor.v5-invoice-form header{backdrop-filter:blur(12px)}
@media(max-width:767px){#client-billing-editor.v5-invoice-form .invoice-advanced>.grid{grid-template-columns:minmax(0,1fr)}#client-billing-editor.v5-invoice-form .iv-attachment{width:100%;display:flex;flex-direction:row;align-items:center}#client-billing-editor.v5-invoice-form .iv-attachment input{min-width:0;flex:1}}

#client-billing-editor.v5-invoice-form header{height:76px;min-height:76px}#client-billing-editor.v5-invoice-form header h2{margin:0!important;line-height:1.2}#client-billing-editor.v5-invoice-form header small{display:block;margin-top:4px}

#client-billing-editor.v5-invoice-form header>div{min-width:0;flex:1}#client-billing-editor.v5-invoice-form header>button{flex:0 0 auto}@media(max-width:767px){#client-billing-editor.v5-invoice-form header h2{font-size:18px;white-space:normal}}

/* Daily entry: aligned rows, compact controls and explicit secondary actions. */
#client-billing-editor.v5-invoice-form form.grid{gap:10px;padding:12px 16px 0}
#client-billing-editor.v5-invoice-form .iv-section{padding:12px;gap:9px;grid-template-columns:repeat(3,minmax(0,1fr))}
#client-billing-editor.v5-invoice-form header{height:64px;min-height:64px;padding:10px 16px}
#client-billing-editor.v5-invoice-form header h2{font-size:20px}
#client-billing-editor.v5-invoice-form input:not([type=checkbox]),#client-billing-editor.v5-invoice-form select{height:36px;min-height:36px;padding:6px 9px}
#client-billing-editor.v5-invoice-form .iv-dates{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
#client-billing-editor.v5-invoice-form .iv-general-concept{grid-column:1/-1}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle{display:flex;align-items:center;gap:8px;width:max-content;max-width:100%;font-size:13px;font-weight:600;padding-top:4px}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle input[role=switch]{appearance:none;cursor:pointer;width:34px;height:20px;border-radius:12px;background:#a8b7cc;position:relative}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle input[role=switch]::after{content:'';position:absolute;width:14px;height:14px;top:3px;left:3px;background:white;border-radius:50%}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle input[role=switch]:checked{background:#2369ba}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle input[role=switch]:checked::after{left:17px}
#client-billing-editor.v5-invoice-form .iv-register{display:grid;gap:3px;font-size:12px;border-left:3px solid #c79828;padding:0 9px}
#client-billing-editor.v5-invoice-form .iv-register button{justify-self:start;padding:0;min-height:24px;background:none;border:0;color:#245b99;font-size:12px;text-decoration:underline}
#client-billing-editor.v5-invoice-form .iv-register small{font-size:11px}
#client-billing-editor.v5-invoice-form .iv-lines>p:first-of-type{margin:5px 0;font-size:11px}
#client-billing-editor.v5-invoice-form .invoice-line,#client-billing-editor.v5-invoice-form[data-direction=issued] .invoice-line{display:grid;min-width:0;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px;padding:8px}
#client-billing-editor.v5-invoice-form .invoice-line-category,#client-billing-editor.v5-invoice-form [data-line-concept],#client-billing-editor.v5-invoice-form [data-catalog-label]{grid-column:span 3}
#client-billing-editor.v5-invoice-form .invoice-line [data-legacy-amounts]{grid-column:1/-1}
#client-billing-editor.v5-invoice-form .iv-row-total{grid-column:span 3;font-size:15px;padding:5px 0}
#client-billing-editor.v5-invoice-form .invoice-line [data-remove]{grid-column:span 3;justify-self:end;min-height:28px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-retention{margin-top:8px;padding-top:8px;gap:8px}
#client-billing-editor.v5-invoice-form .iv-retention>label:first-child{flex:0 1 330px;min-width:0}
#client-billing-editor.v5-invoice-form .iv-check{width:fit-content;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-bottom{gap:10px}
#client-billing-editor.v5-invoice-form .iv-footer .iv-cancel{background:#eef0f4;color:#445064;border:1px solid #d6dce5}
#client-billing-editor.v5-invoice-form .iv-footer .iv-draft{background:#eaf2ff;color:#2456a0;border:1px solid #b8cff1}
#client-billing-editor.v5-invoice-form .iv-footer button.primary{background:#d9a928;color:#172b4c;border:1px solid #bd8e18}
#client-billing-editor.v5-invoice-form [data-fiscal-issue]{background:#eceef2;color:#737c8b;border:1px solid #d6dce5;cursor:not-allowed}
#client-billing-editor.v5-invoice-form [data-issue-help]{flex-basis:100%;text-align:right}
.invoice-party-editor,.invoice-preferences{width:min(900px,94vw);max-height:90dvh;box-sizing:border-box;overflow:auto;border:1px solid #cad8e9;border-radius:14px;padding:20px;color:#173451;background:#fff;box-shadow:0 18px 50px #142b5140}
.invoice-party-editor .grid{display:block}.party-block{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0;padding:12px;border:1px solid #d6e1ed;border-radius:9px;min-width:0}.party-block legend,.party-block summary{font-weight:700;color:#173451}.party-block label{display:flex;flex-direction:column;gap:5px;font-size:13px;min-width:0}.party-block input,.party-block select,.party-block textarea{width:100%;min-width:0;box-sizing:border-box}.party-extra{grid-column:1/-1}.party-contact:not([open]){display:block}.party-contact>summary{grid-column:1/-1}.party-roles{display:flex;flex-wrap:wrap}.party-roles label{display:flex;flex-direction:row;align-items:center;gap:5px}.party-roles input{width:auto}
.invoice-party-editor [hidden],.invoice-preferences [hidden],#client-billing-editor.v5-invoice-form [hidden]{display:none!important}
.invoice-preferences header{display:flex;align-items:center;justify-content:space-between;gap:12px}.invoice-preferences h2{font-size:20px}.invoice-preferences p{font-size:13px;color:#526681}.preferences-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;border:1px solid #d6e1ed;border-radius:9px;margin:10px 0;padding:12px}.preferences-row label{display:flex;flex-direction:column;gap:4px;font-size:13px;min-width:0}.preferences-row input,.preferences-row select{box-sizing:border-box;min-width:0;width:100%}.preferences-row .preference-check{flex-direction:row;align-items:center}.preference-check input{width:auto}.preferences-row small{grid-column:1/-1}.invoice-preferences footer{margin-top:16px;text-align:right}.bw-register{display:block;font-size:11px;color:#64758a}.invoice-party-editor [role=alert]:not(:empty),.invoice-preferences [role=alert]:not(:empty){background:#fff1f1;color:#9c2831;border:1px solid #e8b6ba;padding:10px;border-radius:8px}
#client-billing-editor.v5-invoice-form .iv-footer button{display:inline-flex;align-items:center;justify-content:center;gap:7px}#client-billing-editor.v5-invoice-form .iv-footer button svg{width:17px;height:17px;flex:none}#client-billing-editor.v5-invoice-form [aria-invalid=true]{border-color:#b42c36;box-shadow:0 0 0 2px #b42c3618}#client-billing-editor.v5-invoice-form .iv-general-concept summary{font-size:12px;color:#536b8d;cursor:pointer}#client-billing-editor.v5-invoice-form .iv-general-concept label{margin-top:7px}
@media(max-width:767px){#client-billing-editor.v5-invoice-form .iv-section{grid-template-columns:repeat(2,minmax(0,1fr))}#client-billing-editor.v5-invoice-form .iv-register{grid-column:1/-1}#client-billing-editor.v5-invoice-form .iv-dates{grid-template-columns:1fr}#client-billing-editor.v5-invoice-form .invoice-line,#client-billing-editor.v5-invoice-form[data-direction=issued] .invoice-line{grid-template-columns:repeat(2,minmax(0,1fr))}#client-billing-editor.v5-invoice-form .invoice-line-category,#client-billing-editor.v5-invoice-form [data-line-concept],#client-billing-editor.v5-invoice-form [data-catalog-label],#client-billing-editor.v5-invoice-form .iv-row-total,#client-billing-editor.v5-invoice-form .invoice-line [data-remove]{grid-column:1/-1}.party-block,.preferences-row{grid-template-columns:repeat(2,minmax(0,1fr))}.invoice-party-editor,.invoice-preferences{padding:12px;width:96vw}.party-roles{display:flex}}

/* Shared fiscal editor and compact register controls. */
#party-form{display:block}#party-form [hidden]{display:none!important}
.party-block .preference-check{flex-direction:row;align-items:center}.party-block .preference-check input{width:auto}
#client-billing-editor.v5-invoice-form .iv-register{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
#client-billing-editor.v5-invoice-form .iv-register>span{font-weight:700}
#client-billing-editor.v5-invoice-form .iv-register label{min-width:170px;flex:1;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-register small{flex-basis:100%}
#client-billing-editor.v5-invoice-form [data-year-notice]{flex-basis:100%;padding:10px;border:1px solid #d2a63b;background:#fff8e6;border-radius:8px}
.invoice-preferences [data-concept-list]{overflow-x:auto}.invoice-preferences [data-concept-list] table{width:100%;font-size:13px}
.invoice-preferences .concept-editor{border-bottom:1px solid #d6e1ed;padding:8px 0}.invoice-preferences .concept-editor summary{cursor:pointer}
.invoice-preferences>.preference-check,.invoice-preferences section>.preference-check{display:flex;align-items:center;gap:8px;margin:12px 0 4px}
.invoice-preferences [aria-invalid=true],#party-form [aria-invalid=true]{border-color:#b42c36}

/* Compact invoice presentation; fiscal controls and stored values are unchanged. */
#client-billing-editor.v5-invoice-form form.grid{gap:8px;padding:10px 14px 0}
#client-billing-editor.v5-invoice-form header{height:auto;min-height:54px;padding:8px 14px}
#client-billing-editor.v5-invoice-form header h2{font-size:19px}
#client-billing-editor.v5-invoice-form header small{margin-top:2px;font-size:11px}
#client-billing-editor.v5-invoice-form .iv-section{padding:9px 11px;gap:7px}
#client-billing-editor.v5-invoice-form .iv-section>h3{font-size:14px;line-height:1.25;letter-spacing:.01em}
#client-billing-editor.v5-invoice-form label{font-size:12px;gap:3px}
#client-billing-editor.v5-invoice-form .iv-party-compact{gap:6px}
#client-billing-editor.v5-invoice-form .iv-party-compact>.party-search-controls{display:flex;align-items:center;gap:5px}
#client-billing-editor.v5-invoice-form .iv-party-compact>.party-search-controls input{flex:1 1 160px;width:auto}
#client-billing-editor.v5-invoice-form .iv-party-compact>.party-search-controls button{flex:0 0 auto;font-size:12px;padding:5px 9px;min-height:34px;white-space:nowrap}
#client-billing-editor.v5-invoice-form .iv-party-compact [data-party-dropdown]{width:32px;padding:0;font-size:20px}
#client-billing-editor.v5-invoice-form .iv-party-compact #ac-party-search-status{padding:0;background:transparent;border-radius:0;font-size:11px}
#client-billing-editor.v5-invoice-form .iv-party-compact #ac-party-search-status:empty{display:none}
#client-billing-editor.v5-invoice-form .iv-party-selected{display:flex;align-items:center;gap:8px 14px;min-width:0;padding:8px 10px;background:#f1f6fc;border:1px solid #d6e1ed;border-radius:8px}
#client-billing-editor.v5-invoice-form .iv-party-selected>div{min-width:0}
#client-billing-editor.v5-invoice-form .iv-party-name{flex:1.2}
#client-billing-editor.v5-invoice-form .iv-party-taxid{flex:0 0 auto}
#client-billing-editor.v5-invoice-form .iv-party-address{flex:1.5}
#client-billing-editor.v5-invoice-form .iv-party-selected small{display:block;font-size:10px;font-weight:500;margin-bottom:2px}
#client-billing-editor.v5-invoice-form .iv-party-selected strong,#client-billing-editor.v5-invoice-form .iv-party-selected span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-party-actions{display:flex;align-items:center;gap:5px;flex:0 0 auto}
#client-billing-editor.v5-invoice-form .iv-party-actions button{font-size:11px;min-height:30px;padding:4px 7px;margin:0}
#client-billing-editor.v5-invoice-form .iv-party-actions [data-party-clear]{font-size:20px;width:28px;padding:0}
#client-billing-editor.v5-invoice-form .iv-register{grid-column:1/-1;display:grid;grid-template-columns:auto minmax(180px,1fr) minmax(135px,1fr) minmax(150px,1fr) auto;align-items:center;gap:5px 9px;padding:6px 9px;background:#fffaf0;border-radius:6px}
#client-billing-editor.v5-invoice-form .iv-register label{min-width:0}
#client-billing-editor.v5-invoice-form .iv-register strong{font-size:12px;overflow-wrap:anywhere}
#client-billing-editor.v5-invoice-form .iv-register small,#client-billing-editor.v5-invoice-form [data-year-notice]{grid-column:1/-1}
#client-billing-editor.v5-invoice-form .iv-register select{height:32px;min-height:32px;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-lines>p{margin:4px 0}
#client-billing-editor.v5-invoice-form .iv-footer{padding:8px 0;gap:6px}
.invoice-preferences{padding:14px 16px}.invoice-preferences h2{font-size:18px;margin:0}.invoice-preferences h3{font-size:14px;margin:12px 0 5px}.invoice-preferences p{margin:5px 0;font-size:12px}
.invoice-preferences .preferences-row{gap:7px;margin:7px 0;padding:8px}.invoice-preferences .preferences-row label{font-size:12px;gap:3px}
.invoice-preferences .preferences-row input,.invoice-preferences .preferences-row select{height:34px;min-height:34px;padding:5px 8px;font-size:13px}
.invoice-preferences .preferences-row input[type=checkbox]{width:16px;height:16px;min-height:0;padding:0}
.invoice-preferences .concept-editor{padding:5px 0}.invoice-preferences footer{margin-top:10px}.invoice-preferences section>small{font-size:11px}
@media(max-width:950px){#client-billing-editor.v5-invoice-form .iv-register{grid-template-columns:repeat(2,minmax(0,1fr))}#client-billing-editor.v5-invoice-form .iv-register>span{grid-column:1/-1}#client-billing-editor.v5-invoice-form .iv-party-selected{flex-wrap:wrap}#client-billing-editor.v5-invoice-form .iv-party-address{flex:1 1 45%}}
@media(max-width:600px){#client-billing-editor.v5-invoice-form .iv-party-compact>.party-search-controls{flex-wrap:wrap}#client-billing-editor.v5-invoice-form .iv-party-compact>.party-search-controls input{flex-basis:calc(100% - 42px)}#client-billing-editor.v5-invoice-form .iv-party-name{flex-basis:60%}#client-billing-editor.v5-invoice-form .iv-party-address{flex-basis:100%}#client-billing-editor.v5-invoice-form .iv-party-actions{margin-left:auto}}

/* Invoice density: scoped to this editor; shared V5 navy/blue/gold palette. */
#client-billing-editor.v5-invoice-form{width:80vw;max-width:1120px;box-sizing:border-box;background:var(--v5-bg)}
@media(min-width:768px) and (max-width:1199px){#client-billing-editor.v5-invoice-form{width:94vw}}
#client-billing-editor.v5-invoice-form header{min-height:52px;padding:6px 12px;margin:0;background:#0b2e59;border-radius:0;border-bottom:3px solid var(--v5-accent)}
#client-billing-editor.v5-invoice-form header h2{color:#fff;font-size:19px}
#client-billing-editor.v5-invoice-form header small,#client-billing-editor.v5-invoice-form header .ui-icon{color:#c8ddff}
#client-billing-editor.v5-invoice-form header button{min-height:30px;padding:4px 10px}
#client-billing-editor.v5-invoice-form>.card>[role=alert]:empty{display:none}
#client-billing-editor.v5-invoice-form>.card>[role=alert]:not(:empty){margin:6px 12px}
#client-billing-editor.v5-invoice-form form.grid{gap:6px;padding:6px 10px 0;min-width:0}
#client-billing-editor.v5-invoice-form .iv-section{padding:7px 9px;gap:5px 9px;border-radius:7px;margin:0}
#client-billing-editor.v5-invoice-form .iv-section>h3{margin:-7px -9px 1px;padding:4px 9px;border-bottom:1px solid var(--iv-border);border-left:3px solid var(--iv-blue);border-radius:6px 6px 0 0;background:#eaf2ff;line-height:18px;font-size:13px;min-height:0}
#client-billing-editor.v5-invoice-form .iv-section>h3 .ui-icon{width:17px;height:17px;flex-basis:17px}
#client-billing-editor.v5-invoice-form label{display:flex;flex-direction:column;align-items:stretch;gap:2px;line-height:16px;font-size:12px;margin:0;padding:0}
#client-billing-editor.v5-invoice-form input:not([type=checkbox]),#client-billing-editor.v5-invoice-form select{height:30px;min-height:30px;font-size:13px;padding:4px 7px;border-radius:5px}
#client-billing-editor.v5-invoice-form button{min-height:30px;padding:4px 9px;font-size:12px;border-radius:5px}
#client-billing-editor.v5-invoice-form button:hover:not(:disabled){transform:none}
#client-billing-editor.v5-invoice-form .search-combobox{margin:0}
#client-billing-editor.v5-invoice-form .search-combobox>input{padding:4px 31px 4px 29px!important}
#client-billing-editor.v5-invoice-form .search-combobox>.combobox-toggle{width:27px;height:28px;min-height:28px!important;padding:4px!important}
#client-billing-editor.v5-invoice-form .search-combobox.ui-search-field:before{top:8px;left:10px;width:11px;height:11px}
#client-billing-editor.v5-invoice-form .search-combobox.ui-search-field:after{top:20px;left:20px}
#client-billing-editor.v5-invoice-form .iv-general{grid-template-columns:repeat(4,minmax(0,1fr))}
#client-billing-editor.v5-invoice-form .iv-register{grid-column:1/-1;grid-template-columns:auto minmax(200px,1fr) minmax(175px,1fr) minmax(150px,1fr) auto;gap:3px 9px;padding:4px 7px}
#client-billing-editor.v5-invoice-form .iv-register label{min-width:0;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:5px;font-size:11px}
#client-billing-editor.v5-invoice-form .iv-register strong{font-size:11px}
#client-billing-editor.v5-invoice-form .iv-register select{height:30px;min-height:30px}
#client-billing-editor.v5-invoice-form .iv-register>small{font-size:10px;line-height:12px}
#client-billing-editor.v5-invoice-form .iv-register>small:empty{display:none}
#client-billing-editor.v5-invoice-form .iv-register button{font-size:11px;min-height:24px}
#client-billing-editor.v5-invoice-form .iv-general-concept,#client-billing-editor.v5-invoice-form .invoice-advanced{grid-column:span 2}
#client-billing-editor.v5-invoice-form .iv-general-concept[open],#client-billing-editor.v5-invoice-form .invoice-advanced:has([data-iv=enabled]:checked){grid-column:1/-1}
#client-billing-editor.v5-invoice-form .iv-general-concept>summary{padding:4px 7px;margin:0;font-size:12px;line-height:20px;border-radius:5px}
#client-billing-editor.v5-invoice-form .iv-general-concept[open]>summary{margin-bottom:4px}
#client-billing-editor.v5-invoice-form .iv-advanced-toggle{min-height:30px;box-sizing:border-box;padding:4px 7px;width:100%;font-size:12px;border:1px solid var(--iv-border);border-radius:5px;background:#edf4ff;display:flex;flex-direction:row;align-items:center}
#client-billing-editor.v5-invoice-form .iv-party-compact{gap:4px}
#client-billing-editor.v5-invoice-form .iv-party-compact>.party-search-controls button{min-height:30px;padding:4px 8px}
#client-billing-editor.v5-invoice-form .iv-party-selected{padding:3px 7px;gap:6px 10px;border-radius:5px}
#client-billing-editor.v5-invoice-form .iv-party-selected small{display:inline;margin-right:5px;font-size:10px}
#client-billing-editor.v5-invoice-form .iv-party-selected strong,#client-billing-editor.v5-invoice-form .iv-party-selected span{display:inline;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-party-selected>div:not(.iv-party-actions){white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#client-billing-editor.v5-invoice-form .iv-party-actions button{min-height:26px;padding:2px 6px}

/* A single scroll surface owns the shared headings and every horizontal row. */
#client-billing-editor.v5-invoice-form .iv-lines{overflow:visible;min-width:0}
#client-billing-editor.v5-invoice-form .iv-lines>p:first-of-type{margin:3px 0;font-size:10px;line-height:14px}
#client-billing-editor.v5-invoice-form .iv-line-scroll{--iv-line-columns:140px minmax(220px,1fr) 90px 58px 72px 60px 60px 106px 82px;overflow-x:auto;min-width:0;border:1px solid var(--iv-border);border-radius:5px}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-line-scroll{--iv-line-columns:130px 90px minmax(220px,1fr) 60px 78px 56px 50px 56px 58px 58px 100px 82px}
#client-billing-editor.v5-invoice-form .iv-line-headings,#client-billing-editor.v5-invoice-form .invoice-line,#client-billing-editor.v5-invoice-form[data-direction=issued] .invoice-line{display:grid;grid-template-columns:var(--iv-line-columns);gap:4px;align-items:center;box-sizing:border-box;min-width:940px;padding:4px 6px;margin:0;border:0;border-bottom:1px solid var(--iv-border);border-radius:0}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-line-headings,#client-billing-editor.v5-invoice-form[data-direction=issued] .invoice-line{min-width:1100px}
#client-billing-editor.v5-invoice-form .iv-line-headings{background:#dbe9fc;color:#0b2e59;font-size:11px;font-weight:800;line-height:16px}
#client-billing-editor.v5-invoice-form .invoice-lines{display:block;gap:0}
#client-billing-editor.v5-invoice-form .invoice-line{position:relative;background:#fff}
#client-billing-editor.v5-invoice-form .invoice-line:nth-child(even){background:#f1f6fc}
#client-billing-editor.v5-invoice-form .invoice-line:last-child{border-bottom:0}
#client-billing-editor.v5-invoice-form .invoice-line legend{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;padding:0;margin:-1px;border:0}
/* Label text stays associated with its control for assistive technology. */
#client-billing-editor.v5-invoice-form .invoice-line label{display:block;font-size:0;line-height:0;grid-column:auto;padding:0;margin:0;min-width:0}
#client-billing-editor.v5-invoice-form .invoice-line label>small{display:none}
#client-billing-editor.v5-invoice-form .invoice-line input,#client-billing-editor.v5-invoice-form .invoice-line select{height:30px;min-height:30px;min-width:0;max-width:100%;font-size:12px;line-height:20px;padding:4px 5px}
#client-billing-editor.v5-invoice-form .invoice-line input[type=number]{font-variant-numeric:tabular-nums}
#client-billing-editor.v5-invoice-form .iv-row-total{grid-column:-3;align-self:center;padding:0;text-align:right;font-size:13px;white-space:nowrap}
#client-billing-editor.v5-invoice-form .invoice-line [data-remove]{grid-column:-2;justify-self:stretch;font-size:11px;min-height:28px;padding:3px;white-space:nowrap}
#client-billing-editor.v5-invoice-form[data-direction=received] [data-column-direction=issued],#client-billing-editor.v5-invoice-form[data-direction=issued] [data-column-direction=received]{display:none}
/* TOTAL adds horizontal columns, preserving the existing manual-amount inputs. */
#client-billing-editor.v5-invoice-form .iv-legacy-headings{display:none}
#client-billing-editor.v5-invoice-form .iv-line-scroll:has([data-legacy-amounts]:not([hidden])){--iv-line-columns:140px minmax(220px,1fr) 90px 58px 72px 60px 60px 240px 106px 82px}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-line-scroll:has([data-legacy-amounts]:not([hidden])){--iv-line-columns:130px 90px minmax(220px,1fr) 60px 78px 56px 50px 56px 58px 58px 240px 100px 82px}
#client-billing-editor.v5-invoice-form .iv-line-scroll:has([data-legacy-amounts]:not([hidden])) :is(.invoice-line,.iv-line-headings){min-width:1184px}
#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-line-scroll:has([data-legacy-amounts]:not([hidden])) :is(.invoice-line,.iv-line-headings){min-width:1344px}
#client-billing-editor.v5-invoice-form .iv-line-scroll:has([data-legacy-amounts]:not([hidden])) .iv-legacy-headings,#client-billing-editor.v5-invoice-form .invoice-line [data-legacy-amounts]:not([hidden]){grid-column:-4;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;padding:0}
#client-billing-editor.v5-invoice-form .iv-line-tools{display:flex;gap:5px;align-items:center;flex-wrap:wrap;margin-top:4px}
#client-billing-editor.v5-invoice-form .iv-line-tools .line-total{margin:0 0 0 auto;font-size:12px}
#client-billing-editor.v5-invoice-form .iv-retention{padding-top:4px;margin-top:4px;gap:6px}
#client-billing-editor.v5-invoice-form .iv-retention>label:first-child{flex:0 1 390px;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:6px}
#client-billing-editor.v5-invoice-form .iv-retention .iv-check{display:flex;flex-direction:row;align-items:center}
#client-billing-editor.v5-invoice-form .iv-bottom{grid-template-columns:1fr 1fr 1fr;gap:6px;min-width:0}
#client-billing-editor.v5-invoice-form .iv-bottom>.iv-section>label{margin-top:4px}
#client-billing-editor.v5-invoice-form .iv-bottom p{margin:4px 0;font-size:12px;line-height:16px}
#client-billing-editor.v5-invoice-form .iv-bottom small{font-size:10px;line-height:14px;display:block}
#client-billing-editor.v5-invoice-form textarea{min-height:36px;height:36px;padding:4px 7px;font-size:13px;resize:vertical}
#client-billing-editor.v5-invoice-form dl{margin:3px 0 0;font-size:12px}
#client-billing-editor.v5-invoice-form dl>div{padding:2px 0;line-height:17px}
#client-billing-editor.v5-invoice-form dl>div:last-child{font-size:17px;margin-top:3px;padding-top:4px}
#client-billing-editor.v5-invoice-form .iv-footer{padding:5px 0;gap:5px;background:#fff;box-shadow:0 -2px 5px #06233f10}
#client-billing-editor.v5-invoice-form .iv-attachment{width:220px;font-size:10px;line-height:12px}
#client-billing-editor.v5-invoice-form .iv-attachment input{font-size:11px;height:28px;min-height:28px;padding:2px}
#client-billing-editor.v5-invoice-form [data-issue-help]{font-size:10px;line-height:12px}
@media(max-width:1100px){
 #client-billing-editor.v5-invoice-form .iv-register{grid-template-columns:auto 1fr 1fr}
 #client-billing-editor.v5-invoice-form .iv-register label{display:flex}
 #client-billing-editor.v5-invoice-form .iv-register>span{grid-column:auto}
}
@media(max-width:767px){
 #client-billing-editor.v5-invoice-form{width:100vw;max-width:100vw}
 #client-billing-editor.v5-invoice-form .iv-general{grid-template-columns:repeat(2,minmax(0,1fr))}
 #client-billing-editor.v5-invoice-form .iv-bottom{grid-template-columns:minmax(0,1fr)}
 #client-billing-editor.v5-invoice-form .iv-register{grid-template-columns:repeat(2,minmax(0,1fr))}
 #client-billing-editor.v5-invoice-form .iv-register>span,#client-billing-editor.v5-invoice-form .iv-register>strong{grid-column:1/-1}
 #client-billing-editor.v5-invoice-form .iv-footer{padding-bottom:calc(5px + env(safe-area-inset-bottom,0px))}
 #client-billing-editor.v5-invoice-form .iv-attachment{width:100%}
 #client-billing-editor.v5-invoice-form .iv-general-concept,#client-billing-editor.v5-invoice-form .invoice-advanced{grid-column:1/-1}
}

/* Visual hierarchy only: use existing V5 colors without adding control height. */
#client-billing-editor.v5-invoice-form .iv-section>h3{background:#dbe9fc;color:#0b2e59;font-weight:800;border-left-color:#d9a928}
#client-billing-editor.v5-invoice-form .iv-section>h3 .ui-icon{color:#0b2e59}
#client-billing-editor.v5-invoice-form .iv-field-key{display:inline-flex;gap:10px;margin-left:auto;font-size:10px;font-weight:600;color:#244e82;white-space:nowrap}
#client-billing-editor.v5-invoice-form .iv-lines>h3{display:flex;align-items:center;gap:6px}
#client-billing-editor.v5-invoice-form .iv-line-headings [data-field-state]::after{margin-left:3px;font-size:10px;color:#244e82}
#client-billing-editor.v5-invoice-form .iv-line-headings [data-field-state=required]::after,#client-billing-editor.v5-invoice-form[data-direction=issued] .iv-line-headings [data-field-state=concept]::after{content:'*'}
#client-billing-editor.v5-invoice-form .iv-line-headings [data-field-state=optional]::after,#client-billing-editor.v5-invoice-form[data-direction=received] .iv-line-headings [data-field-state=concept]::after{content:'○'}
#client-billing-editor.v5-invoice-form .iv-line-headings [data-field-state=automatic]::after{content:'='}
#client-billing-editor.v5-invoice-form .iv-general>label,#client-billing-editor.v5-invoice-form .iv-general-concept label,#client-billing-editor.v5-invoice-form .iv-bottom>.iv-section>label{position:relative}
#client-billing-editor.v5-invoice-form .iv-general>label::after,#client-billing-editor.v5-invoice-form .iv-general-concept label::after,#client-billing-editor.v5-invoice-form .iv-bottom>.iv-section>label::after{content:'Opcional';position:absolute;right:0;top:0;font-size:9px;font-weight:600;line-height:14px;color:#526681;pointer-events:none}
#client-billing-editor.v5-invoice-form .iv-general label:has(:required)::after{content:'Obligatorio';color:#0b2e59;font-weight:800}
#client-billing-editor.v5-invoice-form .iv-general>label:has(input:disabled,select:disabled,input[readonly])::after{content:'Automático';color:#245b99}
#client-billing-editor.v5-invoice-form :is(input:not([type=checkbox]),select,textarea){border-color:#9eB5d2}
#client-billing-editor.v5-invoice-form :is(input:required,select:required,textarea:required){border-left:2px solid #245b99}
#client-billing-editor.v5-invoice-form :is(input[readonly],input:disabled,select:disabled){background:#edf4ff;color:#245b99}
#client-billing-editor.v5-invoice-form .invoice-line select{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}
#client-billing-editor.v5-invoice-form .iv-row-total{color:#0b2e59;font-variant-numeric:tabular-nums}
@media(pointer:fine){
 #client-billing-editor.v5-invoice-form input[type=number]{appearance:textfield;-moz-appearance:textfield}
 #client-billing-editor.v5-invoice-form input[type=number]::-webkit-inner-spin-button,#client-billing-editor.v5-invoice-form input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
}
@media(max-width:767px){#client-billing-editor.v5-invoice-form .iv-lines>h3{flex-wrap:wrap}#client-billing-editor.v5-invoice-form .iv-field-key{flex-wrap:wrap;white-space:normal}}
/* Title and close control remain within the modal, above its scrollable body. */
dialog.invoice-editor[open],#client-billing-editor.v5-invoice-form[open]{display:flex;flex-direction:column;overflow:hidden}
dialog.invoice-editor>.card,#client-billing-editor.v5-invoice-form>.card{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
dialog.invoice-editor>.invoice-editor-header,#client-billing-editor.v5-invoice-form>.invoice-editor-header{position:static;flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:12px}
dialog.invoice-editor>.invoice-editor-header :is([data-close],#ac-editor-close){flex-shrink:0;margin-left:auto}
