/* V2.5.0-dev.6.7.10 — finance screen UI. Uses the shared Design System and BrandingService tokens. */
.finance-page{color:var(--ui-text);font-size:var(--ui-font)}
.finance-page .page-title h2,.finance-page .accounting-section-head h3{color:var(--ui-heading)}
.finance-page .accounting-section-head small,.finance-page .finance-summary-item small,.finance-page .cell-note{color:var(--ui-muted)}
.finance-page .finance-summary-item>b,.finance-page .ui-money b,.finance-page .table-link{color:var(--ui-text)}
.finance-page .ui-money small{font-size:var(--ui-font-xs);color:var(--ui-text-secondary)}
.treasury-held-note{color:var(--ui-warning)}.treasury-available-note{color:var(--ui-success);font-weight:var(--ui-weight-strong)}
.finance-page .ui-data-table th{color:var(--ui-text-secondary);font-size:var(--ui-font-sm);font-weight:var(--ui-weight-strong)}
.finance-page .ui-data-table td{color:var(--ui-text);font-size:var(--ui-font)}
.finance-page .ui-tabs button.active{color:var(--blue-dark)!important}
.finance-page .ui-tabs button.active:after{background:var(--blue)}
.finance-page .ui-empty{min-height:82px}
.finance-page .ui-table-wrap{margin-top:0}
.finance-page .ui-pagination{padding-bottom:2px}
.finance-page .ui-tabs{overflow:visible;white-space:normal}
.finance-page-tabs{display:flex;flex-wrap:wrap}
.finance-page-tabs button{flex:0 0 auto}
.finance-page .ui-action-popover{color:var(--ui-text)}

.treasury-accounts-toolbar{margin-top:var(--ui-space-2)}
.finance-onboarding-warning{margin-top:var(--ui-space-2);padding:var(--ui-space-2) var(--ui-space-3);border:1px solid color-mix(in srgb,var(--ui-warning) 35%,var(--ui-line));border-radius:var(--ui-radius-sm);background:var(--ui-warning-bg);color:var(--ui-warning);font-size:var(--ui-font-xs)}
.finance-quick-actions{justify-content:flex-start}
.finance-quick-actions .ui-icon-btn{color:var(--ui-text-secondary)}
.finance-quick-actions .ui-icon-btn:hover{color:var(--blue-dark);background:var(--ui-soft)}

.treasury-table,.treasury-movements-table,.treasury-transfers-table,.treasury-statement-table,.expense-modal-ledger{width:100%;min-width:0;table-layout:fixed}
.treasury-table th,.treasury-table td,.treasury-movements-table th,.treasury-movements-table td,.treasury-transfers-table th,.treasury-transfers-table td,.treasury-statement-table th,.treasury-statement-table td,.expense-modal-ledger th,.expense-modal-ledger td{white-space:normal!important;overflow-wrap:anywhere;word-break:normal;vertical-align:top}
.treasury-table th:nth-child(1){width:34%}.treasury-table th:nth-child(2){width:18%}.treasury-table th:nth-child(3){width:14%}.treasury-table th:nth-child(4){width:18%}.treasury-table th:nth-child(5){width:16%}
.treasury-movements-table th:nth-child(1){width:8%}.treasury-movements-table th:nth-child(2){width:11%}.treasury-movements-table th:nth-child(3){width:10%}.treasury-movements-table th:nth-child(4){width:11%}.treasury-movements-table th:nth-child(5){width:19%}.treasury-movements-table th:nth-child(6),.treasury-movements-table th:nth-child(7){width:8%}.treasury-movements-table th:nth-child(8),.treasury-movements-table th:nth-child(9){width:8%}.treasury-movements-table th:nth-child(10){width:9%}

