/* Finance desktop spacing: outer sections 12px; related controls 8px.
 * Presentation only. No fixed card heights, DOM movement, queries or actions.
 */
@media(min-width:769px){
html body #page-finance #finance-container #finance-shell-v2{gap:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.fo-layout,.fpv2-page,.rv-page,#finance-v2-bills-root){row-gap:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content #finance-v2-bills-root{margin-top:0!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content >.fd-query-row{margin-top:0!important;margin-bottom:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.bv-type-row,.fpv2-mode-tabs,.rv-filter-top,.rv-search-row){margin-bottom:8px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .rv-filter{padding-top:12px!important;padding-bottom:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.sv-nav,.sv-filter,.sv-kpis,.pv-subtabs,.pv-filterbar,.rc-head,.rc-filter,.rc-kpis,.fr-heading){margin-top:0!important;margin-bottom:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .rx-root{row-gap:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.fr-kpis,.fr-grid,#p8-body>.fr-panel){margin-top:0!important;margin-bottom:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .fr-toolbar{margin-bottom:8px!important;row-gap:8px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content #fr-context{padding-bottom:0!important;margin-bottom:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.fr-report-appendix,.fr-explanation)+:is(.fr-report-appendix,.fr-explanation){margin-top:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.fpv2-right,#rx-detail){row-gap:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.sv-bottom,.rc-bottom-note){margin-top:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .rc-bottom-note{margin-bottom:0!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .rc-meta{margin-top:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content :is(.rc-layout,.sv-layout,.fpv2-content-grid,.fo-row){row-gap:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .rc-dense-workbench .rc-layout{column-gap:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .pv-kpis{margin-bottom:12px!important}
/* Existing cash-flow fallback retains its data and controls. */
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content:has(>.finance-fb)>div{margin-top:0!important;margin-bottom:12px!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content:has(>.finance-fb)>div:last-child{margin-bottom:0!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .finance-fb .ffb-row1{margin-bottom:0!important}
html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content .finance-fb .ffb-row2{margin-top:8px!important}
}

/* Desktop finance: statistics immediately follow the primary tabs. Live nodes and handlers stay in place. */
@media (min-width:769px) {
  /* Overview: three existing statistic rows, then shared resource search. */
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content:has(> #f2f-ov-content > .fo-layout[data-overview-ready="true"]) {
    display:flex!important;
    flex-direction:column;
    gap:12px!important;
  }
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content > #f2f-ov-content:has(> .fo-layout[data-overview-ready="true"]),
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content > #f2f-ov-content > .fo-layout[data-overview-ready="true"] {
    display:contents!important;
  }
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content:has(> #f2f-ov-content > .fo-layout[data-overview-ready="true"]) > .fd-query-row {
    order:3;
    margin:0!important;
  }
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content > #f2f-ov-content > .fo-layout[data-overview-ready="true"] > * {
    order:4;
    margin-top:0!important;
    margin-bottom:0!important;
  }
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content > #f2f-ov-content > .fo-layout[data-overview-ready="true"] > .mg-panel {order:0}
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content > #f2f-ov-content > .fo-layout[data-overview-ready="true"] > #f2c-fund {order:1}
  html body #page-finance #finance-container #finance-shell-v2 #finance-tab-content > #f2f-ov-content > .fo-layout[data-overview-ready="true"] > .f2-ov-kpis {order:2}

  /* Every report with existing KPIs: statistics, report selector/export, filters, body. */
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root:has(> #p8-body > .fr-kpis) {
    display:flex!important;
    flex-direction:column;
    gap:12px!important;
  }
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root > #p8-body:has(> .fr-kpis) {
    display:contents!important;
  }
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root:has(> #p8-body > .fr-kpis) > *,
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root > #p8-body:has(> .fr-kpis) > * {
    order:4;
    margin-top:0!important;
    margin-bottom:0!important;
  }
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root > #p8-body > .fr-kpis {order:0}
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root > .fr-heading {order:1}
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root > .fr-toolbar {order:2}
  html body #page-finance #finance-container #finance-shell-v2 #p8-root.fr-root > #fr-context {order:3}
}
