/* Scoped to the expense module and its top-level dialogs. */
.hce,.hce-overlay{font-family:inherit;color:#302b25;font-size:14px;line-height:1.5;box-sizing:border-box}.hce *,.hce-overlay *{box-sizing:border-box}.hce{padding:20px;background:#faf8f4;border:1px solid #eadfce;border-radius:18px}.hce h2,.hce h3,.hce-overlay h2,.hce-overlay h3{font-family:inherit;margin:0;font-weight:700;color:#372d22}.hce-header,.hce-toolbar,.hce-tabs,.hce-actions,.hce-dialog-head,.hce-dialog-foot{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.hce-header{justify-content:space-between;margin-bottom:18px}.hce-subtle{color:#000;font-size:13px}.hce-tabs{border-bottom:1px solid #e4d8c8;margin:16px 0}.hce-tabs button{border-radius:8px 8px 0 0;border-bottom:3px solid transparent}.hce-tabs button[aria-selected=true]{border-bottom-color:#aa793b;background:#f3e8d7;color:#714b21}.hce button,.hce-overlay button{font:inherit;cursor:pointer;border:1px solid #dbc5a8;border-radius:8px;background:#fff;padding:9px 14px;color:#514231;line-height:1.4}.hce button:hover,.hce-overlay button:hover{background:#f5ead9}.hce button:disabled,.hce-overlay button:disabled{opacity:.55;cursor:not-allowed}.hce .hce-primary,.hce-overlay .hce-primary{background:#a9783b;color:#fff;border-color:#a9783b}.hce .hce-danger,.hce-overlay .hce-danger{color:#b42318;background:#fff4f2}.hce label,.hce-overlay label{display:flex;flex-direction:column;gap:6px;min-width:0;font-weight:600;color:#6b5c4a}.hce input,.hce select,.hce textarea,.hce-overlay input,.hce-overlay select,.hce-overlay textarea{font:inherit;width:100%;min-width:0;height:42px;padding:9px 11px;border:1px solid #d9c8b1;border-radius:8px;background:#fff;color:#302b25;box-shadow:none}.hce textarea,.hce-overlay textarea{height:auto;min-height:70px;resize:vertical}.hce input[type=checkbox],.hce-overlay input[type=checkbox]{width:18px;height:18px}.hce input:focus,.hce select:focus,.hce-overlay input:focus,.hce-overlay select:focus,.hce-overlay textarea:focus{outline:2px solid #b88949;outline-offset:2px}.hce-filters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:16px 0}.hce-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:18px 0}.hce-kpi{background:#fff;border:1px solid #e7dac8;border-radius:12px;padding:16px}.hce-kpi strong{display:block;font-size:23px;margin-top:5px}.hce-table-wrap{overflow:auto;border:1px solid #e5dbcd;border-radius:10px;background:#fff}.hce table,.hce-overlay table{width:100%;border-collapse:collapse;font-size:13px}.hce th,.hce td,.hce-overlay th,.hce-overlay td{text-align:left;padding:12px 10px;border-bottom:1px solid #eee5da;vertical-align:top}.hce th,.hce-overlay th{background:#f3eee6;color:#665844;font-size:12px;white-space:nowrap}.hce .hce-money,.hce-overlay .hce-money{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.hce-empty{text-align:center!important;padding:32px!important;color:#000}.hce-chip{display:inline-block;border-radius:6px;padding:3px 8px;font-size:12px;background:#eeebe6;color:#000;white-space:nowrap}.hce-chip-approved{background:#e5f3e9;color:#22653b}.hce-chip-submitted{background:#fff0cf;color:#865d14}.hce-chip-returned,.hce-chip-cancelled{background:#fce8e5;color:#a03b30}.hce-notice{padding:12px 14px;border-radius:8px;background:#fff4da;color:#715325;margin:12px 0}.hce-error{padding:12px 14px;border-radius:8px;background:#feecea;color:#a5261e;white-space:pre-wrap;margin:12px 0}.hce-overlay{position:fixed!important;inset:0!important;z-index:2147483000!important;background:rgba(24,20,16,.48);display:flex!important;align-items:center!important;justify-content:center!important;padding:22px;isolation:isolate}.hce-dialog{position:relative!important;margin:0!important;inset:auto!important;transform:none!important;background:#fffdf9;border:1px solid #d8bf9c;border-top:4px solid #ac7c40;border-radius:18px;width:min(1200px,100%);max-height:calc(100dvh - 44px);display:flex;flex-direction:column;overflow:hidden;box-shadow:0 18px 70px #0004}.hce-dialog.hce-small{width:min(540px,100%)}.hce-dialog-head{padding:18px 22px;justify-content:space-between;border-bottom:1px solid #e7dac8;flex:none}.hce-dialog-head h2{font-size:21px}.hce-dialog-body{padding:20px 22px;overflow:auto;min-height:0;overscroll-behavior:contain}.hce-dialog-foot{padding:14px 22px;justify-content:flex-end;border-top:1px solid #e7dac8;background:#f7f1e7;flex:none}.hce-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.hce-span2{grid-column:span 2}.hce-span4{grid-column:1/-1}.hce-section{padding:18px;border:1px solid #e5d4bf;border-radius:12px;margin-bottom:16px;background:#fff}.hce-section h3{font-size:16px;margin:0 0 15px}.hce-line{border:1px solid #e5d4bf;border-radius:10px;padding:15px;margin-bottom:14px;background:#fffdf9}.hce-line-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.hce-allocation{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:8px;margin:8px 0;align-items:end}.hce-total{padding:12px;text-align:right;font-weight:700;color:#65431f;background:#f7eddd;border-radius:8px}.hce-value{overflow-wrap:anywhere;color:#302b25;font-weight:500;min-height:24px}.hce-history{list-style:none;margin:0;padding:0}.hce-history li{border-left:2px solid #ddc7a9;padding:4px 12px 15px;margin-left:6px}.hce-inline-check{display:flex!important;flex-direction:row!important;align-items:center;gap:8px}.hce-file{display:flex;gap:10px;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid #eee5da}.hce-catalogs{display:grid;grid-template-columns:1fr 1fr;gap:18px}.hce-link{border:0!important;padding:0!important;color:#875d2a!important;background:transparent!important;text-decoration:underline;text-align:left}.hce-loading{padding:30px;text-align:center;color:#76644f}.hce-alloc-hint{font-size:12px;margin:6px 0;color:#73552f}.hce table td small{display:block;color:#000}.hce-overlay [hidden],.hce [hidden]{display:none!important}@media(max-width:1050px){.hce-grid,.hce-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.hce-span4{grid-column:1/-1}.hce-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:600px){.hce{padding:12px}.hce-grid,.hce-filters,.hce-kpis,.hce-catalogs{grid-template-columns:1fr}.hce-span2,.hce-span4{grid-column:auto}.hce-overlay{padding:10px}.hce-dialog{max-height:calc(100dvh - 20px);border-radius:12px}.hce-dialog-head,.hce-dialog-body,.hce-dialog-foot{padding:14px}.hce-dialog-head h2{font-size:18px}.hce-allocation{grid-template-columns:1fr 1fr}.hce-allocation label:first-child{grid-column:1/-1}.hce-dialog-foot button{flex:1}.hce-header{align-items:flex-start}.hce-kpi strong{font-size:21px}}
.hce button.hce-primary:hover,.hce-overlay button.hce-primary:hover{background:#8d612d;color:#fff;border-color:#8d612d}.hce button.hce-primary:focus-visible,.hce-overlay button.hce-primary:focus-visible{outline:3px solid #dcb888;outline-offset:2px}.hce-dialog-open>.vi-month-picker-panel{z-index:2147483500!important}.hce-overlay .vi-month-picker{width:100%;min-width:0}.hce-overlay .vi-month-picker-button{height:42px;font:inherit}.hce-snapshot-title{padding:12px 15px;background:#edf5f2;color:#285b46;border-radius:8px;margin-bottom:16px}.hce-review-lists{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:16px 0}@media(max-width:600px){.hce-review-lists{grid-template-columns:1fr}}

/* Dense expense workspace, matching the payroll page without changing its styles. */
body.hc-module-expenses .hc-page{width:100%;max-width:none;margin:0;padding:8px 10px 10px;gap:6px}
body.hc-module-expenses .hc-main-topbar{margin-bottom:0;gap:10px;align-items:center}
body.hc-module-expenses .hc-topbar-title small{font-size:9.5px;margin-bottom:0;letter-spacing:.6px}
body.hc-module-expenses .hc-topbar-title h1{font-size:19px;margin-bottom:0;line-height:1.1}
body.hc-module-expenses .hc-topbar-title p{display:none}
body.hc-module-expenses .hc-topbar-btn{padding:6px 12px;font-size:12px}
.hce{padding:10px 12px;border-radius:12px;font-size:13px}
.hce-header{gap:8px;margin-bottom:6px;justify-content:flex-start}
.hce-header>.hce-actions{margin-left:auto}
.hce-tabs{margin:0;border:0;gap:5px}
.hce button{padding:5px 9px;font-size:12px;border-radius:6px}
.hce-filters{display:flex;flex-wrap:wrap;align-items:flex-end;gap:6px 8px;margin:6px 0}
.hce-filters>label{flex:0 1 125px;gap:3px;font-size:11px}
.hce-filters>label:nth-child(2),.hce-filters>label:nth-child(5),.hce-filters>label:nth-child(6){flex-basis:160px}
.hce-filters>label:nth-child(7){flex:1 1 190px;max-width:340px}
.hce-filters input,.hce-filters select,.hce-filters .vi-month-picker-button{height:32px;padding:5px 8px;font-size:12px;border-radius:6px}
.hce-filters .vi-month-picker{width:100%;min-width:0}
.hce-kpis{display:flex;flex-wrap:wrap;gap:5px 16px;margin:8px 0 3px}
.hce-kpi{display:flex;align-items:baseline;gap:8px;background:transparent;border:0;border-radius:0;padding:0}
.hce-kpi strong{font-size:15px;margin:0;white-space:nowrap}
.hce-kpi .hce-subtle,.hce-kpis+p.hce-subtle{font-size:11px}
.hce-kpis+p.hce-subtle{margin:3px 0 6px}
.hce th,.hce td{padding:5px 7px;line-height:1.3;border-right:1px solid #eee5da;vertical-align:middle}
.hce th{font-size:11px}
.hce table{font-size:12px}
.hce-ledger{max-height:calc(100dvh - 235px);overscroll-behavior:contain;isolation:isolate}
.hce-ledger table{table-layout:auto;width:max-content;min-width:100%;border-collapse:separate;border-spacing:0}
.hce-ledger th,.hce-ledger td{width:auto;max-width:none;white-space:nowrap;padding:5px 7px}
.hce-ledger th{position:sticky;top:0;z-index:2;border-bottom:1px solid #d7c6ad}
.hce-ledger td{background:#fff;vertical-align:top}
.hce-ledger .hce-ledger-text{white-space:normal;min-width:95px;max-width:200px;overflow-wrap:anywhere}
.hce-ledger .hce-ledger-code{position:sticky;left:0;z-index:1;min-width:175px;max-width:235px;white-space:normal;overflow-wrap:anywhere;border-right:2px solid #d7c6ad;background:#fffdf8}
.hce-ledger th.hce-ledger-code{z-index:3;background:#f3eee6}
.hce-ledger .hce-ledger-index{min-width:34px;text-align:center}
.hce-ledger .hce-voucher-start td{border-top:1px solid #d7c6ad}
.hce-ledger td.hce-money{vertical-align:top}
.hce-chip{font-size:11px;padding:1px 5px}
.hce-empty{padding:16px!important}
@media(max-width:600px){.hce{padding:8px}.hce-filters>label,.hce-filters>label:nth-child(n){flex:1 1 calc(50% - 8px);max-width:none}.hce-header>.hce-actions{margin-left:0}.hce-ledger table{min-width:820px}.hce-kpi{flex-wrap:wrap;gap:3px 6px}}

.hce-chip-recorded{background:#e5f3e9;color:#22653b}

.hce-overlay output{display:block;min-height:42px;padding:9px 11px;background:#f5f1ea;border:1px solid #d9c8b1;border-radius:8px;color:#302b25;font-variant-numeric:tabular-nums}

/* Consistent centered alignment across the ledger, tabs and editing dialogs. */
.hce th,.hce td,.hce-overlay th,.hce-overlay td,.hce .hce-money,.hce-overlay .hce-money,.hce .hce-link{ text-align:center;vertical-align:middle }
.hce-ledger td,.hce-ledger td.hce-money{vertical-align:middle}
.hce label,.hce-overlay label,.hce input,.hce select,.hce textarea,.hce-overlay input,.hce-overlay select,.hce-overlay textarea,.hce-overlay output,.hce-total,.hce-value,.hce-section h3,.hce-alloc-hint{text-align:center}
.hce select,.hce-overlay select{text-align-last:center}
.hce input[data-hce-number],.hce-overlay input[data-hce-number]{font-variant-numeric:tabular-nums}
.hce-tabs{justify-content:flex-start}
.hce-header>.hce-tabs{flex:0 1 auto}
.hce-tabs button{text-align:center;min-width:94px;padding:7px 13px;font-weight:600;border-color:#c5a274;color:#714b21}
.hce-tabs button[aria-selected=true]{background:#a9783b;color:#fff;border-color:#a9783b;font-weight:700;box-shadow:0 2px 5px #7d552326}
.hce-tabs button[aria-selected=true]:hover{background:#92642f;border-color:#92642f}
.hce-tabs button:focus-visible{outline:2px solid #92642f;outline-offset:2px}
.hce-table-wrap tbody tr:hover td{background:#faf5ec}
.hce-table-wrap th{vertical-align:middle}
.hce-overlay .hce-table-wrap td{padding:8px 10px;border-right:1px solid #eee5da}
.hce-row-actions{display:flex;flex-direction:column;align-items:stretch;gap:4px;min-width:86px}
.hce-row-actions button{width:100%;white-space:nowrap}
.hce-catalog-workspace{align-items:start;gap:14px}
.hce-catalog-panel{padding:16px;margin-bottom:0;min-width:0;border-top:3px solid #bd9059}
.hce-catalog-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:12px}
.hce-catalog-heading h3{margin:0;text-align:left;font-size:16px}
.hce-catalog-heading p{margin:4px 0 0;font-size:12px}
.hce-catalog-count{display:inline-block;padding:1px 8px;border-radius:12px;background:#f3e8d7;color:#805521;font-size:12px;vertical-align:middle}
.hce-catalog-filters{display:grid;grid-template-columns:minmax(0,1fr) 130px;gap:8px;background:#faf7f1;padding:10px;border-radius:8px}
.hce-catalog-filters label{font-size:11px;gap:4px}
.hce-catalog-filters input,.hce-catalog-filters select{height:34px;font-size:12px;padding:6px 8px}
.hce-catalog-summary{font-size:11px;color:#786b59;margin:9px 0}
.hce-catalog-panel .hce-catalog-name{font-weight:600;white-space:normal;overflow-wrap:anywhere}
.hce-catalog-panel th:last-child{width:75px}
.hce-catalog-panel td{padding:8px}
.hce-catalog-empty{padding:28px 14px;text-align:center;border:1px dashed #dbc5a8;border-radius:10px;background:#fffdf9}
.hce-catalog-empty strong{font-size:14px;color:#685138}
.hce-catalog-empty p{font-size:12px;color:#837565;margin:6px 0 12px}
@media(max-width:850px){.hce-catalog-workspace{grid-template-columns:1fr}}
.hce-supplier-fields{grid-template-columns:1fr 1fr;gap:14px;margin-top:14px}
.hce-supplier-fields .hce-value{white-space:pre-wrap;overflow-wrap:anywhere;padding:9px;border-radius:8px;background:#f8f3eb}
@media(max-width:600px){.hce-supplier-fields{grid-template-columns:1fr}}

.hce-requester-picker{display:flex;flex-direction:column;gap:6px;min-width:0}
.hce-requester-picker .hce-subtle:empty{display:none}

/* Full monthly expense ledger with grouped allocation columns. */
.hce-ledger-full{max-height:calc(100dvh - 275px)}
.hce-ledger-full thead{position:sticky;top:0;z-index:4}
.hce-ledger-full thead th,.hce-ledger-sticky thead th{position:static;white-space:normal;min-width:90px;max-width:200px;padding:8px 7px;border:1px solid #d7c6ad;background:#f1e5d2}
.hce-ledger-full thead th[colspan],.hce-ledger-sticky thead th[colspan]{background:#dfc8a6;color:#513819;font-size:12px;letter-spacing:.2px}
.hce-ledger-full thead th small,.hce-ledger-sticky thead th small{display:block;font-size:10px;font-weight:400;margin-top:3px}
.hce-ledger-full td{border-right:1px solid #e5dbcd}
.hce-ledger-full .hce-ledger-index{position:sticky;left:0;z-index:2;min-width:40px;width:40px;background:#f9f3e9}
.hce-ledger-full thead .hce-ledger-index{position:sticky;left:0;z-index:5;min-width:40px}
.hce-ledger-full .hce-ledger-content{min-width:180px;max-width:250px}
.hce-ledger-full .hce-allocation-cell{min-width:105px;background:#fffcf5}
.hce-ledger-full tfoot{position:sticky;bottom:0;z-index:3}
.hce-ledger-full tfoot th,.hce-ledger-full tfoot td{position:static;background:#ead7b9;border-top:2px solid #ad844b;font-weight:700;padding:9px 7px;white-space:nowrap}
@media(max-width:600px){.hce-ledger-full{max-height:65dvh}}

/* Expense editor: grouped rows, aligned requester controls, optional details. */
.hce-expense-editor .hce-section{padding:14px 16px;margin-bottom:12px;border-radius:10px}
.hce-expense-editor .hce-section h3{font-size:14px;text-align:left;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #eee5da}
.hce-expense-editor .hce-grid{gap:12px;align-items:start}
.hce-expense-editor label{font-size:12px;text-align:left;gap:5px}
.hce-expense-editor input,.hce-expense-editor select{height:38px;padding:7px 9px;font-size:13px}
.hce-expense-editor textarea{font-size:13px;min-height:60px;padding:7px 9px}
.hce-expense-editor .hce-requester-picker{grid-column:span 2;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 12px}
.hce-expense-editor .hce-requester-picker [data-requester-results]{grid-column:1/-1;font-size:11px}
.hce-extra-fields summary{cursor:pointer;text-align:left;font-size:13px;font-weight:600;color:#6b5c4a}
.hce-extra-fields[open] summary{margin-bottom:12px}
.hce-extra-fields summary:focus-visible{outline:2px solid #b88949;outline-offset:3px}
@media(max-width:600px){.hce-expense-editor .hce-section{padding:12px}.hce-expense-editor .hce-requester-picker{grid-column:auto;grid-template-columns:1fr}.hce-expense-editor .hce-grid{gap:10px}}
.hce-expense-editor .hce-grid-three{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:1050px){.hce-expense-editor .hce-grid-three{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.hce-expense-editor .hce-grid-three{grid-template-columns:1fr}}

.hce-expense-editor [data-subcategory-field]{min-width:0}
.hce-overlay td small{display:block}

.hce-expense-editor .hce-requester-picker{position:relative;display:block;min-width:0}.hce-combobox{position:relative}.hce-combobox input{padding-right:28px!important}.hce-combobox>span{position:absolute;right:10px;top:8px;pointer-events:none}.hce-requester-options{position:absolute;left:0;right:0;top:60px;z-index:20;max-height:200px;overflow:auto;background:#fff;border:1px solid #d9c8b1;border-radius:8px;box-shadow:0 5px 14px #302b2526}.hce-requester-options button{display:block;width:100%;text-align:left;border:0;border-radius:0;padding:9px 12px}.hce-requester-options button[aria-selected=true]{background:#f3e8d7}.hce-requester-options small{display:block;color:#000}.hce-requester-empty{padding:12px;font-size:13px}

.hce-line-supplier{margin-top:14px;padding-top:12px;border-top:1px solid #e5d4bf}.hce-line-supplier>.hce-grid{margin-top:8px}

.hce-category-group{border:1px solid #e5d4bf;border-radius:10px;margin:8px 0;overflow:hidden}.hce-category-group summary{cursor:pointer;padding:13px;background:#f7f2e9;text-align:left}.hce-category-group summary strong{margin-right:12px}.hce-category-group summary .hce-chip{margin-left:10px}.hce-category-body{padding:12px}.hce-category-tools{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}.hce-category-children{list-style:none;padding:0;margin:0}.hce-category-children li{display:flex;align-items:center;justify-content:space-between;gap:10px;border-top:1px solid #eee5da;padding:9px 0;text-align:left}.hce-category-children li span{overflow-wrap:anywhere;min-width:0}.hce-category-children button{flex-shrink:0}@media(max-width:600px){.hce-category-group summary .hce-chip{margin-left:0}.hce-category-group summary strong{display:block}}

.hce .hce-ledger .hce-vat-amount{display:block;font-size:1em;font-weight:600;color:#302b25;margin-top:3px}.hce-add-line-panel{padding:20px;margin:20px 0;border:1px dashed #b88949;border-radius:10px;background:#fcf8f1;text-align:center}.hce-add-line-panel button{min-height:44px}.hce-line-summaries{border:1px solid #e5d4bf;border-radius:10px;padding:14px;background:#f7eddd}.hce-line-summaries h4{margin:0 0 8px;text-align:left;font-size:14px}.hce-line-summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0;border-top:1px solid #e5d4bf;text-align:left}.hce-line-summary span{min-width:0}.hce-line-summary small{display:block;overflow-wrap:anywhere;color:#6b5c4a}.hce-line-summary>strong{text-align:right;flex-shrink:0}@media(max-width:600px){.hce-add-line-panel{padding:16px 10px}.hce-add-line-panel button{width:100%}.hce-line-summary{align-items:flex-start;gap:8px;font-size:13px}}

.hce-beneficiary-top{border-top:1px solid #eee5da;padding-top:12px}.hce-beneficiary-top h4{margin:0 0 10px;font-size:13px;text-align:left}

.hce-related-department{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end;margin:8px 0}.hce-line-supplier>.hce-grid{grid-template-columns:repeat(3,minmax(0,1fr))}@media(max-width:600px){.hce-line-supplier>.hce-grid{grid-template-columns:1fr}}

.hce-child-actions{display:flex;gap:6px;flex-shrink:0;align-items:center}@media(max-width:600px){.hce-category-children li{flex-wrap:wrap}.hce-child-actions{margin-left:auto}}

/* Soft brand tones distinguish entry areas while keeping fields high contrast. */
.hce-expense-editor .hce-entry-general{background:#f8f0e2;border-color:#d8bd91;border-top:3px solid #ac7b3b}
.hce-expense-editor .hce-beneficiary-top{background:#f1e6d5;border-radius:9px;border:1px solid #dfcdb2;padding:12px}
.hce-expense-editor .hce-entry-items{background:#fcfaf5;border-color:#deceb6}
.hce-expense-editor .hce-line{background:#f7f1e5;border-color:#d9c5a5;border-top:3px solid #b58d56}
.hce-expense-editor .hce-line-header{color:#594125;border-bottom:1px solid #dfcdb2;padding-bottom:10px;margin-bottom:14px}
.hce-expense-editor .hce-line-supplier{background:#f2e7df;border:1px solid #ddc7b8;border-left:3px solid #ad8064;border-radius:9px;padding:14px}
.hce-expense-editor .hce-line-departments{margin-top:14px;background:#eef0e4;border:1px solid #cfd4b9;border-left:3px solid #555;border-radius:9px;padding:14px}
.hce-expense-editor .hce-extra-fields{background:#f0ece6;border-color:#d8cec0}
.hce-expense-editor .hce-total,.hce-expense-editor .hce-line-summaries{background:#ebd9b9;color:#503a21;border:1px solid #d0af7c}
.hce-expense-editor label,.hce-expense-editor h3,.hce-expense-editor h4,.hce-expense-editor summary{color:#594b39}
.hce-expense-editor input,.hce-expense-editor select,.hce-expense-editor textarea{background:#fffefa;color:#302b25;border-color:#cbb99d}
.hce-expense-editor input:focus,.hce-expense-editor select:focus,.hce-expense-editor textarea:focus{outline:2px solid #a97735;outline-offset:2px;border-color:#a97735}
.hce .hce-ledger .hce-allocation-cell{text-align:center;min-width:105px}
.hce .hce-ledger .hce-department-mark{display:inline-block;color:#bc2924;font-size:20px;font-weight:800;line-height:1.3}
@media(max-width:600px){.hce-expense-editor .hce-line-supplier,.hce-expense-editor .hce-line-departments{padding:11px}}
.hce-expense-editor .hce-actual-paid{font-weight:700;color:#503a21}.hce-expense-editor .hce-actual-paid input{font-weight:700;border-color:#b58d56;background:#fffaf0}.hce-ledger-full td[data-line-total]{font-weight:700}
.hce-expense-editor .hce-vat-invoice{grid-column:span 3;min-width:0}
.hce-expense-editor .hce-grid-invoice{grid-template-columns:repeat(2,minmax(0,1fr))}
.hce-invoice-reference{display:block;white-space:normal;overflow-wrap:anywhere;font-size:12px;color:#79694f}
@media(max-width:1050px){.hce-expense-editor .hce-vat-invoice{grid-column:1/-1}}
@media(max-width:480px){.hce-expense-editor .hce-grid-invoice{grid-template-columns:1fr}}
.hce .hce-ledger-full .hce-allocation-cell,.hce .hce-ledger-full thead th.hce-allocation-head,.hce .hce-ledger-sticky thead th.hce-allocation-head{min-width:58px;width:62px;max-width:78px;padding-left:4px;padding-right:4px}.hce-ledger-full [data-customer-recipient]{max-width:140px}
.hce .hce-ledger-full{max-height:none;overscroll-behavior:auto;scrollbar-width:none}.hce .hce-ledger-full::-webkit-scrollbar{display:none}.hce-ledger-hscroll{position:sticky;bottom:0;z-index:6;height:14px;margin-top:4px;overflow-x:auto;overflow-y:hidden;background:#f1e5d2;border:1px solid #e5dbcd;border-radius:7px;scrollbar-width:thin;scrollbar-color:#b88949 #f1e5d2}.hce-ledger-hscroll>div{height:1px}.hce-ledger-hscroll::-webkit-scrollbar{height:12px}.hce-ledger-hscroll::-webkit-scrollbar-track{background:#f1e5d2;border-radius:7px}.hce-ledger-hscroll::-webkit-scrollbar-thumb{background:#b88949;border-radius:7px}
.hce-ledger .hce-ledger-status{display:block;margin-top:4px}.hce .hce-ledger td.hce-not-counted{color:#a39585;font-style:italic}
.hce .hce-ledger-full .hce-ledger-narrow{min-width:44px;width:1%;white-space:nowrap;padding-left:6px;padding-right:6px}
.hce .hce-ledger td.hce-allocation-filled{background:#dcebd2;color:#24511a;font-weight:700;box-shadow:inset 0 0 0 1px #b9d4a8}.hce .hce-ledger td.hce-allocation-filled.hce-not-counted{background:#eef3ea;color:#000;font-weight:600}
.hce-dntt-table table{min-width:760px}.hce-dntt-table td{padding:4px}.hce-dntt-table input{width:100%;min-width:64px;padding:6px 7px}.hce-dntt-table td:nth-child(4) input{min-width:180px}.hce-dntt-words{margin:10px 0;font-style:italic;font-weight:600;color:#1f3a78;text-align:center}.hce-dntt-method{display:flex;flex-wrap:wrap;gap:10px 22px;align-items:center;justify-content:center;margin:8px 0 12px}.hce-dntt-preview{background:#fff;border:1px solid #e5dbcd;border-radius:10px;padding:14px;overflow:auto}
.hce-overlay .hce-dntt-method label{display:inline-flex;align-items:center;gap:8px;white-space:nowrap;margin:0;font-weight:600;cursor:pointer}.hce-overlay .hce-dntt-method input[type=radio]{width:18px;height:18px;min-height:0;min-width:0;padding:0;margin:0;flex:0 0 auto;accent-color:#b88949;box-shadow:none}
.hce .hce-ledger-full .hce-ledger-select{min-width:38px;width:38px;padding:4px}.hce .hce-ledger-select input{width:17px;height:17px;min-height:0;margin:0;accent-color:#b88949;cursor:pointer}.hce-selection-bar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:6px 0 12px;padding:10px 14px;background:#fff6e6;border:1px solid #e3c894;border-radius:10px}.hce-selection-bar strong{margin-right:6px;color:#5a3c14}.hce-selection-bar button[disabled]{opacity:.55;cursor:not-allowed}
.hce-selection-bar[hidden]{display:none}
.hce-dntu-heading{margin:14px 0 8px;text-align:center;color:#5a3c14}.hce-dntu-table table{min-width:820px}.hce-dntu-table td:nth-child(2) input{min-width:200px}.hce-dntu-table textarea{width:100%;min-width:180px;min-height:56px;padding:6px 8px;resize:vertical}.hce-dntu-docs{display:block;margin-top:10px}.hce-dntu-docs textarea{width:100%;margin-top:6px}
.hce-dntu-docs{display:block;margin-top:12px}.hce-dntu-docs>strong{display:block;margin-bottom:8px;text-align:center;color:#5a3c14}.hce-dntu-doc{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin-bottom:8px}.hce-dntu-doc input{width:100%}.hce-overlay .hce-dntu-doc button{min-width:42px;padding:0 10px;font-size:18px}.hce-overlay .hce-dntu-add-doc{display:inline-flex;align-items:center;gap:10px;padding:8px 14px 8px 8px;border:1px dashed #b88949;background:#fcf8f1;color:#5a3c14;font-weight:600}.hce-dntu-plus{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border:1.5px solid #b88949;border-radius:5px;font-size:18px;line-height:1;color:#8d612d;background:#fff}
.hce .hce-ledger-full td{padding:3px 6px;line-height:1.3}.hce .hce-ledger-full td small{line-height:1.25;margin-top:1px}.hce .hce-ledger-full .hce-ledger-status{margin-top:2px}.hce .hce-ledger-full .hce-row-actions{gap:2px;min-width:72px}.hce .hce-ledger-full .hce-row-actions button{padding:2px 8px;font-size:12px;line-height:1.3;border-radius:6px}
.hce-ledger-sticky{position:sticky;top:0;z-index:8;height:0}.hce-ledger-sticky-view{position:absolute;top:0;overflow:hidden;visibility:hidden;box-shadow:0 3px 8px rgba(80,55,20,.18);border-radius:0 0 6px 6px}.hce-ledger-sticky.is-pinned .hce-ledger-sticky-view{visibility:visible}.hce-ledger-sticky table{table-layout:fixed;border-collapse:separate;border-spacing:0}.hce .hce-ledger-sticky thead th{min-width:0;max-width:none}.hce .hce-ledger-sticky .hce-ledger-index{position:sticky;left:0;z-index:2}.hce .hce-ledger-sticky .hce-ledger-select input{width:17px;height:17px;margin:0;accent-color:#b88949}
.hce .hce-ledger-full tr.hce-ledger-sizer td{height:0;padding:0!important;border:0!important;background:transparent!important;line-height:0}
.hce-history table{min-width:1100px}.hce-history td small{display:block;color:#000}.hce .hce-history .hce-history-text{white-space:normal;min-width:160px;max-width:260px;text-align:left}
.hce .hce-history td{padding:4px 7px;line-height:1.3}.hce .hce-history .hce-row-actions{gap:2px;min-width:72px}.hce .hce-history .hce-row-actions button{padding:2px 8px;font-size:12px;line-height:1.3;border-radius:6px}
.hce-pay-state{display:flex;flex-wrap:wrap;gap:10px 26px;align-items:center;padding:2px 2px 4px}.hce-pay-state[hidden]{display:none}.hce-pay-state label{display:inline-flex;align-items:center;gap:8px;margin:0;font-weight:700;cursor:pointer}.hce-pay-state input{width:18px;height:18px;min-height:0;margin:0}.hce-pay-unpaid{color:#bc2924}.hce-pay-unpaid input{accent-color:#bc2924}.hce-pay-paid{color:#1f7a34}.hce-pay-paid input{accent-color:#1f7a34}
.hce .hce-pay-label{display:block;margin-top:3px;font-size:11.5px;font-weight:700;line-height:1.25}.hce .hce-pay-label-paid,.hce-overlay .hce-pay-label-paid{color:#1f7a34}.hce .hce-pay-label-unpaid,.hce-overlay .hce-pay-label-unpaid{color:#bc2924}.hce .hce-pay-label-partial,.hce-overlay .hce-pay-label-partial{color:#9a6500}
.hce-overlay .hce-pay-state label.hce-pay-unpaid{color:#bc2924}.hce-overlay .hce-pay-state label.hce-pay-paid{color:#1f7a34}
.hce-fund-flag{display:flex;flex-wrap:wrap;align-items:center;gap:6px 16px;padding:8px 12px;border:1px dashed #c9a878;border-radius:9px;background:#fffaf0}.hce-fund-flag label{margin:0;font-weight:700;color:#5a3c14}.hce-fund-flag input{width:18px;height:18px;min-height:0;margin:0;accent-color:#b88949}.hce-fund-warning{color:#bc2924;font-weight:600}
.hce .hce-fund-tag{display:inline-block;margin-top:3px;padding:1px 7px;border-radius:999px;background:#fff1d6;border:1px solid #e3c894;color:#7a5116;font-size:11px;font-weight:700}
.hce-fund-head{display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px;align-items:flex-start}.hce-fund-head h3{margin:0 0 4px}.hce-fund-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:12px}.hce-fund-kpis>div{padding:10px 12px;border:1px solid #e5d4bf;border-radius:10px;background:#fff}.hce-fund-kpis span{display:block;font-size:12px;color:#000}.hce-fund-kpis strong{font-size:20px;color:#302b25}.hce-fund-kpis .is-negative strong,.hce .hce-negative{color:#bc2924}.hce-fund-bar{height:8px;margin-top:10px;border-radius:999px;background:#efe4d3;overflow:hidden}.hce-fund-bar span{display:block;height:100%;background:linear-gradient(90deg,#b88949,#8d612d)}.hce-fund-empty{text-align:center}.hce-fund-table table{min-width:980px}.hce-fund-paid{display:inline-flex;align-items:center;gap:6px;margin:0;font-weight:700;color:#bc2924}.hce-fund-paid.is-paid{color:#1f7a34}.hce-fund-paid input{width:17px;height:17px;min-height:0;margin:0}.hce-fund-table td input[type=checkbox]{width:17px;height:17px;min-height:0;margin:0;accent-color:#b88949}@media(max-width:700px){.hce-fund-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
.hce .hce-fund-head h3{text-align:left;margin:0 0 4px}.hce .hce-fund-head .hce-subtle{margin:0;text-align:left}.hce-fund-table th input[type=checkbox]{width:17px;height:17px;min-height:0;margin:0;accent-color:#b88949}.hce-fund-closed-actions{white-space:nowrap}.hce-fund-closed-actions button+button{margin-left:6px}.hce-fund-settle-sum{margin:12px 0 4px;padding:10px 12px;border:1px solid #e5d4bf;border-radius:10px;background:#fffaf2;text-align:left}.hce-fund-settle-sum small{display:block;margin-top:4px;color:#000}.hce-overlay [data-settle-preview]{margin-top:12px}
.hce-fund-bar.is-over span{background:#bc2924}
.hce-fund-pending{border:1px dashed #c9a36b;background:#fffaf0}.hce .hce-fund-pending .hce-fund-head .hce-subtle+.hce-subtle{margin-top:4px}.hce-overlay [data-receive-settle]{margin-top:6px}
.hce-fund-cashier{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;margin:0 0 12px;padding:10px 14px;border:1px solid #e5d4bf;border-radius:10px;background:#fff;text-align:left}.hce .hce-fund-cashier label{display:flex;align-items:center;gap:8px;margin:0;font-weight:600}.hce .hce-fund-cashier select{min-width:220px;min-height:34px}.hce-fund-cashier>small{flex-basis:100%;margin:0}
.hce .hce-fund-cashier label{flex-direction:row;white-space:nowrap}.hce .hce-fund-cashier select{width:auto}
.hce-fund-section-title{margin:4px 0 10px;font-size:16px;text-align:left}.hce-fund-jobs .hce-row-actions{flex-wrap:wrap}.hce-history-hu-toggle{display:block;margin:4px auto 0;padding:2px 8px;min-height:0;font-size:11.5px;font-weight:700;color:#8d612d;background:#fff4e2;border:1px solid #e5c99f;border-radius:999px}.hce-history-appendix td{background:#fffaf1}.hce-history-appendix td:first-child{border-left:3px solid #c9a36b}.hce-history-filters{margin-bottom:8px}
.hce .hce-fund-jobs .hce-row-actions{flex-direction:row;flex-wrap:wrap;justify-content:center;gap:4px;max-width:330px;margin:0 auto}.hce .hce-fund-jobs .hce-row-actions button{width:auto;min-width:0}
.hce-fund-flag .hce-fund-src{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;text-align:left}.hce-fund-flag .hce-fund-src+.hce-fund-src{margin-top:6px}.hce-fund-requests{margin-top:8px;padding:10px 12px;border:1px solid #e5d4bf;border-radius:10px;background:#fff;text-align:left}.hce .hce-fund-requests label[data-fund-job-pick]{max-width:520px;text-align:left}.hce-related-doc{display:flex;align-items:center;gap:8px;margin-top:6px}.hce-related-doc button,.hce-fund-make button{min-height:30px;padding:4px 12px}.hce-fund-make{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px}.hce-fund-make[hidden],.hce-fund-requests[hidden],.hce label[data-fund-job-pick][hidden]{display:none}
.hce .hce-fund-flag{display:block}.hce .hce-fund-flag .hce-fund-requests{max-width:700px}
.hce-overlay .hce-fund-flag,.hce .hce-fund-flag{display:block}.hce-overlay .hce-fund-flag .hce-fund-requests{max-width:700px}.hce-overlay .hce-fund-requests label[data-fund-job-pick]{max-width:520px;text-align:left}.hce-overlay label[data-fund-job-pick][hidden],.hce-overlay .hce-fund-make[hidden],.hce-overlay .hce-fund-requests[hidden]{display:none}
.hce-fund-caption{font-size:12px;font-weight:700;color:#8d612d;margin-bottom:6px;text-align:left}.hce-overlay [data-fund-slot] .hce-fund-flag{margin-top:4px}
.hce-voucher-docs h4{margin:0 0 8px;font-size:13px;text-align:left;color:#6b5c4a}.hce-voucher-docs:not(:empty){margin-bottom:12px;padding:10px 12px;border:1px solid #e5d4bf;border-radius:10px;background:#fffaf1}.hce-voucher-doc{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:6px;text-align:left}.hce-voucher-doc strong{min-width:52px;color:#8d612d}.hce-voucher-doc button{min-height:30px;padding:4px 12px}.hce-overlay .hce-doc-done{color:#1f7a34;border-color:#9fcfa9;background:#eef8f0;font-weight:700}
.hce .hce-history-docs th,.hce .hce-history-docs td,.hce .hce-history-docs td.hce-money,.hce .hce-history-docs .hce-history-text{text-align:center;vertical-align:middle}.hce .hce-history-docs td small{display:block;margin-top:3px}.hce .hce-history-docs .hce-row-actions{align-items:center;justify-content:center}.hce-history-code{display:flex;flex-direction:column;align-items:center;gap:3px}.hce-history-code+.hce-history-code{margin-top:6px}.hce-history-code button{min-height:0;padding:2px 10px;font-size:11.5px}.hce .hce-chip-paid{background:#e7f5ea;color:#1f7a34;font-weight:700}.hce .hce-chip-unpaid{background:#fdecea;color:#bc2924;font-weight:700}.hce .hce-chip-partial{background:#fff4da;color:#8a5a12;font-weight:700}
.hce .hce-history-docs .hce-pay-select{width:auto;min-width:140px;min-height:32px;padding:4px 28px 4px 10px;border-radius:999px;font-weight:700;text-align:center}.hce .hce-pay-select.is-paid{color:#1f7a34;background-color:#e7f5ea;border-color:#9fcfa9}.hce .hce-pay-select.is-unpaid{color:#bc2924;background-color:#fdecea;border-color:#efb3ad}
.hce .hce-history-docs select.hce-pay-select{height:32px;min-height:32px;font-size:13px;line-height:1.2;padding-top:2px;padding-bottom:2px}

/* Tab-specific filters share the top action row. */
.hce .hce-toolbar-filter{flex-direction:row;align-items:center;gap:8px;white-space:nowrap;font-size:12px;margin:0}
.hce .hce-toolbar-filter select{width:200px;height:36px;padding:6px 9px;font-size:13px}
.hce .hce-fund-section-title{margin:2px 0 5px;font-size:15px}
.hce .hce-fund-cashier{padding:7px 10px;margin-bottom:8px;gap:6px 12px;font-size:13px}
.hce .hce-fund-cashier select{height:34px;min-height:34px;padding:5px 9px;font-size:13px}
.hce .hce-fund-cashier button{padding:6px 12px;font-size:13px}
@media(max-width:600px){.hce [data-header-actions]{width:100%;gap:8px}.hce .hce-toolbar-filter{width:100%;justify-content:space-between}.hce .hce-toolbar-filter select{width:auto;flex:1;max-width:240px}.hce .hce-fund-cashier>span{flex-basis:100%}.hce .hce-fund-cashier label{flex:1;min-width:0;white-space:normal}.hce .hce-fund-cashier select{min-width:0;width:100%;flex:1}}

.hce .hce-fund-tabs{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px;padding-bottom:10px;border-bottom:1px solid #e5d5be}
.hce .hce-fund-tabs button{padding:9px 16px;font-weight:600}

/* Desktop fund and payment-history presentation. These rules activate only on
   the two native views; dialogs, expense ledger, mobile and print stay intact. */
@media (min-width: 769px) {
  .hce.hce-view-fund,
  .hce.hce-view-history {
    padding: 10px 14px 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #24313f;
  }
  .hce.hce-view-fund .hce-header,
  .hce.hce-view-history .hce-header {
    gap: 14px;
    margin: 0 0 12px;
    padding: 0 0 10px;
    border-bottom: 1px solid #555;
  }
  .hce.hce-view-fund .hce-tabs,
  .hce.hce-view-history .hce-tabs {
    gap: 22px;
    margin: 0;
    border-color: #555;
  }
  .hce.hce-view-fund .hce-tabs button,
  .hce.hce-view-history .hce-tabs button {
    padding: 9px 2px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #4c5967;
    font-weight: 600;
  }
  .hce.hce-view-fund .hce-tabs button[aria-selected=true],
  .hce.hce-view-history .hce-tabs button[aria-selected=true] {
    color: #875d2a;
    background: transparent;
    border: 0;
    border-bottom: 2px solid #a9783b;
    box-shadow: none;
  }
  .hce.hce-view-fund .hce-fund-tabs button {
    padding: 7px 2px 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #4c5967;
    font-weight: 600;
  }
  .hce.hce-view-fund .hce-fund-tabs button[aria-pressed=true] {
    border: 0;
    border-bottom: 2px solid #a9783b;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #875d2a;
  }
  .hce.hce-view-fund .hce-fund-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #555;
  }
  .hce.hce-view-fund .hce-fund-intro > h3 {
    min-width: 0;
    margin: 0;
    color: #24313f;
    font-size: 19px;
    line-height: 1.25;
  }
  .hce.hce-view-fund .hce-fund-intro .hce-fund-context { flex: 0 1 auto; }
  .hce.hce-view-fund .hce-fund-intro .hce-fund-context > span { text-align: right; }
  .hce.hce-view-fund .hce-header [data-header-actions],
  .hce.hce-view-history .hce-header [data-header-actions] {
    gap: 8px;
  }
  .hce.hce-view-fund [data-content],
  .hce.hce-view-history [data-content] { min-width: 0; }
  .hce.hce-view-fund .hce-fund-page,
  .hce.hce-view-history .hce-history-page {
    display: grid;
    gap: 12px;
    min-width: 0;
  }
  .hce.hce-view-fund .hce-fund-context {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    color: #596675;
    font-size: 13px;
  }
  .hce.hce-view-fund .hce-fund-context label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
  }
  .hce.hce-view-fund .hce-fund-context select { width: auto; min-width: 180px; }
  .hce.hce-view-fund .hce-fund-current,
  .hce.hce-view-fund .hce-fund-pending,
  .hce.hce-view-fund .hce-fund-section {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .hce.hce-view-fund .hce-fund-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 14px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #596675;
    font-size: 13px;
    text-align: right;
  }
  .hce.hce-view-fund .hce-fund-context > span { margin: 0; }
  .hce.hce-view-fund .hce-fund-context > small { flex-basis: 100%; margin: 0; }
  .hce.hce-view-fund .hce-fund-current-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
  }
  .hce.hce-view-fund .hce-fund-current-head h3,
  .hce.hce-view-fund .hce-fund-section > h3,
  .hce.hce-view-history .hce-history > h2 {
    margin: 0;
    color: #24313f;
    font-size: 20px;
    line-height: 1.25;
  }
  .hce.hce-view-fund .hce-fund-current-head .hce-subtle { margin: 5px 0 0; }
  .hce.hce-view-fund .hce-fund-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }
  .hce.hce-view-fund .hce-fund-actions button,
  .hce.hce-view-fund .hce-fund-closed-actions button {
    min-height: 36px;
    padding: 7px 12px;
  }
  .hce.hce-view-fund .hce-fund-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 14px 0 8px;
    border-top: 1px solid #555;
    border-bottom: 1px solid #555;
  }
  .hce.hce-view-fund .hce-fund-stats > div {
    min-width: 0;
    padding: 12px 16px;
    border: 0;
    border-right: 1px solid #555;
    border-radius: 0;
    background: transparent;
  }
  .hce.hce-view-fund .hce-fund-stats > div:first-child { padding-left: 0; }
  .hce.hce-view-fund .hce-fund-stats > div:last-child { padding-right: 0; border-right: 0; }
  .hce.hce-view-fund .hce-fund-stats span { color: #637080; font-size: 12px; }
  .hce.hce-view-fund .hce-fund-stats strong {
    display: block;
    margin-top: 3px;
    color: #202b38;
    font-size: clamp(18px, 1.55vw, 24px);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }
  .hce.hce-view-fund .hce-fund-stats .is-negative strong,
  .hce.hce-view-fund .hce-fund-stats .hce-negative strong { color: #bc2924; }
  .hce.hce-view-fund .hce-fund-stats .is-balance strong {
    color: #80551f;
    font-weight: 750;
  }
  .hce.hce-view-fund .hce-fund-stats .is-balance.is-negative strong { color: #bc2924; }
  .hce.hce-view-fund .hce-fund-progress { margin: 0 0 4px; }
  .hce.hce-view-fund .hce-fund-progress .hce-fund-bar { margin: 0; }
  .hce.hce-view-fund .hce-fund-progress-copy {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 5px;
    color: #687585;
    font-size: 12px;
  }
  .hce.hce-view-fund .hce-fund-pending {
    padding: 12px 14px;
    border: 1px solid #ead9b9;
    border-radius: 10px;
    background: #fffaf0;
  }
  .hce.hce-view-fund .hce-fund-pending .hce-fund-current-head h3 { font-size: 16px; }
  .hce.hce-view-fund .hce-fund-section > h3 { margin-bottom: 8px; font-size: 16px; text-align: left; }
  .hce.hce-view-fund .hce-fund-section .hce-table-wrap,
  .hce.hce-view-history .hce-history-table {
    min-width: 0;
    border-color: #555;
    border-radius: 8px;
    box-shadow: none;
  }
  .hce.hce-view-fund .hce-fund-section table { min-width: 900px; }
  .hce.hce-view-fund .hce-fund-section th,
  .hce.hce-view-history .hce-history-table th {
    padding: 9px 10px;
    background: #f2f4f6;
    color: #566372;
    font-size: 11px;
  }
  .hce.hce-view-fund .hce-fund-section td,
  .hce.hce-view-history .hce-history-table td {
    padding: 9px 10px;
    border-color: #555;
    color: #344150;
    vertical-align: middle;
  }
  .hce.hce-view-fund .hce-fund-section tbody tr:hover,
  .hce.hce-view-history .hce-history-table tbody tr:hover { background: #fbfcfd; }
  .hce.hce-view-history .hce-history-heading {
    padding: 2px 0 9px;
    border-bottom: 1px solid #555;
  }
  .hce.hce-view-history .hce-history-heading h3 {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #24313f;
    font-size: 20px;
    line-height: 1.25;
  }
  .hce.hce-view-history .hce-history-heading p { margin: 4px 0 0; }
  .hce.hce-view-history .hce-history-table table { min-width: 1060px; table-layout: fixed; }
  .hce.hce-view-history .hce-history-table td { overflow-wrap: anywhere; }
  .hce.hce-view-history .hce-history-table th { border: 0; border-bottom: 1px solid #555; }
  .hce.hce-view-history .hce-history-content { min-width: 0; text-align: left; }
  .hce.hce-view-history .hce-history-primary { display: block; color: #263442; font-weight: 650; }
  .hce.hce-view-history .hce-history-secondary { display: block; margin-top: 3px; color: #718091; font-size: 12px; font-weight: 400; }
  .hce.hce-view-history .hce-history-links { min-width: 0; text-align: left; }
  .hce.hce-view-history .hce-history-links-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    margin-top: 4px;
    padding: 2px 0;
    border: 0;
    border-radius: 0;
    color: #875d2a;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
  }
  .hce.hce-view-history .hce-history-links-toggle:hover { color: #684316; background: transparent; text-decoration: underline; }
  .hce.hce-view-history .hce-history-appendix > td { padding: 10px 12px; background: #f8fafb; border-bottom: 1px solid #555; }
  .hce.hce-view-history .hce-history-links { padding: 2px 0; }
  .hce.hce-view-history .hce-history-links > strong { margin-bottom: 8px; color: #344150; }
  .hce.hce-view-history .hce-history-links-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 7px; }
  .hce.hce-view-history .hce-history-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #555;
    border-radius: 7px;
    background: #fff;
  }
  .hce.hce-view-history .hce-history-link-item .hce-history-primary { min-width: 0; overflow-wrap: anywhere; }
  .hce.hce-view-history .hce-history-links-list a,
  .hce.hce-view-history .hce-history-links-list button {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 30px;
    padding: 4px 9px;
    border-color: #555;
    border-radius: 6px;
    color: #435161;
    background: #fff;
    font-size: 11px;
    text-decoration: none;
  }
  .hce.hce-view-history .hce-history-settlement {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) repeat(2, minmax(90px, .75fr)) auto;
    align-items: center;
    gap: 12px;
    margin-top: 9px;
    padding: 9px 10px;
    border-left: 3px solid #c89a5d;
    border-radius: 6px;
    background: #fffaf1;
    color: #465361;
    font-size: 12px;
  }
  .hce.hce-view-history .hce-history-settlement > div:first-child { min-width: 0; }
  .hce.hce-view-history .hce-history-settlement small { display: block; margin-top: 3px; color: #718091; }
  .hce.hce-view-history .hce-history-settlement > div { min-width: 0; }
  .hce.hce-view-history .hce-history-settlement strong { display: block; color: #263442; font-variant-numeric: tabular-nums; }
  .hce.hce-view-history .hce-history-settlement .is-negative,
  .hce.hce-view-history .hce-history-settlement .hce-negative { color: #bc2924; }
  .hce.hce-view-history .hce-history-settlement button { min-height: 30px; padding: 4px 9px; }
}

@media (min-width: 769px) and (max-width: 1050px) {
  .hce.hce-view-fund .hce-fund-current-head { flex-wrap: wrap; }
  .hce.hce-view-fund .hce-fund-intro { align-items: flex-start; flex-wrap: wrap; }
  .hce.hce-view-fund .hce-fund-intro .hce-fund-context { justify-content: flex-start; }
  .hce.hce-view-fund .hce-fund-actions { justify-content: flex-start; }
  .hce.hce-view-fund .hce-fund-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hce.hce-view-fund .hce-fund-stats > div:nth-child(2) { border-right: 0; }
  .hce.hce-view-fund .hce-fund-stats > div:nth-child(n+3) { border-top: 1px solid #555; }
  .hce.hce-view-history .hce-history-settlement { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Related expense disclosure: compact title/code cards without changing table structure. */
@media screen {
  .hce.hce-view-history .hce-history-links-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    margin-top: 4px;
    padding: 2px 0;
    border: 0;
    border-radius: 0;
    color: #c62828 !important;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
  }
  .hce.hce-view-history .hce-history-links-toggle:hover { color: #a71919 !important; background: transparent; text-decoration: underline; }
  .hce.hce-view-history .hce-history-links { min-width: 0; padding: 2px 0; text-align: left; }
  .hce.hce-view-history .hce-history-links > strong { display: block; margin: 0 0 8px; font-size: 12px; font-weight: 600; }
  .hce.hce-view-history .hce-history-links-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
  .hce.hce-view-history .hce-history-link-item {
    display: grid;
    grid-template-rows: 20px 30px;
    align-items: start;
    gap: 6px;
    min-width: 0;
    min-height: 76px;
    padding: 9px 10px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #fff;
  }
  .hce.hce-view-history .hce-history-link-item .hce-history-primary {
    min-width: 0;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    line-height: 20px;
    font-size: 12px;
  }
  .hce.hce-view-history .hce-history-links-list a,
  .hce.hce-view-history .hce-history-links-list button,
  .hce.hce-view-history .hce-history-link-item > .hce-history-secondary {
    display: block;
    min-width: 0;
    width: 100%;
    height: 30px;
    min-height: 30px;
    margin: 0;
    padding: 5px 8px;
    border: 1px solid #555;
    border-radius: 5px;
    color: #000;
    background: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    text-decoration: none;
  }
}

/* Fund lifecycle labels remain separate from the native payment chip. */
@media screen {
  .hce.hce-view-history .hce-history-fund-state { display: block; margin-top: 4px; font-size: 14px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
  .hce.hce-view-history .hce-history-fund-state.is-open { color: #c62828 !important; }
  .hce.hce-view-history .hce-history-fund-state.is-settled { color: #875d2a !important; }
}

/* Related expenses stay two compact lines; preserve the financial table scroll host. */
@media screen and (max-width: 768px) {
  .hce.hce-view-history .hce-history-link-item { grid-template-rows: 20px 44px; min-height: 90px; }
  .hce.hce-view-history .hce-history-links-list button,
  .hce.hce-view-history .hce-history-link-item > .hce-history-secondary { height: 44px; min-height: 44px; padding: 12px 8px; font-size: 12px; }
  .hce.hce-view-history .hce-history-links-toggle { min-height: 44px; }
}

/* Mobile workspace: keep wide financial tables intact and scroll within the panel. */
@media (max-width: 768px) {
  .hce, .hce-section, .hce-dialog-body { min-width: 0; }
  .hce.hce-view-fund .hce-fund-intro { align-items: stretch; flex-direction: column; gap: 8px; }
  .hce.hce-view-fund .hce-fund-intro > h3 { font-size: 18px; }
  .hce.hce-view-fund .hce-fund-intro .hce-fund-context { justify-content: flex-start; text-align: left; }
  .hce { padding: 10px; }
  .hce .hce-table-wrap, .hce-overlay .hce-table-wrap, .hce-dntt-preview {
    width: 100%; max-width: 100%; min-width: 0;
    overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .hce .hce-ledger-full { overscroll-behavior-x: contain; }
  .hce table, .hce-overlay table { font-size: 13px; }
  .hce .hce-ledger-full td, .hce .hce-history td { padding: 8px; }
  .hce .hce-ledger-full .hce-ledger-index {
    min-width: 44px; width: 44px;
    box-shadow: 2px 0 3px rgba(80, 55, 20, .12);
  }
  .hce .hce-history table { border-collapse: separate; border-spacing: 0; }
  .hce .hce-history:not(.hce-fund-table):not(.hce-history-docs) th:first-child,
  .hce .hce-history:not(.hce-fund-table):not(.hce-history-docs) td:first-child:not([colspan]),
  .hce .hce-fund-table th:nth-child(4),
  .hce .hce-fund-table td:nth-child(4),
  .hce .hce-history-docs:not(.hce-history-table) th:nth-child(3),
  .hce .hce-history-docs:not(.hce-history-table) td:nth-child(3) {
    position: sticky; left: 0; z-index: 1;
    min-width: 112px; max-width: 150px;
    white-space: normal; overflow-wrap: anywhere;
    background: #fffdf8;
    box-shadow: 2px 0 3px rgba(80, 55, 20, .12);
  }
  .hce .hce-history:not(.hce-fund-table):not(.hce-history-docs) th:first-child,
  .hce .hce-fund-table th:nth-child(4),
  .hce .hce-history-docs:not(.hce-history-table) th:nth-child(3) { background: #f3eee6; z-index: 2; }
  .hce.hce-view-history .hce-history-table th:first-child,
  .hce.hce-view-history .hce-history-table td:first-child:not([colspan]) {
    position: sticky; left: 0; min-width: 112px; max-width: 145px;
    white-space: normal; overflow-wrap: anywhere;
    background: #fff; box-shadow: 2px 0 3px rgba(55, 65, 75, .12);
  }
  .hce.hce-view-history .hce-history-table td:first-child:not([colspan]) { z-index: 1; }
  .hce.hce-view-history .hce-history-table th:first-child { z-index: 2; background: #f2f4f6; }
  .hce .hce-tabs, .hce .hce-fund-tabs {
    flex-wrap: nowrap; max-width: 100%; overflow-x: auto;
    padding-bottom: 6px; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hce .hce-tabs::-webkit-scrollbar, .hce .hce-fund-tabs::-webkit-scrollbar { display: none; }
  .hce .hce-tabs button, .hce .hce-fund-tabs button { flex: 0 0 auto; white-space: nowrap; }
  .hce button, .hce-overlay button { min-height: 44px; min-width: 44px; }
  .hce .hce-row-actions, .hce .hce-ledger-full .hce-row-actions,
  .hce .hce-history .hce-row-actions, .hce .hce-fund-jobs .hce-row-actions,
  .hce-actions, .hce-dialog-foot, .hce-child-actions { gap: 8px; }
  .hce .hce-ledger-full .hce-row-actions, .hce .hce-history .hce-row-actions { flex-direction: row; flex-wrap: nowrap; width: max-content; }
  .hce .hce-row-actions button, .hce .hce-ledger-full .hce-row-actions button,
  .hce .hce-history .hce-row-actions button { padding: 9px 12px; width: auto; flex: 0 0 auto; }
  .hce input:not([type=checkbox]):not([type=radio]), .hce select,
  .hce-overlay input:not([type=checkbox]):not([type=radio]), .hce-overlay select,
  .hce .hce-history-docs select.hce-pay-select,
  .hce .hce-fund-cashier select, .hce .hce-toolbar-filter select,
  .hce .vi-month-picker-button, .hce-overlay .vi-month-picker-button { min-height: 44px; }
  .hce .hce-fund-paid, .hce .hce-pay-state label,
  .hce-overlay .hce-pay-state label, .hce-category-group summary { min-height: 44px; }
  .hce .hce-fund-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hce .hce-fund-cashier { align-items: stretch; }
  .hce .hce-fund-cashier label { min-width: 0; flex-wrap: wrap; }
  .hce .hce-fund-cashier select { min-width: 0; max-width: 100%; }

  /* The footer stays outside the scrolling body; visualViewport height is supplied
     by the shared mobile UI where available, with a dynamic viewport fallback. */
  .hce-overlay {
    top: var(--crm-mobile-viewport-top, 0px) !important;
    bottom: auto !important;
    height: var(--crm-mobile-viewport-height, 100dvh);
    padding: 8px 0 0; align-items: flex-end !important;
  }
  .hce-overlay .hce-dialog, .hce-overlay .hce-dialog.hce-small {
    width: 100%; max-width: 100%; max-height: 100%; min-height: 0;
    border-radius: 20px 20px 0 0; border-bottom: 0;
  }
  .hce-dialog-head { padding: 10px 14px; gap: 8px; flex-wrap: nowrap; }
  .hce-dialog-head h2 { min-width: 0; font-size: 18px; overflow-wrap: anywhere; }
  .hce-dialog-head button { flex: 0 0 44px; }
  .hce-dialog-body {
    padding: 14px; overflow-y: auto; -webkit-overflow-scrolling: touch;
    scroll-padding-block: 16px; overscroll-behavior-y: contain;
  }
  .hce-dialog-foot {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    flex: 0 0 auto; gap: 8px; box-shadow: 0 -3px 12px rgba(80, 55, 20, .08);
  }
  .hce-dialog-foot button { flex: 1 1 auto; }
  .hce-expense-editor .hce-grid-three,
  .hce-line-supplier > .hce-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .hce { padding: 8px; }
  .hce-expense-editor .hce-grid-three,
  .hce-line-supplier > .hce-grid { grid-template-columns: 1fr; }
  .hce-dialog-head, .hce-dialog-body { padding: 10px 12px; }
  .hce-dialog-foot { padding-inline: 12px; }
  .hce .hce-fund-kpis strong { font-size: 18px; overflow-wrap: anywhere; }
  .hce .hce-history:not(.hce-fund-table):not(.hce-history-docs) th:first-child,
  .hce .hce-history:not(.hce-fund-table):not(.hce-history-docs) td:first-child:not([colspan]),
  .hce .hce-fund-table th:nth-child(4), .hce .hce-fund-table td:nth-child(4),
  .hce .hce-history-docs:not(.hce-history-table) th:nth-child(3), .hce .hce-history-docs:not(.hce-history-table) td:nth-child(3) {
    min-width: 100px; max-width: 128px;
  }
}

/* Mobile expense cards: desktop ledger and underlying actions are unchanged. */
@media (max-width: 768px) {
  .hce { background: #faf7f2; border: 0; border-radius: 0; padding: 12px; }
  .hce .hce-header { margin-bottom: 12px; }
  .hce .hce-tabs { gap: 8px; padding-bottom: 5px; width: 100%; }
  .hce .hce-tabs button { border-radius: 22px; padding: 10px 16px; font-weight: 650; background: #fff; border-color: #e4d8c8; }
  .hce .hce-tabs button[aria-selected=true] { background: #af7b3d; color: #fff; border-color: #af7b3d; }
  .hce [data-header-actions] { width: 100%; justify-content: flex-end; }
  .hce [data-new] { position: fixed; right: 20px; bottom: calc(var(--crm-mobile-bottom-height, 0px) + 18px); z-index: 90; border: 3px solid #fff; border-radius: 50%; width: 58px; height: 58px; min-width: 58px; padding: 0; font-size: 0 !important; background: #bd8b4c; box-shadow: 0 6px 18px #65431f30; }
  .hce:has(.hce-filters-expanded) [data-new] { visibility: hidden; }
  .hce [data-new]::before { content: '+'; font-size: 34px; font-weight: 400; line-height: 1; color: #302b25; }
  .hce [data-content]:has(.hce-mobile-vouchers) { display: flex; flex-direction: column; padding-bottom: 70px; }
  .hce [data-content]:has(.hce-mobile-vouchers) > [data-kpi-area] { order: -1; }
  .hce .hce-kpis { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0 0 14px; }
  .hce .hce-kpi { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 14px; background: #fff; border: 1px solid #e8dac8; border-radius: 18px; box-shadow: 0 2px 3px #65431f09; }
  .hce .hce-kpi:nth-child(3) { background: #f4eadc; }
  .hce .hce-kpi strong { font-size: 20px; white-space: normal; overflow-wrap: anywhere; color: #302b25; }
  .hce [data-kpi-area] > .hce-subtle { display: none; }
  .hce .hce-filters { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; margin: 0 0 18px; align-items: center; }
  .hce .hce-filters > label { display: none; max-width: none; font-size: 12px; }
  .hce .hce-filters > label:has([name=q]) { display: block; grid-column: 1; grid-row: 1; font-size: 0; }
  .hce .hce-filters [name=q] { height: 46px; border-radius: 14px; font-size: 14px; background: #fff; }
  .hce .hce-mobile-filter-toggle { grid-column: 2; grid-row: 1; border-radius: 14px; padding: 10px 16px; font-size: 14px; font-weight: 650; }
  .hce .hce-filters > .hce-actions { display: none; }
  .hce .hce-filters.hce-filters-expanded > label { display: flex; grid-column: 1 / -1; }
  .hce .hce-filters.hce-filters-expanded > label:has([name=q]) { grid-column: 1; }
  .hce .hce-filters.hce-filters-expanded > .hce-actions { display: flex; grid-column: 1 / -1; justify-content: flex-end; }
  .hce .hce-show-mobile-cards > .hce-ledger-full,
  .hce .hce-show-mobile-cards > .hce-ledger-sticky,
  .hce .hce-show-mobile-cards > .hce-ledger-hscroll { display: none !important; }
  .hce .hce-mobile-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
  .hce .hce-mobile-list-heading h3 { color: #867a69; font-size: 14px; text-transform: uppercase; letter-spacing: .3px; }
  .hce .hce-mobile-list-heading button, .hce [data-mobile-cards] { background: transparent; border: 0; text-decoration: underline; color: #896332; }
  .hce .hce-expense-card { padding: 16px; border: 1px solid #e2d3c0; border-radius: 20px; margin-bottom: 12px; background: #fff; box-shadow: 0 2px 4px #5037140b; text-align: left; overflow-wrap: anywhere; }
  .hce .hce-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
  .hce .hce-card-top > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .hce .hce-card-top time { color: #000; font-size: 12px; }
  .hce .hce-card-top .hce-chip, .hce .hce-card-top .hce-pay-label { font-size: 11px; padding: 3px 8px; border-radius: 20px; margin: 0; font-weight: 700; }
  .hce .hce-card-top .hce-pay-label-paid { background: #edf9f1; color: #11704b; }
  .hce .hce-card-top .hce-pay-label-unpaid { background: #fff0f1; color: #ba2945; }
  .hce .hce-card-top .hce-pay-label-partial { background: #fff5df; color: #916017; }
  .hce .hce-card-amount { color: #25211c; font-size: 21px; font-weight: 750; flex-shrink: 0; font-variant-numeric: tabular-nums; line-height: 1.3; }
  .hce .hce-card-amount span { font-size: 15px; }
  .hce .hce-expense-card h3 { font-size: 18px; color: #29241e; line-height: 1.4; margin: 0 0 4px; text-align: left; }
  .hce .hce-card-supplier { margin: 0; font-size: 14px; color: #817665; }
  .hce .hce-card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
  .hce .hce-card-tags span { padding: 2px 8px; border-radius: 14px; color: #9a6a30; background: #faf1e6; font-size: 11px; font-weight: 600; }
  .hce .hce-expense-card footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #eee4d7; padding-top: 10px; margin-top: 12px; }
  .hce .hce-card-select { display: flex; flex-direction: row; align-items: center; gap: 7px; min-height: 44px; font-size: 11px; font-weight: 400; color: #817665; }
  .hce .hce-card-select input { flex: 0 0 18px; margin: 0; accent-color: #a9783b; }
  .hce .hce-card-actions { display: flex; gap: 8px; margin-left: auto; }
  .hce .hce-card-actions button { border: 0; border-radius: 12px; background: #f4eee5; font-size: 13px; font-weight: 650; padding: 10px 14px; }
  .hce .hce-card-actions .hce-primary { background: #af7b3d; color: #fff; }
}
@media (max-width: 480px) {
  .hce .hce-expense-card { padding: 14px; border-radius: 18px; }
  .hce .hce-card-top { flex-wrap: wrap; }
  .hce .hce-card-top > div { flex: 1 1 130px; }
  .hce .hce-card-amount { margin-left: auto; max-width: 100%; overflow-wrap: anywhere; }
  .hce .hce-kpi { padding: 12px; }
  .hce .hce-kpi strong { font-size: 18px; }
}
@media (max-width: 768px) {
  body.crm-mobile-hc-tabs.hc-module-expenses .hc-page { gap: 0 !important; }
  .hce:has(.hce-mobile-vouchers) .hce-header { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; }
  .hce:has(.hce-mobile-vouchers) .hce-header > .hce-tabs { min-width: 0; margin: 0; padding-bottom: 0; }
  .hce:has(.hce-mobile-vouchers) .hce-header > [data-header-actions] { width: auto; }
  .hce [data-export] { font-size: 11px !important; padding: 8px; border-radius: 12px; }
  .hce .hce-kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - 10px) / 2); overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .hce .hce-kpis::-webkit-scrollbar { display: none; }
  .hce .hce-kpi { min-height: 90px; scroll-snap-align: start; }
}


/* Catalog, monthly ledger and summary use the existing fund/history visual language.
   Screen-only presentation; financial markup, hidden controls and print remain native. */
@media screen and (min-width: 769px) {
  .hce:is(.hce-view-catalog,.hce-view-summary) {
    padding: 10px 14px 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #24313f;
  }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-header {
    gap: 14px;
    margin: 0 0 12px;
    padding: 0 0 10px;
    border-bottom: 1px solid #555;
  }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-tabs {
    gap: 22px;
    margin: 0;
    border-color: #555;
  }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-tabs button {
    padding: 9px 2px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #4c5967;
    font-weight: 600;
  }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-tabs button[aria-selected=true] {
    color: #875d2a;
    background: transparent;
    border: 0;
    border-bottom: 2px solid #a9783b;
    box-shadow: none;
  }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-header [data-header-actions] { gap: 8px; }
  .hce:is(.hce-view-catalog,.hce-view-summary) [data-content] { min-width: 0; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-subtle { color: #000; }
  .hce:is(.hce-view-catalog,.hce-view-summary) label { color: #566372; }
  .hce:is(.hce-view-catalog,.hce-view-summary) input:not([type=checkbox]),
  .hce:is(.hce-view-catalog,.hce-view-summary) select,
  .hce:is(.hce-view-catalog,.hce-view-summary) .vi-month-picker-button { border-color: #555; color: #344150; }
  .hce:is(.hce-view-catalog,.hce-view-summary) button:not(.hce-primary):not(.hce-danger):not(.hce-link):not([data-tab]) {
    border-color: #555;
    color: #435161;
  }
  .hce:is(.hce-view-catalog,.hce-view-summary) button:not(.hce-primary):not(.hce-danger):not(.hce-link):not([data-tab]):hover { background: #f2f4f6; }

  /* Filters use six equal columns; search and apply occupy the second row. */
  .hce.hce-view-summary .hce-filters {
    display: grid;
    grid-template-columns: repeat(6,minmax(0,1fr));
    align-items: end;
    gap: 9px 10px;
    margin: 14px 0 16px;
  }
  .hce.hce-view-summary .hce-filters > label {
    min-width: 0;
    max-width: none;
    gap: 4px;
    font-size: 11px;
    text-align: left;
  }
  .hce.hce-view-summary .hce-filters > label:has([name=q]) { grid-column: span 3; }
  .hce.hce-view-summary .hce-filters input,
  .hce.hce-view-summary .hce-filters select,
  .hce.hce-view-summary .hce-filters .vi-month-picker-button { height: 36px; padding: 6px 9px; font-size: 12px; }
  .hce.hce-view-summary .hce-filters [name=q] { text-align: left; }
  .hce.hce-view-summary .hce-filters > .hce-actions { justify-self: start; }
  .hce.hce-view-summary .hce-filters [data-filter] { min-height: 36px; padding: 7px 14px; white-space: nowrap; }

  /* KPI values share the fund view's typography and dividers. */
  .hce.hce-view-summary .hce-kpis {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 0;
    margin: 0 0 8px;
    border-top: 1px solid #555;
    border-bottom: 1px solid #555;
  }
  .hce.hce-view-summary .hce-kpis > .hce-kpi {
    display: block;
    min-width: 0;
    padding: 12px 16px;
    border: 0;
    border-right: 1px solid #555;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .hce.hce-view-summary .hce-kpis > .hce-kpi:first-child { padding-left: 0; }
  .hce.hce-view-summary .hce-kpis > .hce-kpi:last-child { padding-right: 0; border-right: 0; }
  .hce.hce-view-summary .hce-kpi > span { color: #637080; font-size: 12px; }
  .hce.hce-view-summary .hce-kpi strong {
    display: block;
    margin-top: 4px;
    color: #202b38;
    font-size: clamp(18px,1.55vw,24px);
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
  }
  .hce.hce-view-summary .hce-kpis + p.hce-subtle { margin: 5px 0 14px; font-size: 11px; }
  .hce.hce-view-summary .hce-notice {
    padding: 10px 12px;
    border: 1px solid #555;
    border-radius: 7px;
    background: #f2f4f6;
    color: #566372;
    font-size: 12px;
  }

  /* Catalogs are two document sections instead of large gold panels. */
  .hce.hce-view-catalog .hce-catalog-workspace { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
  .hce.hce-view-catalog .hce-catalog-panel { padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .hce.hce-view-catalog .hce-catalog-panel + .hce-catalog-panel { padding-left: 24px; border-left: 1px solid #555; }
  .hce.hce-view-catalog .hce-catalog-heading { gap: 10px; margin: 0 0 12px; min-height: 44px; }
  .hce.hce-view-catalog .hce-catalog-heading h3 { color: #24313f; font-size: 16px; }
  .hce.hce-view-catalog .hce-catalog-heading p { color: #718091; line-height: 1.4; }
  .hce.hce-view-catalog .hce-catalog-heading > button { min-height: 34px; padding: 6px 11px; white-space: nowrap; }
  .hce.hce-view-catalog .hce-catalog-count { background: #f2f4f6; color: #566372; border-radius: 6px; font-size: 11px; }
  .hce.hce-view-catalog .hce-catalog-filters { padding: 10px 12px; border: 1px solid #555; background: #f7f9fa; border-radius: 7px; }
  .hce.hce-view-catalog .hce-catalog-filters label { text-align: left; }
  .hce.hce-view-catalog .hce-catalog-filters input { text-align: left; }
  .hce.hce-view-catalog .hce-catalog-summary { margin: 10px 0; color: #718091; }
  .hce.hce-view-catalog .hce-category-group { border-color: #555; border-radius: 7px; }
  .hce.hce-view-catalog .hce-category-group summary { padding: 11px 12px; background: #f2f4f6; color: #344150; }
  .hce.hce-view-catalog .hce-category-body { background: #fff; }
  .hce.hce-view-catalog .hce-category-children li { border-color: #555; }
  .hce.hce-view-catalog .hce-category-tools button { min-height: 32px; }
  .hce.hce-view-catalog .hce-table-wrap { border-color: #555; border-radius: 7px; }
  .hce.hce-view-catalog th { padding: 9px 10px; background: #f2f4f6; color: #566372; border-color: #555; }
  .hce.hce-view-catalog td { padding: 9px 10px; border-color: #555; }
  .hce.hce-view-catalog :is(.hce-catalog-name,.hce-catalog-name .hce-link) { text-align: left; }
  .hce.hce-view-catalog tbody tr:hover td { background: #f7f9fa; }
  .hce.hce-view-catalog .hce-catalog-empty { border-color: #555; background: #f7f9fa; border-radius: 7px; }
  .hce.hce-view-catalog .hce-catalog-empty strong { color: #344150; }
  .hce.hce-view-catalog .hce-catalog-empty p { color: #718091; }
  .hce.hce-view-catalog [data-content] > .hce-section { padding: 18px 0 0; margin: 24px 0 0; border: 0; border-top: 1px solid #555; border-radius: 0; background: transparent; }
  .hce.hce-view-catalog [data-content] > .hce-section h3 { color: #24313f; text-align: left; margin-bottom: 7px; }

  /* Summary drilldowns retain their native buttons and financial calculations. */
  .hce.hce-view-summary .hce-summary-cash { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin: 16px 0 0; padding: 12px 0; border: 0; border-bottom: 1px solid #555; border-radius: 0; background: transparent; }
  .hce.hce-view-summary .hce-summary-cash strong { margin: 0; color: #80551f; font-size: 22px; }
  .hce.hce-view-summary .hce-summary-groups { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; margin-top: 18px; }
  .hce.hce-view-summary .hce-summary-panel { min-width: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; }
  .hce.hce-view-summary .hce-summary-panel h3 { margin: 0 0 9px; color: #24313f; font-size: 15px; text-align: left; }
  .hce.hce-view-summary .hce-table-wrap { border-color: #555; border-radius: 7px; }
  .hce.hce-view-summary th { padding: 9px 10px; background: #f2f4f6; color: #566372; border-color: #555; font-size: 11px; }
  .hce.hce-view-summary td { padding: 9px 10px; border-color: #555; }
  .hce.hce-view-summary .hce-summary-panel :is(th,td):first-child:not([colspan]) { text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .hce.hce-view-summary .hce-summary-panel :is(th,td):last-child:not([colspan]) { text-align: right; white-space: nowrap; }
  .hce.hce-view-summary .hce-summary-panel .hce-link { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
  .hce.hce-view-summary tbody tr:hover td { background: #f7f9fa; }
  .hce.hce-view-summary .hce-summary-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid #555; }
  .hce.hce-view-summary .hce-summary-actions button { min-height: 34px; padding: 6px 12px; }
  .hce.hce-view-summary .hce-review-lists { gap: 20px; margin-top: 20px; }
  .hce.hce-view-summary .hce-review-lists > .hce-section { padding: 0; border: 0; border-radius: 0; background: transparent; }
  .hce.hce-view-summary .hce-review-lists h3 { margin-bottom: 9px; color: #24313f; font-size: 15px; text-align: left; }

  .hce.hce-view-summary .hce-kpi .hce-negative,
  .hce.hce-view-summary .hce-kpi.hce-negative strong,
  .hce.hce-view-summary .hce-kpi.is-negative strong { color: #bc2924; }
}

@media screen {
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-view-heading { padding: 2px 0 10px; margin: 0 0 14px; border-bottom: 1px solid #555; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-view-heading h3 { margin: 0; padding: 0; color: #24313f; font-size: 20px; line-height: 1.25; text-align: left; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-view-heading p { margin: 4px 0 0; color: #718091; font-size: 12px; line-height: 1.5; text-align: left; }
}

@media screen and (min-width: 769px) and (max-width: 1200px) {
  .hce.hce-view-summary .hce-filters { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .hce.hce-view-summary .hce-filters > label:has([name=q]) { grid-column: span 2; }
  .hce.hce-view-summary .hce-summary-groups { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media screen and (min-width: 769px) and (max-width: 1050px) {
  .hce.hce-view-summary .hce-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(2) { padding-right: 0; border-right: 0; }
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(3) { padding-left: 0; }
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(n+3) { border-top: 1px solid #555; }
  .hce.hce-view-catalog .hce-catalog-workspace { grid-template-columns: 1fr; gap: 20px; }
  .hce.hce-view-catalog .hce-catalog-panel + .hce-catalog-panel { padding: 20px 0 0; border-left: 0; border-top: 1px solid #555; }
}
@media screen and (min-width: 769px) and (max-width: 900px) {
  .hce.hce-view-summary .hce-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .hce.hce-view-summary .hce-summary-groups { grid-template-columns: 1fr; }
}

/* Catalog/summary mobile presentation. Card/table and filter visibility stay native. */
@media screen and (max-width: 768px) {
  .hce:is(.hce-view-catalog,.hce-view-summary) { background: #f7f9fa; color: #24313f; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-header { padding-bottom: 8px; border-bottom: 1px solid #555; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-tabs { gap: 18px; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-tabs button { padding: 10px 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; box-shadow: none; color: #4c5967; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-tabs button[aria-selected=true] { background: transparent; color: #875d2a; border-bottom-color: #a9783b; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-view-heading { margin-bottom: 12px; }
  .hce:is(.hce-view-catalog,.hce-view-summary) .hce-view-heading h3 { font-size: 18px; }
  .hce.hce-view-summary .hce-kpi { border-color: #555; box-shadow: none; }
  .hce.hce-view-summary .hce-kpi:nth-child(3) { background: #f2f4f6; }
  .hce.hce-view-catalog .hce-catalog-workspace { grid-template-columns: 1fr; gap: 20px; }
  .hce.hce-view-catalog .hce-catalog-panel { padding: 0; border: 0; border-radius: 0; background: transparent; }
  .hce.hce-view-catalog .hce-catalog-panel + .hce-catalog-panel { padding-top: 18px; border-top: 1px solid #555; }
  .hce.hce-view-catalog .hce-catalog-heading h3 { color: #24313f; }
  .hce.hce-view-catalog .hce-catalog-filters { grid-template-columns: minmax(0,1fr) minmax(110px,.65fr); background: #f2f4f6; padding: 10px; }
  .hce.hce-view-catalog .hce-catalog-filters :is(input,select) { border-color: #555; }
  .hce.hce-view-catalog .hce-category-group { border-color: #555; }
  .hce.hce-view-catalog .hce-category-group summary { background: #f2f4f6; color: #344150; }
  .hce.hce-view-catalog .hce-catalog-empty { border-color: #555; background: #fff; }
  .hce.hce-view-summary .hce-summary-groups { grid-template-columns: 1fr; gap: 18px; }
  .hce.hce-view-summary .hce-summary-panel { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .hce.hce-view-summary .hce-summary-panel h3 { margin: 0 0 8px; color: #24313f; font-size: 16px; text-align: left; }
  .hce.hce-view-summary .hce-summary-cash { margin: 12px 0; border-color: #555; border-radius: 8px; background: #fff; }
  .hce.hce-view-summary .hce-summary-cash strong { color: #80551f; }
  .hce.hce-view-summary .hce-summary-panel .hce-table-wrap { border-color: #555; border-radius: 8px; }
  .hce.hce-view-summary .hce-summary-panel th { background: #f2f4f6; color: #566372; border-color: #555; }
  .hce.hce-view-summary .hce-summary-panel td { border-color: #555; }
  .hce.hce-view-summary .hce-summary-panel :is(th,td):first-child:not([colspan]) { text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .hce.hce-view-summary .hce-summary-panel :is(th,td):last-child:not([colspan]) { text-align: right; white-space: nowrap; }
  .hce.hce-view-summary .hce-summary-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
}

/* The monthly ledger retains its exact native structure and geometry.
   Only paint properties change: no sizing, spacing, grid, font or display overrides. */
@media screen {
  .hce.hce-view-list { background: transparent; color: #24313f; }
  .hce.hce-view-list .hce-tabs { border-color: #555; }
  .hce.hce-view-list .hce-tabs button {
    border-color: transparent;
    border-bottom-color: transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #4c5967;
    transition: background-color .16s ease, color .16s ease;
  }
  .hce.hce-view-list .hce-tabs button[aria-selected=true] {
    border-bottom-color: #a9783b;
    background: transparent;
    color: #875d2a;
  }
  .hce.hce-view-list .hce-subtle { color: #000; }
  .hce.hce-view-list label { color: #566372; }
  .hce.hce-view-list input:not([type=checkbox]),
  .hce.hce-view-list select,
  .hce.hce-view-list .vi-month-picker-button { border-color: #555; color: #344150; }
  .hce.hce-view-list button:not(.hce-primary):not(.hce-danger):not(.hce-link):not([data-tab]) {
    border-color: #555;
    color: #435161;
    transition: background-color .16s ease, border-color .16s ease;
  }
  .hce.hce-view-list button:not(.hce-primary):not(.hce-danger):not(.hce-link):not([data-tab]):hover { background: #f2f4f6; }
  .hce.hce-view-list .hce-kpi { border-color: #555; box-shadow: none; }
  .hce.hce-view-list .hce-kpi strong { color: #24313f; }
  .hce.hce-view-list .hce-notice { background: #f2f4f6; color: #566372; }
  .hce.hce-view-list .hce-ledger-full { border-color: #555; }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th {
    border-color: #555;
    background: #f2f4f6;
    color: #566372;
  }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th[colspan] { background: #e9edf1; color: #344150; }
  .hce.hce-view-list .hce-ledger-full td { border-color: #555; }
  .hce.hce-view-list .hce-ledger-full .hce-ledger-index { background: #f7f9fa; }
  .hce.hce-view-list .hce-ledger-full thead .hce-ledger-index { background: #f2f4f6; }
  .hce.hce-view-list .hce-ledger-full .hce-allocation-cell:not(.hce-allocation-filled) { background: #fafbfc; }
  .hce.hce-view-list .hce-ledger-full tbody tr:hover td:not(.hce-allocation-filled) { background: #f7f9fa; }
  .hce.hce-view-list .hce-ledger-full .hce-voucher-start td { border-top-color: #555; }
  .hce.hce-view-list .hce-ledger-full tfoot :is(th,td) { background: #f2f4f6; border-color: #555; border-top-color: #b88949; }
  .hce.hce-view-list .hce-ledger-full td small { color: #718091; }
  .hce.hce-view-list .hce-ledger-hscroll { border-color: #555; background: #f2f4f6; scrollbar-color: #aeb9c4 #f2f4f6; }
  .hce.hce-view-list .hce-ledger-hscroll::-webkit-scrollbar-track { background: #f2f4f6; }
  .hce.hce-view-list .hce-ledger-hscroll::-webkit-scrollbar-thumb { background: #aeb9c4; }
}
@media screen and (max-width: 768px) {
  .hce.hce-view-list { background: #f7f9fa; }
  .hce.hce-view-list .hce-kpi:nth-child(3) { background: #f2f4f6; }
  .hce.hce-view-list .hce-expense-card { border-color: #555; box-shadow: 0 2px 4px #2634420b; }
  .hce.hce-view-list .hce-expense-card footer { border-color: #555; }
}

/* Compact native payment-status control, scoped to saved payment history. */
@media screen {
  .hce.hce-view-history .hce-history-table select.hce-pay-select {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    display: inline-block;
    width: 118px;
    max-width: calc(100% - 1px);
    min-width: 0;
    height: 28px;
    min-height: 28px;
    margin: 0 auto;
    padding: 3px 20px 3px 6px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    text-align-last: left;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%236b7c8f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px 12px;
    cursor: pointer;
  }
  .hce.hce-view-history .hce-history-table select.hce-pay-select:disabled { opacity: .65; cursor: wait; }
}
@media screen and (min-width: 769px) and (max-width: 1279px) {
  .hce.hce-view-history .hce-history-table select.hce-pay-select {
    padding: 3px 14px 3px 2px;
    font-size: 11.5px;
    background-position: right 3px center;
    background-size: 10px 10px;
  }
}
@media screen and (max-width: 768px) {
  .hce.hce-view-history .hce-history-table select.hce-pay-select {
    width: 140px;
    min-width: 140px;
    height: 44px;
    min-height: 44px;
    font-size: 16px;
  }
}

/* Summary workspace: presentation only; native filters, totals and actions remain intact. */
@media screen {
  .hce.hce-view-summary { background: #fff; color: #293644; }
  .hce.hce-view-summary .hce-view-heading { margin-bottom: 16px; padding-bottom: 12px; }
  .hce.hce-view-summary .hce-view-heading h3 { font-size: 22px; letter-spacing: -.3px; }
  .hce.hce-view-summary .hce-view-heading p { max-width: 720px; font-size: 12px; }
  .hce.hce-view-summary .hce-filters {
    grid-template-columns: repeat(12,minmax(0,1fr)); gap: 12px;
    margin: 0 0 18px; padding: 14px;
    border: 1px solid #555; border-radius: 10px; background: #f7f9fa;
  }
  .hce.hce-view-summary .hce-filters > label { grid-column: span 3; gap: 5px; color: #566372; font-size: 11px; font-weight: 600; }
  .hce.hce-view-summary .hce-filters > label:has([name=q]) { grid-column: span 4; }
  .hce.hce-view-summary .hce-filters > .hce-actions { grid-column: span 2; align-self: end; justify-self: stretch; }
  .hce.hce-view-summary .hce-filters :is(input,select,.vi-month-picker-button) { height: 38px; padding: 7px 10px; border-color: #555; border-radius: 7px; background: #fff; color: #344150; font-size: 12px; text-align: left; }
  .hce.hce-view-summary .hce-filters [data-filter] { width: 100%; min-height: 38px; padding: 7px 10px; border-radius: 7px; font-size: 12px; }
  .hce.hce-view-summary .hce-kpis { grid-template-columns: repeat(4,minmax(0,1fr)); grid-auto-flow: row; grid-auto-columns: auto; gap: 12px; margin: 0; padding-bottom: 0; border: 0; overflow: visible; }
  .hce.hce-view-summary .hce-kpis > .hce-kpi,
  .hce.hce-view-summary .hce-kpis > .hce-kpi:first-child,
  .hce.hce-view-summary .hce-kpis > .hce-kpi:last-child,
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(2),
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(3),
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(n+3) {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0; min-height: 0; scroll-snap-align: none;
    padding: 14px 16px; border: 1px solid #555; border-radius: 10px;
    background: #fff; box-shadow: none;
  }
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(3) { border-color: #e8d7bd; background: #fcf8f1; }
  .hce.hce-view-summary .hce-kpis .hce-subtle { display: block; min-height: 18px; color: #677585; font-size: 11px; font-weight: 500; }
  .hce.hce-view-summary .hce-kpis strong { margin-top: 8px; font-size: clamp(21px,1.9vw,28px); font-weight: 700; line-height: 1.2; letter-spacing: -.4px; }
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(3) strong { color: #875d2a; }
  .hce.hce-view-summary .hce-kpis + p.hce-subtle { display: block; margin: 9px 0 16px; color: #000; font-size: 11px; }
  .hce.hce-view-summary .hce-summary-cash {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
    margin: 0; padding: 14px 16px; border: 1px solid #555; border-left: 3px solid #b18448;
    border-radius: 10px; background: #f7f9fa;
  }
  .hce.hce-view-summary .hce-summary-cash-copy { min-width: 0; }
  .hce.hce-view-summary .hce-summary-cash-copy > span { display: block; color: #344150; font-size: 13px; font-weight: 650; }
  .hce.hce-view-summary .hce-summary-cash-copy p { margin: 3px 0 0; color: #000; font-size: 11px; }
  .hce.hce-view-summary .hce-summary-cash strong { margin: 0; color: #344150; font-size: 23px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
  .hce.hce-view-summary [data-result] > .hce-notice { margin: 8px 0 18px; padding: 0 2px; border: 0; background: transparent; color: #000; font-size: 11px; }
  .hce.hce-view-summary .hce-summary-groups { grid-template-columns: repeat(3,minmax(0,1fr)); align-items: start; gap: 14px; margin: 0; }
  .hce.hce-view-summary .hce-summary-panel,
  .hce.hce-view-summary .hce-review-lists > .hce-section { min-width: 0; margin: 0; padding: 0; border: 1px solid #555; border-radius: 10px; background: #fff; overflow: hidden; }
  .hce.hce-view-summary .hce-summary-panel h3,
  .hce.hce-view-summary .hce-review-lists h3 { margin: 0; padding: 13px 14px; border-bottom: 1px solid #555; color: #344150; font-size: 14px; font-weight: 650; line-height: 1.45; text-align: left; }
  .hce.hce-view-summary .hce-summary-panel .hce-table-wrap,
  .hce.hce-view-summary .hce-review-lists .hce-table-wrap { border: 0; border-radius: 0; background: #fff; }
  .hce.hce-view-summary .hce-summary-panel table,
  .hce.hce-view-summary .hce-review-lists table { width: 100%; min-width: 0; table-layout: fixed; }
  .hce.hce-view-summary .hce-summary-panel th { padding: 9px 14px; background: #f7f9fa; color: #000; font-size: 10px; font-weight: 600; white-space: normal; }
  .hce.hce-view-summary .hce-summary-panel td,
  .hce.hce-view-summary .hce-review-lists td { padding: 10px 14px; border-color: #555; color: #4e5c6b; font-size: 12px; vertical-align: middle; overflow-wrap: anywhere; }
  .hce.hce-view-summary .hce-summary-panel :is(th,td):last-child:not([colspan]) { width: 42%; }
  .hce.hce-view-summary .hce-summary-panel :is(th,td):first-child:not([colspan]) { text-align: left; }
  .hce.hce-view-summary .hce-summary-panel .hce-money { white-space: normal; }
  .hce.hce-view-summary .hce-summary-panel .hce-link { max-width: 100%; font-size: 12px; text-decoration: none; overflow-wrap: anywhere; }
  .hce.hce-view-summary .hce-summary-panel .hce-link:hover { text-decoration: underline; }
  .hce.hce-view-summary .hce-summary-panel tbody tr:last-child td,
  .hce.hce-view-summary .hce-review-lists tbody tr:last-child td { border-bottom: 0; }
  .hce.hce-view-summary .hce-empty { padding: 16px 14px !important; color: #000; font-size: 12px; }
  .hce.hce-view-summary .hce-summary-actions { justify-content: space-between; gap: 12px; margin: 16px 0; padding: 12px 14px; border: 1px solid #555; border-radius: 10px; background: #f7f9fa; }
  .hce.hce-view-summary .hce-summary-period-copy strong { display: block; color: #344150; font-size: 12px; font-weight: 650; }
  .hce.hce-view-summary .hce-summary-period-copy p { margin: 2px 0 0; color: #000; font-size: 11px; }
  .hce.hce-view-summary .hce-summary-period-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
  .hce.hce-view-summary .hce-summary-actions button { min-height: 34px; padding: 6px 11px; font-size: 12px; background: #fff; }
  .hce.hce-view-summary .hce-review-lists { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 0; }
  .hce.hce-view-summary .hce-review-lists > .hce-section > .hce-subtle { margin: 0; padding: 8px 14px 0; color: #000; font-size: 11px; }
  .hce.hce-view-summary .hce-review-lists .hce-link { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
  .hce.hce-view-summary .hce-review-lists .hce-money { width: 32%; white-space: normal; }
}
@media screen and (min-width: 769px) and (max-width: 999px) {
  .hce.hce-view-summary .hce-summary-groups { grid-template-columns: 1fr; }
  .hce.hce-view-summary .hce-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media screen and (max-width: 768px) {
  .hce.hce-view-summary .hce-view-heading h3 { font-size: 19px; }
  .hce.hce-view-summary .hce-view-heading p { font-size: 11px; }
  .hce.hce-view-summary .hce-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 12px; margin-bottom: 14px; }
  .hce.hce-view-summary .hce-filters:not(.hce-filters-expanded) { grid-template-columns: minmax(0,1fr) auto; }
  .hce.hce-view-summary .hce-filters > label:has([name=q]) { grid-column: 1; grid-row: 1; font-size: 0; }
  .hce.hce-view-summary .hce-mobile-filter-toggle { grid-column: 2; grid-row: 1; min-height: 44px; border-radius: 7px; padding: 8px 14px; }
  .hce.hce-view-summary .hce-filters.hce-filters-expanded > label { grid-column: auto; grid-row: auto; font-size: 11px; }
  .hce.hce-view-summary .hce-filters.hce-filters-expanded > label:has([name=q]),
  .hce.hce-view-summary .hce-filters.hce-filters-expanded > .hce-actions,
  .hce.hce-view-summary .hce-filters.hce-filters-expanded > .hce-mobile-filter-toggle { grid-column: 1/-1; grid-row: auto; }
  .hce.hce-view-summary .hce-filters :is(input,select,.vi-month-picker-button),
  .hce.hce-view-summary .hce-filters [data-filter] { height: 44px; min-height: 44px; }
  .hce.hce-view-summary .hce-filters :is(input,select,.vi-month-picker-button) { font-size: 16px !important; }
  .hce.hce-view-summary .hce-kpis { grid-template-columns: 1fr; gap: 8px; }
  .hce.hce-view-summary .hce-kpis > .hce-kpi,
  .hce.hce-view-summary .hce-kpis > .hce-kpi:first-child,
  .hce.hce-view-summary .hce-kpis > .hce-kpi:last-child,
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(2),
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(3),
  .hce.hce-view-summary .hce-kpis > .hce-kpi:nth-child(n+3) { padding: 12px; }
  .hce.hce-view-summary .hce-kpis > .hce-kpi { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; }
  .hce.hce-view-summary .hce-kpis strong { margin-top: 0; font-size: 18px; letter-spacing: -.3px; text-align: right; white-space: nowrap; overflow-wrap: normal; word-break: normal; }
  .hce.hce-view-summary .hce-kpis .hce-subtle { min-height: 0; font-size: 11px; line-height: 1.5; }
  .hce.hce-view-summary .hce-summary-panel table,
  .hce.hce-view-summary .hce-review-lists table { table-layout: auto; }
  .hce.hce-view-summary .hce-summary-panel :is(th,td):last-child:not([colspan]),
  .hce.hce-view-summary .hce-review-lists .hce-money { width: 1%; white-space: nowrap; overflow-wrap: normal; word-break: normal; }
  .hce.hce-view-summary .hce-summary-panel .hce-link { white-space: nowrap; overflow-wrap: normal; word-break: normal; }

  .hce.hce-view-summary .hce-summary-cash { padding: 12px; gap: 10px; }
  .hce.hce-view-summary .hce-summary-cash-copy > span { font-size: 12px; }
  .hce.hce-view-summary .hce-summary-cash strong { font-size: 22px; }
  .hce.hce-view-summary .hce-summary-groups,
  .hce.hce-view-summary .hce-review-lists { grid-template-columns: 1fr; gap: 12px; }
  .hce.hce-view-summary .hce-summary-actions { align-items: stretch; flex-direction: column; padding: 12px; }
  .hce.hce-view-summary .hce-summary-period-buttons { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .hce.hce-view-summary .hce-summary-actions button { min-height: 44px; padding: 7px; font-size: 12px !important; }
  .hce.hce-view-summary .hce-summary-panel .hce-link { font-size: 12px !important; }
  .hce.hce-view-summary .hce-review-lists .hce-link { font-size: 12px !important; }
}

/* Expense typography: black ink, preserving white on existing primary actions. */
@media screen {
  .hce.hce, .hce.hce *, .hce-overlay.hce-overlay, .hce-overlay.hce-overlay * { color: #000 !important; }
  .hce.hce .hce-primary, .hce.hce .hce-primary *,
  .hce-overlay.hce-overlay .hce-primary, .hce-overlay.hce-overlay .hce-primary * { color: #fff !important; }
  .hce.hce input::placeholder, .hce.hce textarea::placeholder,
  .hce-overlay.hce-overlay input::placeholder, .hce-overlay.hce-overlay textarea::placeholder { color: #000; opacity: 1; }

  /* Native select keeps keyboard/mobile pickers and opens above scrolling tabs. */
  .hce.hce .hce-tabs select.hce-fund-nav {
    flex: 0 0 auto; width: 196px; max-width: none; height: 38px; min-height: 38px;
    margin: 0; padding: 7px 24px 7px 6px;
    border: 0; border-bottom: 2px solid transparent; border-radius: 0;
    background-color: transparent; box-shadow: none;
    font-size: 12px; font-weight: 600; text-align: left; text-align-last: left;
    cursor: pointer; appearance: auto;
  }
  .hce.hce .hce-tabs select.hce-fund-nav[data-active=true] { border-bottom-color: #a9783b; font-weight: 700; }
  .hce.hce .hce-tabs select.hce-fund-nav:focus-visible { outline: 2px solid #a9783b; outline-offset: 2px; }
  .hce.hce .hce-tabs select.hce-fund-nav option { background: #fff; color: #000; }

  /* ImageGen concept: a compact heading, action row and inline money strip. */
  .hce.hce-view-fund .hce-fund-intro { gap: 8px 16px; margin: 0 0 10px; padding: 0 0 8px; }
  .hce.hce-view-fund .hce-fund-intro > h3 { font-size: 18px; line-height: 1.3; }
  .hce.hce-view-fund .hce-fund-context { gap: 6px 10px; font-size: 12px; line-height: 1.4; }
  .hce.hce-view-fund .hce-fund-context small { font-size: 11px; }
  .hce.hce-view-fund .hce-fund-current { margin: 0 0 12px; }
  .hce.hce-view-fund .hce-fund-current-head { align-items: center; gap: 8px 14px; }
  .hce.hce-view-fund .hce-fund-current-head > div:first-child { flex: 1 1 340px; min-width: 0; }
  .hce.hce-view-fund .hce-fund-current-head h3 { font-size: 14px; line-height: 1.35; }
  .hce.hce-view-fund .hce-fund-current-head .hce-subtle { margin: 3px 0 0; font-size: 11px; line-height: 1.5; }
  .hce.hce-view-fund .hce-fund-current-head .hce-fund-actions { flex: 0 1 auto; gap: 6px; }
  .hce.hce-view-fund .hce-fund-current-head .hce-fund-actions button { min-height: 32px; padding: 6px 10px; font-size: 12px; line-height: 1.4; border-radius: 6px; }
  .hce.hce-view-fund .hce-fund-stats {
    grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0;
    margin: 10px 0 6px; border: 1px solid #555; border-radius: 7px; background: #fff;
  }
  .hce.hce-view-fund .hce-fund-stats > div,
  .hce.hce-view-fund .hce-fund-stats > div:first-child,
  .hce.hce-view-fund .hce-fund-stats > div:last-child {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
    gap: 2px 10px; min-width: 0; padding: 10px 12px; border: 0; border-right: 1px solid #555;
  }
  .hce.hce-view-fund .hce-fund-stats > div:last-child { border-right: 0; }
  .hce.hce-view-fund .hce-fund-stats > .is-balance { background: #fcf7ed; }
  .hce.hce-view-fund .hce-fund-stats > .is-negative { background: #fff0ed; }
  .hce.hce-view-fund .hce-fund-stats span { font-size: 12px; font-weight: 400; line-height: 1.4; }
  .hce.hce-view-fund .hce-fund-stats strong {
    display: inline; margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700;
    white-space: nowrap; overflow-wrap: normal; word-break: normal; font-variant-numeric: tabular-nums;
  }
  .hce.hce-view-fund .hce-fund-progress { height: 4px; margin: 0; }
}
@media screen and (min-width: 769px) and (max-width: 1150px) {
  .hce.hce-view-fund .hce-fund-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hce.hce-view-fund .hce-fund-stats > div:nth-child(2) { border-right: 0; }
  .hce.hce-view-fund .hce-fund-stats > div:nth-child(n+3) { border-top: 1px solid #555; }
}
@media screen and (max-width: 768px) {
  .hce.hce .hce-tabs select.hce-fund-nav { width: 232px; height: 44px; min-height: 44px; font-size: 16px; }
  .hce.hce-view-fund .hce-fund-intro { gap: 6px; margin-bottom: 10px; }
  .hce.hce-view-fund .hce-fund-intro .hce-fund-context > span { text-align: left; }
  .hce.hce-view-fund .hce-fund-current-head { align-items: stretch; flex-direction: column; gap: 8px; }
  .hce.hce-view-fund .hce-fund-current-head > div:first-child { flex: none; }
  .hce.hce-view-fund .hce-fund-current-head .hce-fund-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hce.hce-view-fund .hce-fund-current-head .hce-fund-actions button { min-height: 44px; padding: 8px; font-size: 12px !important; }
  .hce.hce-view-fund .hce-fund-stats { grid-template-columns: 1fr; }
  .hce.hce-view-fund .hce-fund-stats > div,
  .hce.hce-view-fund .hce-fund-stats > div:first-child,
  .hce.hce-view-fund .hce-fund-stats > div:last-child { padding: 8px 10px; border-right: 0; border-top: 1px solid #555; }
  .hce.hce-view-fund .hce-fund-stats > div:first-child { border-top: 0; }
  .hce.hce-view-fund .hce-fund-stats strong { font-size: 17px; }
}

/* Fit the selected fund label; keep a constant 8px text-to-chevron gap. */
@media screen {
  .hce.hce .hce-fund-nav-wrap { position: relative; display: inline-block; flex: 0 0 auto; font-size: 12px; font-weight: 600; line-height: 1.4; }
  .hce.hce .hce-fund-nav-wrap[data-active=true] { font-weight: 700; }
  .hce.hce .hce-fund-nav-label { display: block; visibility: hidden; white-space: nowrap; padding: 7px 26px 7px 6px; height: 38px; pointer-events: none; }
  .hce.hce .hce-tabs .hce-fund-nav-wrap select.hce-fund-nav {
    position: absolute; inset: 0; width: 100%; height: 100%; padding-right: 26px;
    font: inherit; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4 6 8 10 4' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 6px center; background-size: 12px 12px;
  }
}
@media screen and (max-width: 768px) {
  .hce.hce .hce-fund-nav-wrap { font-size: 16px; }
  .hce.hce .hce-fund-nav-label { height: 44px; }
}

/* Purchase month and payment states: explicit semantic-color exceptions. */
@media screen {
  .hce.hce-view-list .hce-filters > label:has(input[name="month"]) { flex: 0 0 168px; min-width: 168px; }
  .hce.hce-view-list .hce-filters .vi-month-picker-button { padding-inline: 10px 12px; gap: 12px; }
  .hce.hce .hce-pay-label-paid, .hce-overlay.hce-overlay .hce-pay-label-paid,
  .hce.hce .hce-history-table .hce-chip-paid,
  .hce.hce .hce-history-table select.hce-pay-select.is-paid { color: #1f7a34 !important; font-weight: 700; }
  .hce.hce .hce-history-table .hce-chip-unpaid,
  .hce.hce .hce-history-table select.hce-pay-select.is-unpaid { color: #bc2924 !important; font-weight: 700; }
  .hce.hce-view-history .hce-history-table .hce-pay-select-wrap { position: relative; display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 700; line-height: 1.2; }
  .hce.hce-view-history .hce-history-table .hce-pay-select-label { display: block; visibility: hidden; white-space: nowrap; padding: 3px 27px 3px 7px; height: 28px; pointer-events: none; }
  .hce.hce-view-history .hce-history-table .hce-pay-select-wrap select.hce-pay-select {
    position: absolute; inset: 0; width: 100%; min-width: 0; max-width: none; height: 100%; min-height: 28px;
    margin: 0; padding: 3px 26px 3px 6px; font: inherit; text-align: left; text-align-last: left;
    background-position: right 6px center; background-size: 12px 12px;
  }
}
@media screen and (max-width: 768px) {
  .hce.hce-view-list .hce-filters > label:has(input[name="month"]) { flex-basis: auto; min-width: 0; }
  .hce.hce-view-history .hce-history-table .hce-pay-select-wrap { font-size: 16px; }
  .hce.hce-view-history .hce-history-table .hce-pay-select-label { height: 44px; }
  .hce.hce-view-history .hce-history-table .hce-pay-select-wrap select.hce-pay-select { min-height: 44px; }
}

@media screen {
  /* Reserve room for the longer status at the mobile 16px font size. */
  .hce.hce-view-history .hce-history-table col:nth-child(7) { width: 164px !important; }
}

/* Add/edit and voucher detail dialogs: white surfaces, quiet dividers, bronze actions. */
@media screen {
  .hce-overlay .hce-dialog.hce-dialog-editor,
  .hce-overlay .hce-dialog.hce-dialog-detail {
    width: min(1120px, calc(100vw - 40px));
    max-height: min(calc(100dvh - 32px), 920px);
    border: 1px solid #555;
    border-radius: 12px;
    border-top: 1px solid #555;
    background: #fff;
    box-shadow: 0 18px 60px #10182035;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head {
    min-width: 0;
    padding: 14px 20px;
    gap: 12px;
    border-bottom: 1px solid #555;
    background: #fff;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head h2,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head h2 {
    min-width: 0;
    color: #000;
    font-size: 20px;
    line-height: 1.3;
    text-align: left;
    overflow-wrap: anywhere;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head button,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head button {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-color: transparent;
    background: #fff;
    color: #000;
    font-size: 23px;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head button:hover,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head button:hover { background: #f2f4f6; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head button:focus-visible,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head button:focus-visible,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot button:focus-visible,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot button:focus-visible {
    outline: 2px solid #a96f2d;
    outline-offset: 2px;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-body,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-body {
    min-width: 0;
    padding: 14px 20px;
    background: #fff;
    color: #000;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 20px;
    border-top: 1px solid #555;
    background: #fff;
    box-shadow: none;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot button,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot button {
    min-width: 88px;
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid #555;
    border-radius: 7px;
    background: #fff;
    color: #000;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot button:hover,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot button:hover { background: #f3f5f7; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot .hce-primary,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot .hce-primary {
    border-color: #9b6225;
    background: #a96f2d;
    color: #fff !important;
    font-weight: 700;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot .hce-primary:hover,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot .hce-primary:hover { background: #8f5924; }

  /* Flatten editor groups without changing field layout, controls, or visibility. */
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor {
    display: grid;
    gap: 0;
    min-width: 0;
    color: #000;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > .hce-section,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > details.hce-section {
    min-width: 0;
    margin: 0;
    padding: 12px 0 14px;
    border: 0;
    border-bottom: 1px solid #555;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > .hce-section h3,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > details > summary {
    margin: 0 0 10px;
    padding: 0;
    border: 0;
    color: #000;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > details > summary { cursor: pointer; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > details > summary:focus-visible {
    outline: 2px solid #a96f2d;
    outline-offset: 3px;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > .hce-section > .hce-grid,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > details .hce-grid { gap: 10px 14px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor label {
    min-width: 0;
    gap: 4px;
    color: #000;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor select,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor textarea {
    min-width: 0;
    border-color: #555;
    border-radius: 6px;
    background: #fff;
    color: #000;
    font-size: 13px;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor select { height: 38px; padding: 7px 9px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input[type="checkbox"],
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    padding: 0;
    accent-color: #a96f2d;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input:focus-visible,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor select:focus-visible,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor textarea:focus-visible {
    border-color: #a96f2d;
    outline: 2px solid #a96f2d;
    outline-offset: 1px;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor textarea { min-height: 60px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor .hce-value,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor .hce-subtle,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor .hce-alloc-hint { color: #000; text-align: left; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line .hce-total {
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #f4f6f8;
    color: #000;
    font-size: 12px;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-beneficiary-top {
    padding: 10px 0 0;
    border: 0;
    border-top: 1px solid #555;
    border-radius: 0;
    background: #fff;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-beneficiary-top h4 { color: #000; text-align: left; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-entry-general,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-entry-items,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-extra-fields {
    border-top: 0;
    background: #fff;
    color: #000;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-flag {
    display: block;
    padding: 10px 12px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #fff;
    color: #000;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-src {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: center;
    gap: 8px 14px;
    padding: 2px 0;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-caption { margin: 0 0 8px; color: #000; font-size: 13px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-src small {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-requests { border-color: #555; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-src .hce-inline-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 500;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-src small { color: #000; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line {
    min-width: 0;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid #555;
    border-radius: 7px;
    border-top-width: 1px;
    background: #fff;
    box-shadow: none;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-header {
    gap: 8px;
    margin: 0 0 9px;
    padding: 0 0 7px;
    border-bottom: 1px solid #555;
    color: #000;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-supplier,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-departments {
    min-width: 0;
    margin-top: 9px;
    padding: 9px 0 0;
    border: 0;
    border-top: 1px solid #555;
    border-radius: 0;
    background: #fff;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-supplier > .hce-grid { gap: 9px 12px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-requester-options {
    z-index: 30;
    border-color: #555;
    border-radius: 6px;
    background: #fff;
    color: #000;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-requester-options button { min-height: 38px; color: #000; text-align: left; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-requester-options button[aria-selected="true"] { background: #f2f4f6; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-requester-options small,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-requester-empty { color: #000; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-add-line-panel {
    margin: 8px 0 10px;
    padding: 5px;
    border: 1px dashed #555;
    border-radius: 6px;
    background: #fff;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-add-line-panel button {
    min-height: 36px;
    padding: 6px 10px;
    border-color: #a96f2d;
    background: #a96f2d;
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-add-line-panel button:hover { border-color: #8f5924; background: #8f5924; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-summaries {
    display: block;
    min-width: 0;
    margin: 8px 0 0;
    padding: 8px 10px;
    border: 1px solid #555;
    border-radius: 7px;
    background: #fff;
    color: #000;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-summaries h4 {
    margin: 0 0 5px;
    color: #000;
    font-size: 12px;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-summary {
    min-width: 0;
    margin: 0;
    padding: 6px 0;
    border-top: 1px solid #555;
    color: #000;
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-summary > span { min-width: 0; overflow-wrap: anywhere; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-summary > strong {
    min-width: 0;
    margin-left: 10px;
    color: #000;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-summary small { color: #000; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-line-summaries > *:last-child {
    border-right: 0;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-subtle { margin: 8px 0 0; font-size: 12px; line-height: 1.5; }

  /* Detail dialog: metadata, item tables, documents, payments, and expandable history. */
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-state {
    align-items: center;
    gap: 6px 8px;
    margin: 0 0 10px !important;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-payment {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f2f4f6;
    color: #000 !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-payment.is-paid { background: #eaf5ed; color: #176a32 !important; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-payment.is-unpaid { background: #fff0ee; color: #a42620 !important; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-payment.is-partial { background: #fff5df; color: #80520a !important; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0 0 14px;
    overflow: hidden;
    border: 1px solid #555;
    border-radius: 7px;
    background: #fff;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 9px 12px;
    border-right: 1px solid #555;
    background: #fff;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals > div:last-child { border-right: 0; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals span { color: #000; font-size: 11px; line-height: 1.35; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals strong {
    display: block;
    margin: 0;
    color: #000;
    font-size: 16px;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-general,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-items,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-files,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-payments,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-processing-history {
    min-width: 0;
    margin: 0;
    padding: 11px 0 13px;
    border: 0;
    border-bottom: 1px solid #555;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-general h3,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-items h3,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-files h3,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-section.hce-detail-payments h3 {
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    color: #000;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-general > .hce-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px 16px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-general label {
    min-width: 0;
    gap: 2px;
    color: #000;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-general .hce-value {
    min-height: 0;
    color: #000;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    overflow-wrap: anywhere;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-table-wrap {
    max-width: 100%;
    border-color: #555;
    border-radius: 6px;
    background: #fff;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail table { min-width: 680px; font-size: 12px; }
  .hce-overlay .hce-dialog.hce-dialog-detail th,
  .hce-overlay .hce-dialog.hce-dialog-detail td {
    padding: 7px 8px;
    border-color: #555;
    color: #000;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail th { background: #f2f4f6; font-size: 11px; font-weight: 700; white-space: normal; }
  .hce-overlay .hce-dialog.hce-dialog-detail td.hce-money,
  .hce-overlay .hce-dialog.hce-dialog-detail th.hce-money { text-align: right; white-space: nowrap; }
  .hce-overlay .hce-dialog.hce-dialog-detail td small { display: block; color: #000; font-size: 11px; line-height: 1.4; }
  /* Keep the native upload controls together without changing their markup. */
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row {
    grid-template-columns: minmax(140px, .9fr) minmax(148px, .8fr) minmax(0, 1.4fr) auto;
    align-items: end;
    gap: 10px 12px;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row > label {
    min-width: 0;
    gap: 4px;
    color: #000;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row > .hce-span2 { grid-column: auto; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row input,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row select {
    min-width: 0;
    height: 38px;
    padding: 7px 9px;
    font-size: 13px;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row input[type="file"] {
    max-width: 100%;
    padding: 4px;
    font-size: 12px;
    line-height: 1.35;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row input[type="file"]::file-selector-button {
    height: 28px;
    margin-right: 8px;
    padding: 3px 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #fff;
    color: #000;
    font: inherit;
    cursor: pointer;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row > [data-upload] {
    align-self: end;
    min-width: 88px;
    min-height: 38px;
    padding: 7px 12px;
    font-size: 13px;
    line-height: 1.35;
    white-space: nowrap;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-file { border-bottom-color: #555; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-docs:not(:empty) {
    margin: 0 0 8px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid #555;
    border-radius: 0;
    background: #fff;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-docs h4 { color: #000; text-align: left; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-doc { gap: 8px; text-align: left; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-doc strong { color: #000; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-processing-history > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    cursor: pointer;
    list-style: none;
    color: #000;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-processing-history > summary::-webkit-details-marker { display: none; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-processing-history > summary::before {
    content: '›';
    flex: 0 0 12px;
    width: 12px;
    color: #000;
    font-size: 22px;
    line-height: 1;
    text-align: left;
    transition: transform .15s ease;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-processing-history[open] > summary::before { transform: rotate(90deg); }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-processing-history > summary:focus-visible {
    outline: 2px solid #a96f2d;
    outline-offset: 2px;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history-toggle-title { min-width: 0; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history-count { margin-left: auto; color: #000; font-size: 11px; font-weight: 500; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history {
    max-height: 260px;
    margin: 4px 0 0 4px;
    padding: 6px 0 0 10px;
    overflow: auto;
    border-left: 1px solid #555;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history li {
    margin: 0 0 7px;
    padding: 2px 0 7px 8px;
    border-left: 0;
    border-bottom: 1px solid #555;
    color: #000;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history li:last-child { margin-bottom: 0; border-bottom: 0; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history .hce-subtle { color: #000; font-size: 11px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history:focus-visible { outline: 2px solid #a96f2d; outline-offset: 2px; }
}

@media screen and (max-width: 900px) {
  .hce-overlay .hce-dialog.hce-dialog-editor,
  .hce-overlay .hce-dialog.hce-dialog-detail { width: min(100%, calc(100vw - 24px)); }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-general > .hce-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 768px) {
  .hce-overlay .hce-dialog.hce-dialog-editor,
  .hce-overlay .hce-dialog.hce-dialog-detail {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 16px 16px 0 0;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head { padding: 10px 14px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head button,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head button {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-body,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-body { padding: 12px 14px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot {
    justify-content: stretch;
    padding: 9px 14px calc(9px + env(safe-area-inset-bottom, 0px));
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot button,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot button {
    flex: 1 1 calc(50% - 8px);
    min-width: 44px;
    min-height: 44px;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > .hce-section,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > details.hce-section { padding-block: 10px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > .hce-section > .hce-grid,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor > details .hce-grid { gap: 9px 10px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor select,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor textarea,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor .vi-month-picker-button { min-height: 44px; font-size: 16px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input[type="checkbox"],
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor input[type="radio"] { min-height: 18px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-expense-editor .hce-inline-check { min-height: 44px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-requester-options button,
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-add-line-panel button { min-height: 44px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-src {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-fund-src small { padding-left: 26px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row input,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row select,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row > [data-upload] { height: 44px; min-height: 44px; font-size: 16px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row input[type="file"] { font-size: 13px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row input[type="file"]::file-selector-button { height: 34px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-beneficiary-top .hce-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-processing-history > summary { min-height: 44px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals { grid-template-columns: 1fr; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals > div { padding: 7px 10px; border-right: 0; border-bottom: 1px solid #555; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-totals > div:last-child { border-bottom: 0; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-general > .hce-grid { grid-template-columns: 1fr; }
  .hce-overlay .hce-dialog.hce-dialog-detail table { min-width: 680px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-history { max-height: 34dvh; }
}

@media screen and (max-width: 480px) {
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-head,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-head { padding-inline: 12px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-body,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-body { padding: 10px 12px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-dialog-foot,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-dialog-foot { padding-inline: 12px; }
  .hce-overlay .hce-dialog.hce-dialog-editor .hce-beneficiary-top .hce-grid-three { grid-template-columns: 1fr; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-upload-row { grid-template-columns: minmax(0, 1fr); }
}

/* Distinguish saved payment requests from office-fund badges. */
.hce.hce .hce-fund-tag.hce-request-tag-payment { color:#1f7a34 !important; background:#e7f5eb; border-color:#9bd0a7; }

/* Expense detail: distinct linked documents, without the payment transaction table. */
@media screen {
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-docs:not(:empty) { padding: 0; margin: 0; border: 0; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-doc { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-top: 8px; padding: 12px; border: 1px solid #555; border-radius: 8px; background: #fffdf9; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-doc-kind { padding: 6px; border: 1px solid #d5b58b; border-radius: 6px; background: #f7eddb; color: #805723; font-size: 12px; font-weight: 700; text-align: center; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-doc-content { min-width: 0; overflow-wrap: anywhere; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-doc-content strong { display: block; font-size: 14px; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-doc-meta { margin-top: 4px; font-size: 12px; line-height: 1.5; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-doc button { white-space: nowrap; min-height: 36px; font-weight: 600; }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-doc-empty { margin: 0; padding: 14px; border: 1px dashed #555; border-radius: 8px; font-size: 13px; }
}
@media screen and (max-width: 600px) {
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-doc { grid-template-columns: 64px minmax(0, 1fr); }
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-voucher-doc button { grid-column: 2; justify-self: start; }
}

/* Center the expense detail goods table, including monetary cells. */
@media screen {
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-items th,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-items td,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-items td.hce-money,
  .hce-overlay .hce-dialog.hce-dialog-detail .hce-detail-items .hce-link {
    text-align: center;
    vertical-align: middle;
  }
}

/* One recipient per line in the expense ledger. */
.hce-ledger [data-customer-recipient] .hce-recipient-name { display: block; white-space: nowrap; text-align: center; }

/* Tổng hợp (làm lại 10/2026): thanh lọc gọn, thẻ số liệu, biểu đồ cột chồng theo hạng mục, bảng chi tiết theo kỳ.
   Chữ giữ màu đen theo quy ước của mục chi phí; màu chỉ dùng cho cột, thanh tỷ lệ và nền nhãn tăng/giảm. */
.hce-ov { display: grid; gap: 16px; }
.hce-ov-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #eadfcf; }
.hce-ov-head h3 { margin: 0; font-size: 22px; font-weight: 800; }
.hce-ov-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.hce-ov-main { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.hce .hce-ov-toolbar label { display: grid; align-content: end; gap: 4px; width: 220px; max-width: 100%; margin: 0; font-size: 12px; font-weight: 700; text-align: left; }
.hce .hce-ov-toolbar input, .hce .hce-ov-toolbar select { height: 40px; min-height: 40px; margin: 0; text-align: left; }
.hce-ov-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hce-ov-kpi, .hce-ov-card { min-width: 0; padding: 14px 16px; border: 1px solid #e3d3bd; border-radius: 14px; background: #fff; }
.hce-ov-kpi > span { display: block; font-size: 12.5px; font-weight: 700; }
.hce-ov-kpi strong { display: block; margin-top: 6px; font-size: 24px; font-weight: 800; line-height: 1.15; white-space: nowrap; }
.hce-ov-kpi p { margin: 8px 0 0; font-size: 12.5px; }
.hce-ov-kpi small { display: block; margin-top: 4px; font-size: 12px; opacity: .75; }
.hce-ov-card h4, .hce-ov-scope h4 { margin: 0; font-size: 15px; font-weight: 800; }
.hce-ov-card-head, .hce-ov-scope { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.hce-ov-scope { margin-top: 4px; }
.hce-ov-seg { display: inline-flex; padding: 3px; border: 1px solid #e3d3bd; border-radius: 999px; background: #faf6ef; }
.hce .hce-ov-seg button { min-height: 30px; padding: 4px 14px; border: 0; border-radius: 999px; background: transparent; font-size: 12.5px; font-weight: 700; cursor: pointer; box-shadow: none; }
.hce .hce-ov-seg button[aria-pressed="true"] { background: #ead6b6; }
.hce-ov-chart-wrap { margin-top: 8px; overflow-x: auto; }
.hce-ov-svg { display: block; width: 100%; min-width: 560px; height: auto; }
.hce-ov-gridline { stroke: #eee5d8; stroke-width: 1; }
.hce-ov-axis { font-size: 12px; fill: #5c5146; }
.hce-ov-value { font-size: 12px; font-weight: 700; fill: #2b241d; }
.hce-ov-strong { font-weight: 800; fill: #000; }
.hce-ov-current { fill: #f6eddf; }
.hce-ov-ytd { stroke: #000; stroke-width: 3; }
.hce-ov-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: 12.5px; }
.hce-ov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hce-ov-legend i, .hce-ov-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hce-ov-note { margin: 6px 0 0; font-size: 12px; }
.hce-ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hce-ov-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.hce-ov-table th { padding: 6px 8px; border-bottom: 1px solid #eadfcf; font-size: 11.5px; font-weight: 700; text-align: left; white-space: nowrap; background: none; }
.hce-ov-table td { padding: 7px 8px; border-bottom: 1px solid #f3ece2; vertical-align: middle; }
.hce-ov-table tr:last-child td { border-bottom: 0; }
.hce .hce-ov-table th, .hce .hce-ov-table td { text-align: left; }
.hce .hce-ov-table .hce-money, .hce .hce-ov-table .hce-ov-change { text-align: right; white-space: nowrap; }
.hce-ov-table td.hce-money small, .hce-ov-name small { display: block; margin-top: 2px; font-size: 11.5px; opacity: .7; }
.hce-ov-name > span, .hce .hce-ov-expand { font-weight: 700; }
.hce-ov-dot { margin-right: 8px; vertical-align: middle; }
.hce .hce-ov-expand { min-height: 0; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; text-align: left; cursor: pointer; box-shadow: none; }
/* mobile.css sets every button to 16px !important (iOS zoom guard, needed for inputs only). */
.hce .hce-ov-expand { display: inline; width: auto; font-size: 13px !important; }
.hce .hce-ov-seg button { font-size: 13px !important; }
.hce-ov-expand::after { content: ' ▸'; font-size: 11px; }
.hce-ov-expand[aria-expanded="true"]::after { content: ' ▾'; }
.hce-ov-sub td { background: #fcf9f4; font-size: 12.5px; }
.hce-ov-sub .hce-ov-name { padding-left: 26px; }
.hce-ov-barcell { width: 32%; }
.hce-ov-categories .hce-ov-barcell { width: 22%; }
.hce-ov-bar { display: block; height: 8px; overflow: hidden; border-radius: 99px; background: #f1e9dd; }
.hce-ov-bar i { display: block; height: 100%; border-radius: 99px; background: #b88949; }
.hce-ov-rank { width: 28px; font-weight: 800; text-align: center; }
.hce-ov-change { text-align: right; white-space: nowrap; }
.hce-ov-delta { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #f1ece4; font-size: 12px; font-weight: 700; white-space: nowrap; }
.hce-ov-up { background: #fbe0db; }
.hce-ov-down { background: #dcf0e2; }
.hce-ov-new { background: #e7e2f2; }
.hce-ov-period { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px dashed #d8c4a6; border-radius: 12px; font-size: 13px; }
@media (max-width: 1100px) {
    .hce-ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hce-ov-grid, .hce-ov-main { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .hce-ov-kpis { grid-template-columns: 1fr; }
    .hce-ov-kpi strong { font-size: 21px; }
    .hce-ov-barcell { display: none; }
    .hce-ov-svg { min-width: 660px; }
    .hce-ov-toolbar label { flex: 1 1 140px; width: auto; }
}

/* Bảng chi phí có màu theo ý nghĩa (13/10/2026, nhân sự góp ý bảng đơn điệu, mỏi mắt):
   nhóm cột (thông tin / chi tiết giá / phân bổ), hạng mục + phòng chịu chi phí có màu nhận diện cố định,
   VAT thành nhãn, khoản chi xen kẽ nền nhạt, dải số tổng mỗi số một màu. Chữ giữ tương phản >= 4.5:1. */
@media screen {
  .hce {
    --hce-t0-bg:#fff1d6;--hce-t0-fg:#7a4a00;--hce-t0-bd:#f0cf8f;
    --hce-t1-bg:#e3eefc;--hce-t1-fg:#1d4f91;--hce-t1-bd:#b9d0f0;
    --hce-t2-bg:#e4f4e7;--hce-t2-fg:#1f6b33;--hce-t2-bd:#b7dcc0;
    --hce-t3-bg:#fde8ec;--hce-t3-fg:#a1243f;--hce-t3-bd:#f2b8c5;
    --hce-t4-bg:#efe9fb;--hce-t4-fg:#5b3aa0;--hce-t4-bd:#d2c4f0;
    --hce-t5-bg:#e0f4f2;--hce-t5-fg:#0f6b62;--hce-t5-bd:#ade0d9;
    --hce-t6-bg:#ffeadd;--hce-t6-fg:#a14a12;--hce-t6-bd:#f5c3a2;
    --hce-t7-bg:#e9eef3;--hce-t7-fg:#374b5e;--hce-t7-bd:#c5d1dc;
  }
  /* Dải số tổng */
  .hce.hce-view-list .hce-kpis { gap: 8px; }
  .hce.hce-view-list .hce-kpi { padding: 6px 12px 6px 10px; border: 1px solid; border-left-width: 4px; border-radius: 8px; }
  .hce.hce-view-list .hce-kpi .hce-subtle { color: inherit; font-size: 11.5px; font-weight: 600; }
  .hce.hce-view-list .hce-kpi strong { color: inherit; font-size: 16px; }
  .hce.hce-view-list .hce-kpi.hce-kpi-tone-0 { background: var(--hce-t1-bg); border-color: var(--hce-t1-bd); border-left-color: var(--hce-t1-fg); color: var(--hce-t1-fg); }
  .hce.hce-view-list .hce-kpi.hce-kpi-tone-1 { background: var(--hce-t2-bg); border-color: var(--hce-t2-bd); border-left-color: var(--hce-t2-fg); color: var(--hce-t2-fg); }
  .hce.hce-view-list .hce-kpi.hce-kpi-tone-2 { background: var(--hce-t7-bg); border-color: var(--hce-t7-bd); border-left-color: var(--hce-t7-fg); color: var(--hce-t7-fg); }
  .hce.hce-view-list .hce-kpi.hce-kpi-tone-2.hce-kpi-nonzero { background: var(--hce-t6-bg); border-color: var(--hce-t6-bd); border-left-color: var(--hce-t6-fg); color: var(--hce-t6-fg); }
  .hce.hce-view-list .hce-kpi.hce-kpi-tone-3 { background: var(--hce-t7-bg); border-color: var(--hce-t7-bd); border-left-color: var(--hce-t7-fg); color: var(--hce-t7-fg); }
  .hce.hce-view-list .hce-kpi.hce-kpi-tone-3.hce-kpi-nonzero { background: var(--hce-t3-bg); border-color: var(--hce-t3-bd); border-left-color: var(--hce-t3-fg); color: var(--hce-t3-fg); }

  /* Tiêu đề theo nhóm cột */
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th { background: #f3eadb; color: #4a3216; }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-head-price { background: #cfe0f6; color: #143a6b; }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-head-price-sub { background: #e6effb; color: #143a6b; }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-head-alloc { background: #d2ecd8; color: #1a5229; }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-ledger-index { background: #efe3cf; }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head { font-size: 11px; }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-0 { background: var(--hce-t0-bg); color: var(--hce-t0-fg); }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-1 { background: var(--hce-t1-bg); color: var(--hce-t1-fg); }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-2 { background: var(--hce-t2-bg); color: var(--hce-t2-fg); }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-3 { background: var(--hce-t3-bg); color: var(--hce-t3-fg); }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-4 { background: var(--hce-t4-bg); color: var(--hce-t4-fg); }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-5 { background: var(--hce-t5-bg); color: var(--hce-t5-fg); }
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-6 { background: var(--hce-t6-bg); color: var(--hce-t6-fg); }

  /* Thân bảng: khoản chi xen kẽ, cột giá tông xanh dương, rê chuột tô vàng nhạt */
  .hce.hce-view-list .hce-ledger-full tbody tr.hce-voucher-alt td { background: #fbf7f0; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-price-col { background: #f5f9ff; }
  .hce.hce-view-list .hce-ledger-full tbody tr.hce-voucher-alt td.hce-price-col { background: #edf3fc; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-price-actual { color: #143a6b; font-weight: 700; }
  .hce.hce-view-list .hce-ledger-full .hce-ledger-index { background: #f6efe4; color: #4a3216; font-weight: 600; }
  .hce.hce-view-list .hce-ledger-full tbody tr:hover td:not(.hce-allocation-filled) { background: #fff3d6; }
  .hce.hce-view-list .hce-ledger-full .hce-allocation-cell:not(.hce-allocation-filled) { background: transparent; }
  /* Một đường kẻ duy nhất giữa các phiếu (nền xen kẽ đã phân biệt phiếu) */
  .hce.hce-view-list .hce-ledger-full .hce-voucher-start td { border-top: 0; }
  .hce.hce-view-list .hce-ledger-full tfoot :is(th,td) { border-top-color: #555; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled { background: #d6edd9; color: #1a5229; box-shadow: none; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-0 { background: var(--hce-t0-bg); color: var(--hce-t0-fg); box-shadow: none; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-1 { background: var(--hce-t1-bg); color: var(--hce-t1-fg); box-shadow: none; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-2 { background: var(--hce-t2-bg); color: var(--hce-t2-fg); box-shadow: none; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-3 { background: var(--hce-t3-bg); color: var(--hce-t3-fg); box-shadow: none; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-4 { background: var(--hce-t4-bg); color: var(--hce-t4-fg); box-shadow: none; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-5 { background: var(--hce-t5-bg); color: var(--hce-t5-fg); box-shadow: none; }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-6 { background: var(--hce-t6-bg); color: var(--hce-t6-fg); box-shadow: none; }

  /* Hạng mục, phòng chịu chi phí, VAT */
  .hce.hce-view-list .hce-ledger-full .hce-cat-name { display: inline-block; padding: 1px 8px; border-radius: 6px; border: 1px solid transparent; }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-0 .hce-cat-name { background: var(--hce-t0-bg); color: var(--hce-t0-fg); border-color: var(--hce-t0-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-1 .hce-cat-name { background: var(--hce-t1-bg); color: var(--hce-t1-fg); border-color: var(--hce-t1-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-2 .hce-cat-name { background: var(--hce-t2-bg); color: var(--hce-t2-fg); border-color: var(--hce-t2-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-3 .hce-cat-name { background: var(--hce-t3-bg); color: var(--hce-t3-fg); border-color: var(--hce-t3-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-4 .hce-cat-name { background: var(--hce-t4-bg); color: var(--hce-t4-fg); border-color: var(--hce-t4-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-5 .hce-cat-name { background: var(--hce-t5-bg); color: var(--hce-t5-fg); border-color: var(--hce-t5-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-6 .hce-cat-name { background: var(--hce-t6-bg); color: var(--hce-t6-fg); border-color: var(--hce-t6-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-cat-tone-7 .hce-cat-name { background: var(--hce-t7-bg); color: var(--hce-t7-fg); border-color: var(--hce-t7-bd); }
  .hce.hce-view-list .hce-ledger-full .hce-ledger-subcategory { display: block; margin-top: 3px; }
  .hce.hce-view-list .hce-dept-line { color: #4a4540; }
  .hce .hce-card-tags .hce-dept-pill { padding: 2px 8px; border-radius: 14px; font-size: 11px; }
  .hce .hce-dept-pill { display: inline-block; padding: 0 6px; border-radius: 5px; border: 1px solid transparent; font-weight: 600; line-height: 1.45; }
  .hce .hce-dept-pill.hce-dept-tone-0 { background: var(--hce-t0-bg); color: var(--hce-t0-fg); border-color: var(--hce-t0-bd); }
  .hce .hce-dept-pill.hce-dept-tone-1 { background: var(--hce-t1-bg); color: var(--hce-t1-fg); border-color: var(--hce-t1-bd); }
  .hce .hce-dept-pill.hce-dept-tone-2 { background: var(--hce-t2-bg); color: var(--hce-t2-fg); border-color: var(--hce-t2-bd); }
  .hce .hce-dept-pill.hce-dept-tone-3 { background: var(--hce-t3-bg); color: var(--hce-t3-fg); border-color: var(--hce-t3-bd); }
  .hce .hce-dept-pill.hce-dept-tone-4 { background: var(--hce-t4-bg); color: var(--hce-t4-fg); border-color: var(--hce-t4-bd); }
  .hce .hce-dept-pill.hce-dept-tone-5 { background: var(--hce-t5-bg); color: var(--hce-t5-fg); border-color: var(--hce-t5-bd); }
  .hce .hce-dept-pill.hce-dept-tone-6 { background: var(--hce-t6-bg); color: var(--hce-t6-fg); border-color: var(--hce-t6-bd); }
  .hce .hce-vat-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid; }
  .hce .hce-vat-pill.hce-vat-in { background: var(--hce-t5-bg); color: var(--hce-t5-fg); border-color: var(--hce-t5-bd); }
  .hce .hce-vat-pill.hce-vat-out { background: var(--hce-t0-bg); color: var(--hce-t0-fg); border-color: var(--hce-t0-bd); }

  /* Dòng tổng */
  .hce.hce-view-list .hce-ledger-full tfoot :is(th,td) { background: #efe3cf; color: #3a2711; }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total { background: #f6efe2; }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-0 { color: var(--hce-t0-fg); }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-1 { color: var(--hce-t1-fg); }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-2 { color: var(--hce-t2-fg); }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-3 { color: var(--hce-t3-fg); }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-4 { color: var(--hce-t4-fg); }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-5 { color: var(--hce-t5-fg); }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-6 { color: var(--hce-t6-fg); }
}

/* Phúc lợi nhân sự trên dòng phiếu chi (14/10/2026): Thưởng nhân sự / Chế độ hiếu hỉ – ốm đau. */
.hce-expense-editor .hce-line-welfare{margin-top:14px;background:#f6effb;border:1px solid #d9c7ea;border-left:3px solid #6b3fa0;border-radius:9px;padding:14px}
.hce-expense-editor .hce-line-welfare>strong{display:block;margin-bottom:8px;color:#4a2a73}
.hce-expense-editor .hce-welfare-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}
.hce-expense-editor .hce-welfare-tools button,.hce-expense-editor .hce-welfare-remove{padding:7px 12px;border:1px solid #b9a0d6;border-radius:8px;background:#fff;color:#4a2a73;font-weight:600;cursor:pointer}
.hce-expense-editor .hce-welfare-recipients{display:grid;gap:8px;margin-top:10px}
.hce-expense-editor .hce-welfare-recipient{display:grid;grid-template-columns:minmax(0,2fr) minmax(120px,1fr) auto;gap:8px;align-items:end;padding:8px;border:1px solid #e3d6f0;border-radius:8px;background:#fff}
.hce-expense-editor .hce-welfare-remove{color:#9b2c2c;border-color:#e2b4b4}
.hce-expense-editor .hce-welfare-sum{margin:10px 0 0;font-weight:700;color:#4a2a73}
.hce-expense-editor .hce-welfare-locked input{background:#efe7f8;color:#4a2a73;font-weight:700}
@media(max-width:600px){.hce-expense-editor .hce-line-welfare{padding:11px}.hce-expense-editor .hce-welfare-recipient{grid-template-columns:1fr 1fr}.hce-expense-editor .hce-welfare-recipient label:first-child{grid-column:1/-1}}
.hce .hce-welfare-line{display:block;margin-top:4px}
.hce .hce-welfare-pill{display:inline-block;padding:0 7px;border-radius:999px;border:1px solid;font-size:11px;font-weight:700;line-height:1.5;white-space:nowrap}
.hce .hce-welfare-pill.hce-welfare-bonus{background:#fff1d6;color:#7a4a00;border-color:#f0cf8f}
.hce .hce-welfare-pill.hce-welfare-regime{background:#f3e8ff;color:#5b2c8f;border-color:#d8bdf5}
.hce-expense-editor .hce-line-welfare .hce-subtle{margin:0 0 8px;font-size:12px}

/* "+ Thêm khoản thưởng" (14/10/2026) */
.hce .hce-bonus-new{border:1px solid #b9a0d6;background:#f6effb;color:#4a2a73;font-weight:700}
.hce-bonus-entry .hce-bonus-toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-bottom:10px}
.hce-bonus-entry .hce-bonus-toolbar label{flex:1 1 180px}
.hce-bonus-entry .hce-bonus-toolbar button{padding:8px 12px;border:1px solid #b9a0d6;border-radius:8px;background:#fff;color:#4a2a73;font-weight:600;cursor:pointer}
.hce-bonus-entry .hce-bonus-table{max-height:52vh;overflow:auto}
.hce-bonus-entry .hce-bonus-table table{width:100%;border-collapse:collapse}
.hce-bonus-entry .hce-bonus-table th{position:sticky;top:0;background:#efe3cf;z-index:1}
.hce-bonus-entry .hce-bonus-table th,.hce-bonus-entry .hce-bonus-table td{padding:6px 8px;border-bottom:1px solid #d9cdb8;text-align:left}
.hce-bonus-entry .hce-bonus-table tr[data-bonus-person]{cursor:pointer}
.hce-bonus-entry .hce-bonus-table tr.is-picked td{background:#f6effb}
.hce-bonus-entry .hce-bonus-table input[name=bonusAmount]{width:140px;text-align:right}
.hce-bonus-entry .hce-bonus-table input[name=bonusAmount]:disabled{background:transparent;border-color:transparent}
.hce-bonus-entry .hce-bonus-paid{align-self:end}
@media(max-width:600px){.hce-bonus-entry .hce-bonus-table th:nth-child(4),.hce-bonus-entry .hce-bonus-table td:nth-child(4){display:none}.hce-bonus-entry .hce-bonus-table input[name=bonusAmount]{width:110px}}
.hce-bonus-entry .hce-bonus-dntt{display:flex;flex-direction:column;gap:4px;align-self:end}
.hce-bonus-entry .hce-bonus-dntt button{padding:9px 14px;border:1px solid #b88949;border-radius:8px;background:#fff7ea;color:#6b4316;font-weight:700;cursor:pointer}

/* Hạng mục "Chế độ hiếu hỉ – ốm đau" (14/10/2026): Chế độ thay Tên hàng hóa, Thực chi đưa lên, dòng dưới Nội dung cụ thể;
   ẩn ĐVT / SL / giá / VAT / hóa đơn và phần Nhà cung cấp, GIỮ khu Nguồn tiền (data-fund-slot nằm trong phần NCC). */
.hce-expense-editor .hce-line:not(.hce-line-regime) .hce-regime-field{display:none}
.hce-expense-editor .hce-line-regime [data-subcategory-field],
.hce-expense-editor .hce-line-regime>.hce-grid>label:has(>[name=description]),
.hce-expense-editor .hce-line-regime>.hce-grid>label:has(>[name=unit]),
.hce-expense-editor .hce-line-regime>.hce-grid>label:has(>[name=quantity]),
.hce-expense-editor .hce-line-regime>.hce-grid>label:has(>[name=listPrice]),
.hce-expense-editor .hce-line-regime>.hce-grid>label:has(>[name=unitPrice]),
.hce-expense-editor .hce-line-regime>.hce-grid>label:has(>[name=vatIncluded]),
.hce-expense-editor .hce-line-regime [data-line-invoice],
.hce-expense-editor .hce-line-regime .hce-line-supplier>strong,
.hce-expense-editor .hce-line-regime .hce-line-supplier>.hce-grid>label,
.hce-expense-editor .hce-line-regime .hce-line-supplier [data-pay-state-box]{display:none!important}
.hce-expense-editor .hce-line-regime>.hce-grid>label:first-child{order:1}
.hce-expense-editor .hce-line-regime [data-regime-select]{order:2}
.hce-expense-editor .hce-line-regime>.hce-grid>.hce-actual-paid{order:3}
.hce-expense-editor .hce-line-regime [data-regime-detail]{order:4;grid-column:1/-1}
.hce-expense-editor .hce-line-regime .hce-line-supplier{border-top:0;padding-top:0;margin-top:6px;background:transparent;border:0}
/* NCC + thanh toán dùng chung cho phiếu (22/10/2026): nằm dưới "+ Thêm dòng", chứa Nguồn tiền. Phiếu toàn dòng chế độ hiếu hỉ – ốm đau
   ẩn phần NCC như trong dòng, giữ Nguồn tiền. */
.hce-expense-editor .hce-voucher-supplier{margin:0 0 16px}
.hce-expense-editor .hce-voucher-supplier>.hce-line-supplier{margin-top:0}
.hce-expense-editor .hce-voucher-supplier.is-regime .hce-line-supplier>strong,
.hce-expense-editor .hce-voucher-supplier.is-regime .hce-line-supplier>.hce-grid>label,
.hce-expense-editor .hce-voucher-supplier.is-regime .hce-line-supplier [data-pay-state-box]{display:none!important}
.hce-expense-editor .hce-voucher-supplier.is-regime .hce-line-supplier{padding-top:0;background:transparent;border:0}
.hce-expense-editor .hce-regime-field label{display:block}

/* "+ Thêm khoản thưởng" làm lại (14/10/2026): lưới 3 cột thẳng hàng, bảng người nhận gom theo phòng, tổng ở chân màn. */
.hce-dialog-bonus{width:min(1080px,calc(100vw - 32px))}
.hce-bonus-entry{display:grid;gap:14px}
.hce-bonus-entry .hce-bonus-card{border:1px solid #e3d6c2;border-radius:12px;background:#fffdf9;padding:14px 16px}
.hce-bonus-entry .hce-bonus-card>header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.hce-bonus-entry .hce-bonus-card>header h3{margin:0;font-size:15px}
.hce-bonus-entry .hce-bonus-scope{padding:3px 10px;border-radius:999px;background:#eef1f4;color:#334155;border:1px solid #cbd5e1;font-size:12px;font-weight:700;white-space:nowrap}
.hce-bonus-entry .hce-bonus-count{color:#4a2a73;font-weight:700;font-size:13px}
.hce-bonus-entry .hce-bonus-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 16px;align-items:start}
.hce-bonus-entry .hce-bonus-span2{grid-column:span 2}
.hce-bonus-entry .hce-bonus-grid label,.hce-bonus-entry .hce-bonus-toolbar label{display:flex;flex-direction:column;gap:6px;margin:0;min-width:0}
.hce-bonus-entry .hce-bonus-grid input,.hce-bonus-entry .hce-bonus-grid select,.hce-bonus-entry .hce-bonus-toolbar input{width:100%;box-sizing:border-box;min-height:42px}
.hce-bonus-entry .hce-bonus-cell{display:flex;flex-direction:column;gap:6px;min-width:0}
.hce-bonus-entry .hce-bonus-cell small,.hce-bonus-entry .hce-bonus-dntt small{font-size:12px;line-height:1.35}
.hce-bonus-entry label.hce-bonus-paid{flex-direction:row;align-items:center;gap:8px;align-self:end;min-height:42px;padding:0 12px;border:1px solid #e3d6c2;border-radius:8px;background:#fff;cursor:pointer}
.hce-bonus-entry label.hce-bonus-paid input{width:18px;height:18px;min-height:0;margin:0}
.hce-bonus-entry label.hce-bonus-paid:has(input:disabled){opacity:.55;cursor:not-allowed}
.hce-bonus-entry .hce-bonus-dntt{display:flex;flex-direction:column;gap:4px;align-self:end}
.hce-bonus-entry .hce-bonus-dntt button{min-height:42px;padding:0 14px;border:1px solid #b88949;border-radius:8px;background:#fff7ea;color:#6b4316;font-weight:700;cursor:pointer}
.hce-bonus-entry .hce-bonus-toolbar{display:grid;grid-template-columns:minmax(0,2fr) minmax(140px,1fr) auto auto;gap:10px;align-items:end;margin-bottom:10px}
.hce-bonus-entry .hce-bonus-toolbar button{min-height:42px;padding:0 14px;border:1px solid #b9a0d6;border-radius:8px;background:#fff;color:#4a2a73;font-weight:600;cursor:pointer;white-space:nowrap}
.hce-bonus-entry .hce-bonus-each input{text-align:right}
.hce-bonus-entry .hce-bonus-table{max-height:46vh;overflow:auto;border:1px solid #e3d6c2;border-radius:10px}
.hce-bonus-entry .hce-bonus-table table{width:100%;border-collapse:collapse;table-layout:fixed}
.hce-bonus-entry .hce-bonus-col-pick{width:44px}.hce-bonus-entry .hce-bonus-col-dept{width:24%}.hce-bonus-entry .hce-bonus-col-branch{width:18%}.hce-bonus-entry .hce-bonus-col-amount{width:170px}
.hce-bonus-entry .hce-bonus-table th{position:sticky;top:0;z-index:1;background:#efe3cf;color:#3d2f1c;font-size:12px;text-transform:none;padding:9px 10px;text-align:left;border-bottom:1px solid #d9cdb8}
.hce-bonus-entry .hce-bonus-table td{padding:7px 10px;border-bottom:1px solid #eee3d3;text-align:left;vertical-align:middle;overflow:hidden;text-overflow:ellipsis}
.hce-bonus-entry .hce-bonus-table .hce-money{text-align:right}
.hce-bonus-entry .hce-bonus-table tr[data-bonus-person]{cursor:pointer}
.hce-bonus-entry .hce-bonus-table tr[data-bonus-person]:hover td{background:#fff3d6}
.hce-bonus-entry .hce-bonus-table tr.is-picked td{background:#f6effb}
.hce-bonus-entry .hce-bonus-table tr.hce-bonus-group td{background:#f8f3ea;color:#6b4316;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.02em;padding:6px 10px;cursor:default}
.hce-bonus-entry .hce-bonus-table tr.hce-bonus-group small{font-weight:600;color:#8a7356}
.hce-bonus-entry .hce-bonus-table input[type=checkbox]{width:18px;height:18px;margin:0}
.hce-bonus-entry .hce-bonus-table input[name=bonusAmount]{width:100%;min-height:34px;text-align:right;font-weight:700}
.hce-bonus-entry .hce-bonus-empty{text-align:center!important;padding:18px!important}
.hce-dialog-bonus .hce-bonus-total{margin-right:auto;display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.hce-dialog-bonus .hce-bonus-total strong{font-size:18px;color:#4a2a73}
.hce-dialog-bonus .hce-bonus-total em{font-style:normal;color:#9b2c2c;font-size:12px;font-weight:700}
.hce-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@media(max-width:760px){.hce-bonus-entry .hce-bonus-grid{grid-template-columns:1fr}.hce-bonus-entry .hce-bonus-span2{grid-column:auto}.hce-bonus-entry .hce-bonus-toolbar{grid-template-columns:1fr 1fr}.hce-bonus-entry .hce-bonus-search{grid-column:1/-1}.hce-bonus-entry .hce-bonus-col-dept{width:34%}.hce-bonus-entry .hce-bonus-col-amount{width:120px}.hce-bonus-entry .hce-bonus-table tr[data-bonus-person] td:nth-child(3){font-size:12px}.hce-bonus-entry .hce-bonus-card{padding:12px}}
.hce-bonus-entry [hidden]{display:none!important}
.hce-bonus-entry .hce-bonus-table tr.hce-bonus-group small{display:inline;margin-left:4px}
@media(max-width:760px){
  .hce-bonus-entry .hce-bonus-toolbar{grid-template-columns:1fr 1fr}
  .hce-bonus-entry .hce-bonus-toolbar .hce-bonus-search,.hce-bonus-entry .hce-bonus-toolbar .hce-bonus-each{grid-column:1/-1}
  .hce-bonus-entry .hce-bonus-toolbar button{white-space:normal;line-height:1.2;padding:6px 10px}
  .hce-bonus-entry .hce-bonus-table table{table-layout:auto}
  .hce-bonus-entry .hce-bonus-table col{width:auto!important}
  .hce-bonus-entry .hce-bonus-table th:nth-child(3),.hce-bonus-entry .hce-bonus-table th:nth-child(4),
  .hce-bonus-entry .hce-bonus-table tr[data-bonus-person] td:nth-child(3),.hce-bonus-entry .hce-bonus-table tr[data-bonus-person] td:nth-child(4){display:none}
  .hce-bonus-entry .hce-bonus-table th:first-child,.hce-bonus-entry .hce-bonus-table tr[data-bonus-person] td:first-child{width:36px;padding-right:0}
  .hce-bonus-entry .hce-bonus-table td:last-child,.hce-bonus-entry .hce-bonus-table th:last-child{width:120px}
  .hce-bonus-entry .hce-bonus-table td{white-space:normal}
}
/* Căn thẳng hàng (14/10/2026): mọi ô trong lưới cùng cấu trúc nhãn trên + ô cao 44px; bỏ chú thích phụ. */
.hce-bonus-entry .hce-bonus-grid{align-items:end}
.hce-bonus-entry .hce-bonus-label{display:block;font-weight:inherit}
.hce-bonus-entry .hce-bonus-grid input:not([type=checkbox]),.hce-bonus-entry .hce-bonus-grid select{height:44px;min-height:44px}
.hce-bonus-entry label.hce-bonus-paid{height:44px;min-height:44px;align-self:stretch;box-sizing:border-box;margin:0;font-weight:500}
.hce-bonus-entry button.hce-bonus-dntt{height:44px;min-height:44px;width:100%;padding:0 14px;border:1px solid #b88949;border-radius:8px;background:#fff7ea;color:#6b4316;font-weight:700;cursor:pointer}
.hce-bonus-entry [data-welfare-new] small{display:none}
.hce-bonus-entry [data-welfare-new]{margin-top:8px}
.hce-bonus-entry .hce-bonus-label{font-size:12px;font-weight:500;color:#000;line-height:normal}
.hce-bonus-entry .hce-bonus-grid{align-items:start}
/* Hàng 1: Nội dung | Ngày chi | Chi nhánh; hàng 2: Loại khoản | Đợt thưởng | Tên đợt thưởng mới (khi chọn đợt mới);
   hàng 3: Phương thức thanh toán | nút "Làm ĐNTT khoản thưởng" thẳng với ô chọn (14/10/2026). */
.hce-bonus-entry [data-bonus-newcol] [data-welfare-new]{margin-top:0}
.hce-bonus-entry .hce-bonus-dntt-cell{align-self:end}
.hce-bonus-entry button.hce-bonus-dntt{display:flex;align-items:center;justify-content:center;text-align:center}
@media(max-width:760px){.hce-bonus-entry [data-bonus-newcol]:empty,.hce-bonus-entry [data-bonus-newcol]:has(>[hidden]){display:none}}
@media(max-width:760px){.hce-dialog-bonus .hce-bonus-total{flex-basis:100%;margin-right:0}.hce-dialog-bonus .hce-dialog-foot>button{flex:1 1 0}}
/* Dòng thưởng: 3 ô Chi tiết giá gộp thành 1 ô "Tổng thưởng" (14/10/2026) */
.hce .hce-price-company{text-align:center;background:#eef1f4!important;color:#334155;font-weight:700}
.hce .hce-price-company span{margin-right:8px;font-size:12px;text-transform:uppercase;letter-spacing:.02em}

/* Lịch sử thanh toán chia nhóm (14/10/2026): Tất cả · ĐNTT · ĐNTƯ Quỹ VP · ĐNTƯ theo việc · ĐNHU */
.hce .hce-history-groups{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.hce .hce-history-groups button{display:grid;grid-template-columns:auto auto;align-items:baseline;column-gap:8px;min-width:150px;padding:8px 12px;border:1px solid #d9c8ad;border-radius:10px;background:#fff;color:#3d2f1c;text-align:left;cursor:pointer}
.hce .hce-history-groups button span{font-weight:700}
.hce .hce-history-groups button b{justify-self:end;padding:0 8px;border-radius:999px;background:#f3eadb;font-size:12px}
.hce .hce-history-groups button small{grid-column:1/-1;color:#6b5a44;font-size:12px}
.hce .hce-history-groups button[aria-selected=true]{border-color:#b07f43;background:#fff4e2;box-shadow:inset 0 0 0 1px #b07f43}
.hce .hce-history-groups button[aria-selected=true] b{background:#b07f43;color:#fff}
.hce .hce-history-subfilter{display:flex;align-items:end;gap:12px;margin:0 0 10px}
.hce .hce-history-subfilter label{display:flex;flex-direction:column;gap:4px;min-width:240px}
.hce .hce-history-hu-table td small{display:block}
@media(max-width:760px){.hce .hce-history-groups{flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px}.hce .hce-history-groups button{min-width:132px;flex:0 0 auto}.hce .hce-history-subfilter label{min-width:0;flex:1}}
/* Nút nhóm gọn (14/10/2026): chỉ tên + số phiếu, căn giữa; ô trạng thái cùng hàng bên phải */
.hce .hce-history-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:12px 0}
.hce .hce-history-toolbar .hce-history-groups{margin:0;gap:8px}
.hce .hce-history-groups button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:0;height:38px;padding:0 14px;border-radius:999px;text-align:center;white-space:nowrap}
.hce .hce-history-groups button span{font-weight:700;line-height:1}
.hce .hce-history-groups button b{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:22px;padding:0 7px;border-radius:999px;font-size:12px;line-height:1}
.hce .hce-history-toolbar .hce-history-subfilter{margin:0 0 0 auto}
.hce .hce-history-toolbar .hce-history-subfilter select{height:38px;min-width:220px;border-radius:999px;padding:0 14px}
@media(max-width:760px){.hce .hce-history-toolbar{flex-direction:column;align-items:stretch}.hce .hce-history-toolbar .hce-history-subfilter{margin:0}.hce .hce-history-toolbar .hce-history-subfilter select{width:100%}}
@media(max-width:760px){.hce .hce-history-toolbar>*{min-width:0;max-width:100%}.hce .hce-history-toolbar .hce-history-subfilter select{min-width:0}}
.hce.hce-view-history .hce-history-heading .hce-history-toolbar{margin:10px 0 0}.hce.hce-view-history .hce-history-heading{padding-bottom:12px;margin-bottom:12px}
/* Mở lại hoàn ứng (Chủ CRM 26/10/2026): hộp xác nhận, ghi chú "Mở lại" ở tạm ứng đang sửa, liên kết phiếu đã hủy. Nút "Mở lại" cùng hàng ĐNTƯ / Phiếu hoàn ứng (Chủ CRM 26/10). */
.hce-overlay .hce-fund-reopen-list{margin:10px 0 14px;padding-left:20px;text-align:left}.hce-overlay .hce-fund-reopen-list li{margin:4px 0}.hce table td small.hce-fund-reopen-note{color:#8a5a12;margin-top:3px}.hce table td small .hce-link{font-size:inherit;min-height:0}.hce-overlay .hce-fund-reopen-reason,.hce-overlay .hce-fund-reopen-reason textarea{text-align:left}
/* Sao kê ngân hàng Quỹ VP qua SePay (Chủ CRM 26/10/2026): thanh cấu hình tài khoản / khóa, cột thao tác khớp khoản chi, hộp hiện khóa một lần. */
.hce .hce-bank-setup{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 12px;padding:10px 14px;border:1px solid #e5d4bf;border-radius:10px;background:#fff;text-align:left}.hce .hce-bank-setup label{display:flex;flex-direction:row;align-items:center;gap:8px;margin:0;font-weight:600}.hce .hce-bank-setup input{width:200px;min-height:34px;text-align:left}.hce .hce-bank-actions{display:grid;grid-template-columns:repeat(3,auto);gap:4px;min-width:250px}.hce .hce-bank-actions select{grid-column:1/-1;width:100%;max-width:340px;min-height:32px}.hce .hce-bank-actions button{width:auto}
.hce-overlay .hce-bank-steps{margin:10px 0 14px;padding-left:20px;text-align:left}.hce-overlay .hce-bank-steps li{margin:4px 0}.hce-overlay .hce-bank-steps code{word-break:break-all}.hce-overlay .hce-bank-key{width:100%;font-family:ui-monospace,Menlo,Consolas,monospace}
/* Tổng quỹ tạm ứng (Chủ CRM 26/10/2026): gom tạm ứng theo người giữ tiền; dòng đang xem, dòng cộng, đối chiếu số dư SePay. */
.hce .hce-fund-total tbody tr.is-selected td{background:#fbf3e8}.hce .hce-fund-total tfoot th{padding:10px 12px;border-top:2px solid #e5d4bf;background:#fffaf3;font-weight:700}.hce .hce-fund-total .hce-inline-check{display:inline-flex;align-items:center;gap:6px;margin:4px 0 0;font-weight:600}.hce .hce-total-detail h4{margin:18px 0 8px;text-align:left}.hce .hce-total-kpis small{display:block;margin-top:4px;font-size:12px}.hce .hce-total-kpis .is-off{border-color:#e7b4b1}.hce.hce .hce-total-kpis .is-off small{color:#bc2924 !important;font-weight:600}
/* Cột "Chi phí chung" ở Phân bổ chi phí (Chủ CRM 26/10/2026): tone 7 (xám xanh, biến --hce-t7-* có sẵn). */
@media screen {
  .hce.hce-view-list :is(.hce-ledger-full,.hce-ledger-sticky) thead th.hce-allocation-head.hce-dept-tone-7 { background: var(--hce-t7-bg); color: var(--hce-t7-fg); }
  .hce.hce-view-list .hce-ledger-full tbody td.hce-allocation-filled.hce-dept-tone-7 { background: var(--hce-t7-bg); color: var(--hce-t7-fg); box-shadow: none; }
  .hce .hce-dept-pill.hce-dept-tone-7 { background: var(--hce-t7-bg); color: var(--hce-t7-fg); border-color: var(--hce-t7-bd); }
  .hce.hce-view-list .hce-ledger-full tfoot td.hce-allocation-total.hce-dept-tone-7 { color: var(--hce-t7-fg); }
}
/* Thanh toán phúc lợi (Chủ CRM 26/10/2026): ô tích nhỏ đứng đầu bảng, trước STT; cả hai dính trái khi cuộn ngang. */
.hce.hce-area-welfare :is(.hce-ledger-full,.hce-ledger-sticky) .hce-ledger-select{position:sticky;left:0;z-index:3;width:28px;min-width:28px;max-width:28px;padding:2px;text-align:center;background:#f6efe4}
.hce.hce-area-welfare :is(.hce-ledger-full,.hce-ledger-sticky) thead .hce-ledger-select{z-index:5;background:#efe3cf}
.hce.hce-area-welfare :is(.hce-ledger-full,.hce-ledger-sticky) .hce-ledger-index{left:28px}
.hce.hce-area-welfare .hce-ledger-select input{width:14px;height:14px}

/* Nhà cung cấp gõ để tìm (Chủ CRM 29/10/2026): một ô thay "Chọn NCC" + "NCC ngoài danh mục", gợi ý ngay dưới ô; chiếm hai cột
   lưới NCC (cạnh Phương thức thanh toán), về một cột khi lưới còn 2 / 1 cột. Dòng / phiếu toàn chế độ hiếu hỉ ẩn như các ô NCC khác. */
.hce-supplier-picker{position:relative;display:block;min-width:0;grid-column:span 2}
.hce-supplier-picker [data-supplier-hint]{display:block;margin-top:4px;font-size:11px;line-height:1.35}
.hce-supplier-picker [data-supplier-hint]:empty{display:none}
@media (max-width:768px){.hce-supplier-picker{grid-column:auto}}
.hce-expense-editor .hce-line-regime .hce-line-supplier .hce-supplier-picker,
.hce-expense-editor .hce-voucher-supplier.is-regime .hce-line-supplier .hce-supplier-picker{display:none!important}
.hce-new-suppliers{display:grid;gap:4px;margin:8px 0 10px;max-height:240px;overflow:auto}
/* Lấy NCC từ phiếu chi: hai nút ở đầu khối Nhà cung cấp, bảng chọn tên trong hộp thoại. */
.hce-catalog-actions{display:flex;flex-wrap:wrap;gap:8px}
.hce-catalog-actions>button{min-height:34px;padding:6px 11px;white-space:nowrap}
.hce-catalog-empty [data-import-suppliers]{margin-right:6px}
.hce-import-suppliers{max-height:min(52vh,460px);overflow:auto;margin:8px 0}
.hce-import-suppliers td:first-child,.hce-import-suppliers th:first-child{width:36px;text-align:center}
.hce-import-suppliers td small{display:block;color:#6f6253;font-size:12px}

/* Danh mục chi phí làm lại (Chủ CRM 29/10/2026): hai tab Hạng mục chi phí / Nhà cung cấp thay tiêu đề; danh sách trái, chi tiết phải
   (≤650px: danh sách → chi tiết). Nhà cung cấp theo Sổ chi phí dự án: nhóm theo hạng mục, giá đã ghi, "Tra giá cũ".
   Nút trong màn Danh mục bị quy tắc chung (.hce-view-catalog button:not(...)) đặt màu chữ / viền: gạch chân tab dùng box-shadow,
   màu tab đang chọn dùng !important. */
.hce-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.hce .hce-dir-bar{display:flex;align-items:flex-end;justify-content:space-between;gap:10px 16px;flex-wrap:wrap;margin:0 0 14px;border-bottom:1px solid #d5dbe1}
.hce .hce-dir-tabs{display:flex;gap:24px;min-width:0}
.hce .hce-dir-tabs button,.hce .hce-dir-subtabs button{display:inline-flex;align-items:center;gap:7px;min-height:0;padding:9px 2px 11px;border:0;border-radius:0;background:transparent;box-shadow:none;font-size:15px;font-weight:700;color:#4c5967}
.hce .hce-dir-tabs button[aria-selected=true],.hce .hce-dir-subtabs button[aria-selected=true]{color:#875d2a!important;background:transparent!important;box-shadow:inset 0 -2px 0 #a9783b}
.hce .hce-dir-actions{display:flex;gap:8px;flex-wrap:wrap;padding-bottom:8px}
.hce .hce-dir-actions button{min-height:36px;padding:7px 13px;white-space:nowrap}
.hce .hce-dir-subtabs{display:flex;gap:22px;margin:0 0 12px;border-bottom:1px solid #e2e6ea}
.hce .hce-dir-subtabs button{font-size:13px;padding:7px 2px 9px}
.hce .hce-dir{display:grid;grid-template-columns:clamp(230px,30%,340px) minmax(0,1fr);gap:16px;align-items:start}
.hce .hce-dir-side,.hce .hce-dir-detail,.hce .hce-dir-prices{min-width:0;border:1px solid #d5dbe1;border-radius:10px;background:#fff}
.hce .hce-dir-side{display:flex;flex-direction:column;gap:8px;padding:10px}
.hce .hce-dir-search{display:block;margin:0}
.hce .hce-dir-search input{width:100%;height:38px;padding:7px 11px;border-radius:8px;font-size:13px;text-align:left}
.hce .hce-dir-list{max-height:min(68vh,640px);overflow:auto;border:1px solid #e2e6ea;border-radius:8px}
.hce .hce-dir-group h4{position:sticky;top:0;z-index:1;display:flex;justify-content:space-between;align-items:baseline;gap:8px;margin:0;padding:7px 10px;background:#f2f4f6;border-bottom:1px solid #e2e6ea;color:#875d2a;font-size:12px;font-weight:700;text-align:left}
.hce .hce-dir-group h4 small{color:#566372;font-size:11px;font-weight:500;white-space:nowrap}
.hce .hce-dir-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 8px;width:100%;min-height:0;padding:9px 10px;border:0;border-bottom:1px solid #eceff2;border-radius:0;background:#fff;text-align:left;box-shadow:none}
.hce .hce-dir-item:last-child{border-bottom:0}
.hce .hce-dir-item strong{grid-column:1;color:#24313f;font-size:13px;font-weight:600;line-height:1.35;overflow-wrap:anywhere}
.hce .hce-dir-item small{grid-column:1;color:#718091;font-size:11px;font-weight:500}
.hce .hce-dir-item .hce-chip{grid-column:2;grid-row:1/span 2;align-self:center}
.hce .hce-dir-item[aria-current=true]{background:#f6efe4;box-shadow:inset 3px 0 0 #a9783b}
.hce .hce-dir-detail{padding:16px 18px;min-height:340px}
.hce .hce-dir-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
.hce .hce-dir-head>div:first-child{min-width:0;flex:1 1 260px}
.hce .hce-dir-head h3{margin:0;color:#24313f;font-size:18px;line-height:1.3;text-align:left;overflow-wrap:anywhere}
.hce .hce-dir-head p{margin:4px 0 0;color:#566372;font-size:12px;text-align:left}
.hce .hce-dir-tools{display:flex;gap:8px;flex-wrap:wrap}
.hce .hce-dir-tools button{min-height:34px;padding:6px 12px}
.hce .hce-dir-info{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 18px;margin:10px 0 0}
.hce .hce-dir-info dt{color:#718091;font-size:11px}
.hce .hce-dir-info dd{margin:0;color:#24313f;font-size:12px;overflow-wrap:anywhere}
.hce .hce-dir-others .hce-link{font-size:12px}
.hce .hce-dir-subhead{margin:18px 0 8px;color:#24313f;font-size:13px;font-weight:700;text-align:left}
.hce .hce-dir-children{list-style:none;margin:0;padding:0;border:1px solid #e2e6ea;border-radius:8px}
.hce .hce-dir-children li{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:9px 12px;border-bottom:1px solid #eceff2}
.hce .hce-dir-children li:last-child{border-bottom:0}
.hce .hce-dir-children li>div:first-child{display:grid;gap:2px;min-width:0}
.hce .hce-dir-children strong{color:#24313f;font-size:13px;font-weight:600;overflow-wrap:anywhere}
.hce .hce-dir-children small{color:#718091;font-size:11px}
.hce .hce-price-list{max-height:min(62vh,580px);overflow:auto;border:1px solid #e2e6ea;border-radius:8px}
.hce .hce-price-item{display:flex;justify-content:space-between;gap:14px;padding:10px 12px;border-bottom:1px solid #eceff2}
.hce .hce-price-item:last-child{border-bottom:0}
.hce .hce-price-main,.hce .hce-price-values{display:grid;align-content:start;gap:3px;min-width:0}
.hce .hce-price-main strong{color:#24313f;font-size:13px;font-weight:600;overflow-wrap:anywhere}
.hce .hce-price-main span,.hce .hce-price-values span{color:#718091;font-size:11px}
.hce .hce-price-main span:empty{display:none}
/* mobile.css ép nút 16px !important trên điện thoại; mã phiếu nằm trong dòng chữ nhỏ nên giữ cỡ chữ của dòng. */
.hce .hce-price-item .hce-price-main button.hce-link{min-height:0;padding:0;font-size:12px!important;line-height:inherit;vertical-align:baseline}
.hce .hce-price-values{flex:none;max-width:48%;text-align:right}
.hce .hce-price-values strong{color:#875d2a;font-size:13px;font-weight:700}
.hce .hce-price-values small{color:#718091;font-size:11px;font-weight:500}
.hce .hce-price-more{margin:8px 0 0;font-size:11px}
.hce .hce-dir-prices{padding:12px}
.hce .hce-dir-prices>p{margin:8px 0 10px;font-size:12px}
.hce .hce-dir-empty{margin:0;padding:26px 12px;color:#718091;font-size:12px;text-align:center}
.hce .hce-dir-back{display:none}
@media (max-width:650px){
  .hce .hce-dir{grid-template-columns:1fr}
  .hce .hce-dir:not(.is-detail) .hce-dir-detail,.hce .hce-dir.is-detail .hce-dir-side{display:none}
  .hce .hce-dir-back{display:inline-flex;min-height:36px;margin:0 0 10px;padding:6px 10px}
  .hce .hce-dir-list{max-height:none}
  .hce .hce-dir-tabs{gap:18px}
  .hce .hce-dir-tabs button{font-size:14px}
  .hce .hce-dir-actions{width:100%}
  .hce .hce-dir-actions button{flex:1 1 auto}
  .hce .hce-dir-detail{padding:12px;min-height:0}
  .hce .hce-dir-info{grid-template-columns:1fr}
  .hce .hce-price-item{flex-direction:column;gap:6px}
  .hce .hce-price-values{max-width:none;text-align:left}
  .hce .hce-dir-children li{flex-wrap:wrap}
}

/* Hộp thoại Thêm / sửa nhà cung cấp, hạng mục (Chủ CRM 29/10/2026): nhãn trái, ô cao 42px viền nhạt, viền vàng khi gõ, công tắc
   "Đang sử dụng", báo lỗi trong hộp thoại. Bộ chọn có tiền tố .hce-dialog.hce-dialog-form để thắng quy tắc chung của hộp thoại. */
.hce-overlay .hce-dialog.hce-dialog-form{width:min(560px,calc(100vw - 24px));max-width:560px}
.hce-overlay .hce-dialog.hce-dialog-form .hce-dialog-head h2{text-align:left}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:0}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-wide{grid-column:1/-1}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field{display:flex;flex-direction:column;gap:6px;margin:0;text-align:left;color:#344150;font-size:13px;font-weight:600;line-height:1.3}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field b{color:#b42318;font-weight:700}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field small{color:#718091;font-weight:400}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field input{width:100%;height:42px;min-height:42px;padding:9px 12px;border:1px solid #c9ced4;border-radius:8px;background:#fff;color:#24313f;font-size:14px;font-weight:400;text-align:left;box-shadow:none}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field input::placeholder{color:#9aa4ae;opacity:1}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field input:focus{border-color:#a9783b;outline:0;box-shadow:0 0 0 3px rgba(169,120,59,.18)}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field input[readonly]{background:#f2f4f6;color:#566372}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-field input[aria-invalid=true]{border-color:#b42318;box-shadow:0 0 0 3px rgba(180,35,24,.12)}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-note{margin:-6px 0 0;color:#718091;font-size:12px;text-align:left}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch{position:relative;display:flex;flex-direction:row;align-items:flex-start;gap:12px;margin:2px 0 0;padding:12px 14px;border:1px solid #e2e6ea;border-radius:10px;background:#f7f9fa;text-align:left;cursor:pointer}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch input{position:absolute;width:1px;height:1px;min-height:0;margin:0;opacity:0}
.hce-overlay .hce-dialog.hce-dialog-form .hce-switch{position:relative;flex:none;width:38px;height:22px;margin-top:1px;border-radius:11px;background:#c9ced4;transition:background .15s}
.hce-overlay .hce-dialog.hce-dialog-form .hce-switch::after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .15s}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch input:checked+.hce-switch{background:#a9783b}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch input:checked+.hce-switch::after{transform:translateX(16px)}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch input:focus-visible+.hce-switch{box-shadow:0 0 0 3px rgba(169,120,59,.3)}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch>span:last-child{flex:1 1 auto;min-width:0}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch strong{display:block;color:#24313f;font-size:13px}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-switch small{display:block;margin-top:2px;color:#718091;font-size:12px;font-weight:400;line-height:1.45}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-error{margin:0;padding:8px 10px;border-radius:8px;background:#fdecea;color:#b42318;font-size:12px;text-align:left}
.hce-overlay .hce-dialog.hce-dialog-form .hce-form-error[hidden]{display:none}
.hce-overlay .hce-dialog.hce-dialog-form .hce-dialog-foot{justify-content:flex-end;gap:8px}
.hce-overlay .hce-dialog.hce-dialog-form .hce-dialog-foot button{min-width:96px;min-height:40px}
@media (max-width:560px){.hce-overlay .hce-dialog.hce-dialog-form .hce-form{grid-template-columns:1fr}}