.treasury-account-ledger-table{width:100%;min-width:0;table-layout:fixed}
.treasury-account-ledger-table th,.treasury-account-ledger-table td{white-space:normal!important;overflow-wrap:anywhere;vertical-align:top}
.treasury-account-ledger-table th:nth-child(1){width:9%}.treasury-account-ledger-table th:nth-child(2){width:13%}.treasury-account-ledger-table th:nth-child(3){width:14%}.treasury-account-ledger-table th:nth-child(4){width:22%}.treasury-account-ledger-table th:nth-child(5),.treasury-account-ledger-table th:nth-child(6){width:9%}.treasury-account-ledger-table th:nth-child(7){width:13%}.treasury-account-ledger-table th:nth-child(8){width:11%}
.treasury-account-view{background:var(--ui-card);border:1px solid var(--ui-line);border-radius:var(--ui-radius);padding:var(--ui-space-4);margin-top:var(--ui-space-2)}
.treasury-account-view-head{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-space-4);border-bottom:1px solid var(--ui-line);padding-bottom:var(--ui-space-3);margin-bottom:var(--ui-space-3)}
.treasury-account-title{text-align:right}.treasury-account-title h3{font-size:calc(var(--ui-section) + 4px);margin:0;color:var(--ui-heading)}.treasury-account-title span{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-sm);margin-top:var(--ui-space-1)}
.treasury-detail-actions{display:flex;justify-content:flex-start;align-items:center;gap:var(--ui-space-2);margin-bottom:var(--ui-space-2)}
.treasury-opening-balance-line{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-space-3);padding:var(--ui-space-3);margin-bottom:var(--ui-space-2);border:1px solid var(--ui-line);border-radius:var(--ui-radius-sm);background:var(--ui-surface-subtle)}.treasury-opening-balance-line>div{min-width:0}.treasury-opening-balance-line small,.treasury-opening-balance-line span{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-xs)}.treasury-opening-balance-line b{display:block;color:var(--ui-text);font-size:var(--ui-font-strong);font-weight:var(--ui-weight-heavy);direction:ltr;text-align:right}
.treasury-detail-more{position:relative}.treasury-detail-more summary{list-style:none}.treasury-detail-more summary::-webkit-details-marker{display:none}
.treasury-detail-more>div{position:absolute;top:calc(100% + var(--ui-space-1));inset-inline-start:0;z-index:30;min-width:170px;padding:var(--ui-space-1);border:1px solid var(--ui-line);background:var(--ui-card);border-radius:var(--ui-radius-sm);box-shadow:var(--ui-shadow)}
.treasury-detail-more>div button{display:block;width:100%;border:0;background:transparent;text-align:right;padding:var(--ui-space-2);border-radius:var(--ui-radius-xs);font:inherit;cursor:pointer}.treasury-detail-more>div button:hover{background:var(--ui-soft)}
.treasury-quick-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:var(--ui-space-2);margin-bottom:var(--ui-space-2)}
.treasury-quick-summary>div{min-height:74px;padding:var(--ui-space-3);border:1px solid var(--ui-line);border-radius:var(--ui-radius-sm);background:var(--ui-card)}
.treasury-quick-summary small{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-xs);margin-bottom:var(--ui-space-1)}
.treasury-quick-summary b{font-size:var(--ui-financial);color:var(--ui-text);font-weight:var(--ui-weight-heavy)}
.treasury-quick-summary .primary{background:var(--ui-surface-subtle)}
.treasury-quick-summary .held b{color:var(--ui-warning)}
.treasury-quick-summary .available b{color:var(--ui-success)}
/* Finance B3 — platform wallet reconciliation strip + top-up difference badge. Central tokens only:
   the strip reuses .treasury-quick-summary wholesale and adds nothing but a separating rule, and the
   badge borrows the existing status colours rather than introducing new ones. */
.platform-reconciliation{border-top:1px dashed var(--ui-line);padding-top:var(--ui-space-2)}
.topup-difference{font-weight:var(--ui-weight-strong)}
.topup-difference--danger{color:var(--ui-danger)}
.topup-difference--ok{color:var(--ui-success)}
.topup-difference--muted{color:var(--ui-muted)}
.treasury-detail-toolbar{margin-top:var(--ui-space-1)}.treasury-detail-toolbar select{flex:0 0 210px}.treasury-detail-toolbar .ui-search{min-width:260px}
.treasury-detail-table .cell-note{display:block;font-size:var(--ui-font-xs);color:var(--ui-muted);margin-top:2px}.ledger-desc b{display:block;color:var(--ui-text);font-weight:var(--ui-weight-strong)}.ledger-desc .cell-note{margin-top:2px}.finance-link-sep{display:inline-block;margin:0 var(--ui-space-1);color:var(--ui-muted)}

.trx-number{font-weight:var(--ui-weight-heavy);color:var(--ui-text);direction:ltr;display:inline-block}
.trx-preview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ui-space-2)}
.trx-preview-grid>.trx-preview-wide{grid-column:1/-1}
.trx-preview-grid>div{border:1px solid var(--ui-line);border-radius:var(--ui-radius-sm);padding:var(--ui-space-2);background:var(--ui-surface-subtle)}
.trx-preview-grid small{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-xs);margin-bottom:var(--ui-space-1)}.trx-preview-grid b{font-size:var(--ui-font-sm);color:var(--ui-text)}.trx-preview-grid .wide{grid-column:1/-1}
.transfer-preview-grid,.payment-preview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ui-space-2);width:100%}
.transfer-preview-grid span,.payment-preview-grid span{display:grid;gap:2px;padding:var(--ui-space-2);border:1px solid var(--ui-line);border-radius:var(--ui-radius-sm);background:var(--ui-card)}
.transfer-preview-grid small,.payment-preview-grid small{color:var(--ui-text-secondary);font-size:var(--ui-font-xs)}.transfer-preview-grid b,.payment-preview-grid b{font-size:var(--ui-font-sm);color:var(--ui-text)}.transfer-preview-grid .wide,.payment-preview-grid .wide{grid-column:1/-1}.payment-live-preview{margin-top:var(--ui-space-2);display:block}
.inline-field-action{display:grid;grid-template-columns:minmax(0,1fr) 38px;gap:var(--ui-space-2);align-items:center}.inline-field-action .ui-icon-btn{width:38px;height:var(--ui-control)}
.transfer-fees-cell{display:grid;gap:var(--ui-space-1)}.transfer-fees-cell>.ui-money{justify-self:start}.fee-mini{display:flex;align-items:center;gap:var(--ui-space-1);min-width:0}.fee-mini .table-link{font-size:var(--ui-font-xs);font-weight:var(--ui-weight-medium);white-space:normal;text-align:right}.fee-mini .fee-actions{margin-inline-start:auto;flex:0 0 auto}

.expense-summary-currencies{display:grid;gap:var(--ui-space-1)}.expense-summary-currencies span{display:flex;gap:var(--ui-space-2);justify-content:space-between}.expense-summary-currencies b{direction:ltr}
.expenses-table{width:100%;min-width:0!important;table-layout:fixed}.expenses-table th,.expenses-table td{white-space:normal!important;overflow-wrap:anywhere;vertical-align:top}.expense-title-link{display:block;text-align:right}.expense-number,.expense-ref,.fee-number{direction:ltr;unicode-bidi:isolate;font-weight:var(--ui-weight-strong)}
.expense-detail-modal{width:min(1040px,96vw);max-width:1040px!important;overflow-x:hidden!important}.expense-detail-modal .card-body{padding:var(--ui-space-3) var(--ui-space-4)}
.expense-identity{display:grid;grid-template-columns:minmax(170px,.6fr) minmax(0,1.4fr);gap:var(--ui-space-2);margin-bottom:var(--ui-space-2)}.expense-identity>div{padding:var(--ui-space-2);border:1px solid var(--ui-line);border-radius:var(--ui-radius-sm);background:var(--ui-surface-subtle)}
.expense-identity small{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-xs);margin-bottom:2px}.expense-identity b{color:var(--ui-text);font-size:var(--ui-font-sm)}
.expense-modal-section{margin-bottom:var(--ui-space-2)}.expense-modal-section>h3{font-size:var(--ui-font-strong);color:var(--ui-heading);margin:0 0 var(--ui-space-2)}.expense-modal-section .grid2{gap:var(--ui-space-2) var(--ui-space-3)}.expense-modal-section label{margin-bottom:var(--ui-space-1)}.expense-modal-section input,.expense-modal-section select{min-height:38px}.expense-modal-section .wide-field{grid-column:1/-1}
/* Round 2 correction pass: summary sits beside the info section on desktop widths where the modal's
   own width (min(1040px,96vw)) safely fits both without squeezing the 2-col grid2 fields below it;
   falls back to the normal stacked .expense-modal-section flow under the same 900px breakpoint main.css
   already uses to collapse grid2/grid3/grid4. Presentation only — no field/behavior change. */
.expense-modal-top-row{display:flex;gap:var(--ui-space-3);align-items:flex-start}
/* Expense dialog (Round 1B UX): the form in four rows - statement | category | date; currency | total; tax | tax
 * currency | tax note; notes. Each row shares its width equally among the fields that are SHOWN, so a conditional
 * field (record mode, tax FX) joins its row when visible and leaves no gap when hidden. Stacked when narrow. */
.expense-form-rows{display:flex;flex-direction:column;gap:var(--ui-space-2)}
.expense-form-row{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:var(--ui-space-2) var(--ui-space-3);align-items:end}
.expense-form-row>.hidden{display:none}
@media(max-width:720px){.expense-form-row{grid-auto-flow:row;grid-template-columns:minmax(0,1fr)}}
.expense-modal-top-row>.expense-modal-section{margin-bottom:var(--ui-space-2)}
.expense-modal-top-row>.expense-modal-section:first-child{flex:1 1 0;min-width:0}
.expense-modal-top-row>.expense-modal-section:last-child{flex:0 0 260px;width:260px}
.expense-modal-top-row>.expense-modal-section:last-child .financial-highlight{height:100%;flex-direction:column;align-items:stretch;gap:var(--ui-space-2)}
@media(max-width:820px){.expense-modal-top-row{flex-direction:column;align-items:stretch}.expense-modal-top-row>.expense-modal-section:first-child,.expense-modal-top-row>.expense-modal-section:last-child{flex:none;width:auto}}
.expense-payment-head{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-space-2);margin:var(--ui-space-2) 0}.expense-payment-head small{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-xs);margin-top:2px}
.expense-modal-ledger{width:100%;min-width:0!important;table-layout:fixed}.expense-modal-ledger th,.expense-modal-ledger td{padding:var(--ui-space-2)!important;white-space:normal!important;overflow-wrap:anywhere;vertical-align:top}.expense-modal-ledger .col-date{width:12%}.expense-modal-ledger .col-payment{width:29%}.expense-modal-ledger .col-desc{width:31%}.expense-modal-ledger .col-ref{width:15%}.expense-modal-ledger .col-actions{width:13%}.expense-modal-ledger .table-actions{display:flex;flex-wrap:wrap;gap:var(--ui-space-1)}.expense-payment-actions .ui-icon-btn{width:29px;height:29px}
.fee-list{display:grid;gap:var(--ui-space-1);margin-top:var(--ui-space-2)}.fee-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:var(--ui-space-2);align-items:center;padding:var(--ui-space-2);border:1px solid var(--ui-line);border-radius:var(--ui-radius-sm);background:var(--ui-surface-subtle)}.fee-row small{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-xs)}.fee-row .fee-amount{font-weight:var(--ui-weight-heavy);direction:ltr;color:var(--ui-text)}.fee-actions{display:flex;gap:var(--ui-space-1)}.fee-actions .ui-icon-btn{width:27px;height:27px}

/* Treasury reports — screen UI only. Shared report print rules live in finance-report-print.css. */
.treasury-report-panel{max-width:100%;padding-bottom:var(--ui-space-2)}
.treasury-report-panel>.accounting-section-head{margin-bottom:var(--ui-space-3)}
.treasury-report-panel>.accounting-section-head h3{font-size:var(--ui-section);margin-bottom:var(--ui-space-1)}
.treasury-report-panel>.accounting-section-head small{font-size:var(--ui-font-sm);color:var(--ui-text-secondary)}
.report-selector{display:grid;grid-template-columns:minmax(190px,1.35fr) repeat(2,minmax(130px,.72fr)) minmax(145px,.9fr) minmax(190px,1.25fr);gap:var(--ui-space-2);align-items:end;margin-bottom:var(--ui-space-4);padding:var(--ui-space-3);border:1px solid var(--ui-line);border-radius:var(--ui-radius);background:var(--ui-card)}
.report-selector>div{min-width:0}.report-selector label{font-size:var(--ui-font-sm);font-weight:var(--ui-weight-medium);color:var(--ui-text-secondary);display:block;margin-bottom:var(--ui-space-1)}
.report-selector select,.report-selector input{width:100%;min-width:0;min-height:var(--ui-control);font-size:var(--ui-font)}
.report-selector select{height:var(--ui-control);line-height:normal;padding-block:0;padding-inline:var(--ui-space-3) var(--ui-space-5);vertical-align:middle}
.report-selector .report-print-btn{min-height:var(--ui-control);height:var(--ui-control);padding-inline:var(--ui-space-4);display:inline-flex;align-items:center;justify-content:center;gap:var(--ui-space-2);font-size:var(--ui-font);white-space:nowrap}
.report-selector .report-print-btn .ui-btn-icon{display:inline-grid;place-items:center;width:18px;height:18px;line-height:1;font-size:var(--ui-font-strong);font-style:normal;transform:none}
.report-summary-section,.report-subsection{margin-top:var(--ui-space-5)}
.report-summary-section{margin-top:0}
.report-summary-section>h3,.report-subsection>h3{font-size:var(--ui-section);font-weight:var(--ui-weight-strong);color:var(--ui-heading);margin:0 0 var(--ui-space-3)}
.treasury-report-summary{min-width:0}
.statement-summary-line{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:0;margin:0;border:1px solid var(--ui-line);border-radius:var(--ui-radius);background:var(--ui-card);overflow:hidden}
.statement-summary-line>div{min-width:0;padding:var(--ui-space-3);background:var(--ui-card);border-inline-start:1px solid var(--ui-line)}
.statement-summary-line>div:first-child{border-inline-start:0}
.statement-summary-line span{display:block;color:var(--ui-text-secondary);font-size:var(--ui-font-xs);font-weight:var(--ui-weight-medium);margin-bottom:var(--ui-space-1);line-height:1.45}
.statement-summary-line .ui-money,.statement-summary-line b{font-size:var(--ui-financial);font-weight:var(--ui-weight-heavy);color:var(--ui-text);line-height:1.25}
.statement-summary-line .ending{background:var(--ui-surface-subtle);border-color:color-mix(in srgb,var(--blue) 28%,var(--ui-line))}
.statement-summary-line .current{background:var(--ui-surface-muted)}
.statement-summary-line .held b,.statement-summary-line .held .ui-money{color:var(--ui-warning)}
.statement-summary-line .available b,.statement-summary-line .available .ui-money{color:var(--ui-success)}
.treasury-statement-table{table-layout:fixed;width:100%;min-width:0}
.treasury-report-panel .ui-table-wrap{overflow:visible}
.treasury-report-panel .ui-data-table{min-width:0;table-layout:fixed}
.treasury-report-panel .ui-data-table th,.treasury-report-panel .ui-data-table td{white-space:normal;overflow-wrap:anywhere;line-height:1.5}
.treasury-report-panel .ui-data-table td{font-variant-numeric:tabular-nums}
.treasury-statement-table .col-date{width:11%}.treasury-statement-table .col-ref{width:14%}.treasury-statement-table .col-source{width:15%}.treasury-statement-table .col-desc{width:24%}.treasury-statement-table .col-in,.treasury-statement-table .col-out{width:11%}.treasury-statement-table .col-balance{width:14%}
/* Batch 4C: alignment-only (no data/logic change) — the "المصدر" column content is centered
   on-screen and in the printed statement, matching the same column definition in both places. */
.treasury-statement-table td.col-source{text-align:center}

.modal-operation-message{position:sticky;top:0;z-index:8;padding:var(--ui-space-2) var(--ui-space-3);border-radius:var(--ui-radius-sm);margin-bottom:var(--ui-space-2);font-size:var(--ui-font-sm);font-weight:var(--ui-weight-medium);border:1px solid}
.modal-operation-message.error{background:var(--ui-danger-bg);border-color:color-mix(in srgb,var(--ui-danger) 35%,var(--ui-line));color:var(--ui-danger)}
.modal-operation-message.warning{background:var(--ui-warning-bg);border-color:color-mix(in srgb,var(--ui-warning) 35%,var(--ui-line));color:var(--ui-warning)}
.modal-operation-message.success{background:var(--ui-success-bg);border-color:color-mix(in srgb,var(--ui-success) 35%,var(--ui-line));color:var(--ui-success)}
.modal-operation-message.hidden{display:none}.field-invalid{border-color:var(--ui-danger)!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-danger) 8%,transparent)!important}.field-error{display:block;color:var(--ui-danger);font-size:var(--ui-font-xs);margin-top:var(--ui-space-1)}

@media(max-width:900px){
 .treasury-quick-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
 .report-selector{grid-template-columns:repeat(2,minmax(0,1fr))}
 .report-selector .report-print-btn{width:100%}
 .statement-summary-line{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:720px){
 .treasury-detail-toolbar{flex-wrap:wrap}.treasury-detail-toolbar select{flex:1 1 auto;width:100%}
 .transfer-preview-grid,.payment-preview-grid{grid-template-columns:1fr}
 .treasury-account-view-head{align-items:flex-start;flex-direction:column-reverse}
 .treasury-opening-balance-line{align-items:flex-start;flex-direction:column}.treasury-opening-balance-line .btn{width:100%}
 .report-selector{grid-template-columns:1fr}
 .treasury-report-panel .ui-data-table{font-size:var(--ui-font-sm)}
}
@media(max-width:640px){
 .treasury-quick-summary,.statement-summary-line,.trx-preview-grid,.expense-identity{grid-template-columns:1fr}
 .trx-preview-grid .wide{grid-column:auto}
 .treasury-movements-table,.expense-modal-ledger{font-size:var(--ui-font-xs)}
 .treasury-movements-table th,.treasury-movements-table td{padding:var(--ui-space-2)!important}
 .expense-detail-modal{width:98vw}
 .expense-payment-head{align-items:flex-start;flex-direction:column}
}

/* treasury movements */
.relation-number{direction:ltr;display:inline-block}.treasury-movements-table .table-actions,.treasury-account-ledger-table .table-actions{justify-content:flex-start;gap:var(--ui-space-1)}.treasury-movements-table .ui-icon-btn,.treasury-account-ledger-table .ui-icon-btn{width:30px;height:30px}
