/* Presentation layer for finance pages. Data, handlers and table contracts stay in the existing pages. */
.modern-finance,
.modern-forecast-content {
    --mf-ink: #283044;
    --mf-blue: #78a1bb;
    --mf-mint: #ebf5ee;
    --mf-beige: #bfa89e;
    --mf-taupe: #8b786d;
    --mf-muted: #657080;
    --mf-line: #dde5e2;
    --mf-soft: #f6f8f7;
    --mf-positive: #365d4c;
    --mf-negative: #995b50;
    --mf-radius: 16px;
    color: var(--mf-ink);
    font-variant-numeric: tabular-nums;
}

.modern-finance-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px 0 22px;
    flex-shrink: 0;
}
.modern-finance-hero h1 { margin: 3px 0 7px; color: #283044; font-size: clamp(26px, 2.5vw, 36px); line-height: 1.2; font-weight: 750; letter-spacing: -.7px; }
.modern-finance-hero p { margin: 0; font-size: 14px; line-height: 1.7; color: #657080; }
.modern-eyebrow { color: #77675e; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.modern-context-badge { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; background: #ebf5ee; color: #365d4c; border: 1px solid #d5e5da; border-radius: 30px; font-size: 12px; white-space: nowrap; }
.modern-context-badge i { width: 6px; height: 6px; background: #78a1bb; border-radius: 50%; }
.modern-tools-label { font-size: 12px; font-weight: 700; color: #657080; white-space: nowrap; }
.modern-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 17px 19px; background: #fff; border: 1px solid #dde5e2; border-bottom: 0; border-radius: 16px 16px 0 0; flex-shrink: 0; }
.modern-section-heading h2 { margin: 0; color: #283044; font-size: 15px; font-weight: 700; }
.modern-section-heading p, .modern-section-description { margin: 5px 0 0; color: #657080; font-size: 12px; line-height: 1.7; }
.modern-table-hint { color: #77675e; font-size: 11px; padding: 5px 10px; border-radius: 20px; background: #f6f4f2; white-space: nowrap; }
.modern-report-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 20px; padding: 5px; width: fit-content; max-width: 100%; border: 1px solid #dde5e2; border-radius: 12px; background: #fff; }
.modern-report-nav a { padding: 8px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; color: #657080; text-decoration: none; }
.modern-report-nav a:hover, .modern-report-nav a:focus-visible { color: #283044; background: #ebf5ee; }
.modern-report-context { display: block; color: #77675e; margin-top: 9px; line-height: 1.6; font-size: 12px; }

@media screen {
    /* A document can grow naturally while its detailed tables retain sticky headers. */
    html:has(body.modern-finance) { height: auto; min-height: 100%; overflow: auto; }
    body.modern-finance { height: auto; min-height: 100%; overflow: visible; }
    body.modern-finance:is(.br-drawer-open,.modern-menu-open) { overflow: hidden; }
    body.modern-finance.cashbook-page .site-body,
    body.modern-finance.report-page .site-body { height: auto; min-height: calc(100dvh - var(--modern-topbar-height,72px)); overflow: visible; display: block; padding: 28px 32px 20px; }
    body.modern-finance.cashbook-page .site-body > main,
    body.modern-finance.report-page .site-body > main { display: block; min-height: 0; padding-top: 0; }
    .modern-finance :is(h1,h2,h3) { scroll-margin-top: 100px; }
    .modern-finance :is(button,a,input,select,textarea):focus-visible,
    .modern-forecast-content :is(button,a,input,select,textarea):focus-visible { outline: 3px solid rgba(120,161,187,.55); outline-offset: 3px; }

    .modern-finance .mizrahi-topbar { flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding: 13px 16px; background: #fff; border: 1px solid var(--mf-line); border-radius: 13px; margin-bottom: 18px; box-shadow: none; z-index: auto; }
    .modern-finance .modern-ledger-toolbar .modern-tools-label { margin-inline-end: 7px; }
    .modern-finance .top-action-btn { padding: 8px 12px; border: 1px solid #dde5e2; border-radius: 9px; font-size: 12px; color: #4f5e6e; background: #fff; box-shadow: none; line-height: 1.35; }
    .modern-finance .top-action-btn:hover { background: #f1f6f8; color: #283044; border-color: #78a1bb; }
    .modern-finance .top-action-btn[onclick^="deleteAll"] { margin-inline-start: auto; background: #faf3f1; border-color: #ecdcd7; color: #995b50 !important; }
    .modern-finance .top-action-btn[onclick="openImportModal()"] { background: #283044; border-color: #283044; color: #fff; }

    .modern-ledger-summary { display: grid; grid-template-columns: minmax(310px, .8fr) minmax(430px, 1.5fr); align-items: stretch; gap: 14px; margin-bottom: 17px; }
    .modern-pagi .modern-ledger-summary { grid-template-columns: minmax(270px,.85fr) minmax(240px,.7fr) minmax(420px,1.45fr); }
    .modern-finance .modern-ledger-summary .reset-balance-box { height: auto; min-height: 112px; padding: 18px 22px; margin: 0 !important; flex-direction: column; align-items: stretch; justify-content: space-between; background: #fff; border: 1px solid var(--mf-line); border-radius: 16px; box-shadow: 0 3px 12px rgba(40,48,68,.025); gap: 12px; }
    .modern-finance .modern-ledger-summary .reset-balance-box:first-child { background: #283044; border-color: #283044; color: #fff; }
    .modern-finance .modern-ledger-summary .reset-balance-box:first-child :is(.reset-balance-label,.balance-amount-label,.reset-balance-value,.balance-date-input) { color: #fff !important; opacity: 1; }
    .modern-finance .modern-ledger-summary .reset-balance-box:first-child .balance-divider { background: rgba(235,245,238,.3); }
    .modern-finance .modern-ledger-summary .reset-balance-box:first-child .balance-date-input { border-color: rgba(235,245,238,.35); color-scheme: dark; }
    .modern-finance .balance-top-row { gap: 8px; }
    .modern-finance .modern-ledger-summary .balance-top-row { flex-direction: row; align-items: center; justify-content: space-between; }
    .modern-finance .modern-ledger-summary .balance-divider { display: none; }
    .modern-finance .modern-ledger-summary .balance-amount-wrap { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; }
    .modern-finance .reset-balance-label { font-family: inherit; letter-spacing: 0; text-transform: none; font-size: 12px; font-weight: 500; color: #657080; opacity: 1; }
    .modern-finance .balance-amount-label { font-size: 11px; color: #657080; letter-spacing: 0; opacity: 1; }
    .modern-finance .reset-balance-value { font-family: inherit; font-size: clamp(22px,2vw,29px); line-height: 1.25; font-weight: 700; color: #283044; direction: ltr; white-space: nowrap; border-bottom: 0; }
    .modern-finance .balance-date-input { font-family: inherit; background: transparent; color: #283044; font-size: 13px; font-weight: 500; border-bottom: 1px solid #dde5e2; border-radius: 0; padding: 1px 0 6px; }
    .modern-finance .balance-divider { background: #dde5e2; width: 1px; }
    .modern-finance .no-site-filter-card { display: grid; grid-template-columns: .85fr 1fr 1fr; height: auto; min-height: 112px; width: auto; background: #fff; border: 1px solid var(--mf-line); border-radius: 16px; overflow: hidden; box-shadow: none; }
    .modern-finance .no-site-segment { padding: 17px 20px; background: #fff; border: 0; border-inline-start: 1px solid #e5ebe8; color: #283044; gap: 9px; }
    .modern-finance .no-site-segment:first-child { border-inline-start: 0; background: #ebf5ee; }
    .modern-finance .no-site-segment strong { font-family: inherit; color: #283044; font-size: clamp(14px,1.35vw,20px); font-weight: 650; overflow: visible; text-overflow: clip; }
    .modern-finance .no-site-segment strong em { color: #657080; font-size: 11px; font-weight: 400; }
    .modern-finance .no-site-segment-label { color: #657080; font-size: 12px; }
    .modern-finance .no-site-segment-label i { background: #78a1bb; }
    .modern-finance .no-site-expense .no-site-segment-label i { background: #bfa89e; }
    .modern-finance .no-site-segment:hover { background: #f1f6f8; }
    .modern-finance .no-site-segment:hover { box-shadow: none; transform: none; }
    .modern-finance .no-site-segment.active { background: #e9f0f4; box-shadow: inset 0 -3px #78a1bb; }
    .modern-finance .modern-ledger-table-heading { margin-top: 8px; }

    .modern-finance .mizrahi-scroll,
    .modern-finance .report-scroll { position: relative; flex: none; overflow: auto; max-height: 64vh; max-height: 64dvh; min-height: 0; background: #fff; border: 1px solid #dde5e2; border-radius: 0 0 16px 16px; box-shadow: 0 4px 16px rgba(40,48,68,.025); margin-bottom: 20px; scrollbar-color: #b8c9c8 #f4f7f5; }
    .modern-finance .mizrahi-scroll:has(> .modern-section-heading) { border-radius: 16px; }
    .modern-finance .mizrahi-scroll > .modern-section-heading { border: 0; }
    .modern-finance .table-scroll-wrapper { border: 0; border-radius: 0; box-shadow: none; }
    .modern-finance :is(.mizrahi-table,.sl-table,.sbs-table,.br-movement-table) { color: #283044; font-size: 12.5px; font-variant-numeric: tabular-nums; }
    .modern-finance :is(.mizrahi-table,.sl-table,.sbs-table) th { background: #f1f5f3; color: #53616f; font-size: 11.5px; font-weight: 650; padding: 12px 11px; border-color: #e0e7e4; letter-spacing: 0; vertical-align: middle; }
    .modern-finance :is(.mizrahi-table,.sl-table,.sbs-table) td { padding: 10px 11px; border-color: #edf0ee; line-height: 1.55; }
    .modern-finance :is(.mizrahi-table,.sl-table,.sbs-table) tbody tr:nth-child(even) > td { background: #fafcfa; }
    .modern-finance :is(.mizrahi-table,.sl-table,.sbs-table) tbody tr:hover > td { background: #f0f5f6 !important; }
    .modern-finance :is(.mizrahi-table,.sl-table,.sbs-table) tfoot td { background: #ebf5ee; color: #283044; padding: 13px 11px; border-top: 1px solid #d5e3d9; font-weight: 700; }
    .modern-finance .mizrahi-table td :is(input,select) { font-family: inherit; }
    .modern-finance :is(.sort-btn,.filter-icon) { color: #506d82; }
    .modern-finance .excel-filter { border-color: #d7e2e4; box-shadow: 0 12px 35px rgba(40,48,68,.15); border-radius: 12px; }
    .modern-finance .mizrahi-scroll:has(.excel-filter.open) { min-height: min(430px,65dvh); }
    .modern-finance .mizrahi-table thead th:has(.excel-filter.open) { z-index: 120; }
    .modern-finance.modern-compact :is(.mizrahi-table,.sl-table,.sbs-table,.fc-summary-table,.fc-timeline-table) :is(th,td) { padding-block: 7px !important; }
    .modern-finance .mizrahi-table .act-btn { opacity: .75; }
    .modern-finance .mizrahi-table .act-btn:hover { opacity: 1; }
    .modern-finance button[onclick="openRecentMerges()"] { color: #506d82 !important; border-color: #cfdee7 !important; }
    .modern-finance .bulk-bar { background: #e9f0f4; border: 1px solid #cbdae3; padding: 10px 14px; border-radius: 11px; margin: 10px 0; }
    .modern-finance .pager { background: #fff; border-top: 1px solid #e4ebe7; padding: 12px; }
    .modern-finance .pager :is(a,button) { border-radius: 8px; }

    /* Open invoices and future checks have distinct, legible summary cards. */
    .modern-finance .modern-unpaid-overview { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; padding: 0; border: 0; background: transparent; margin-bottom: 20px; }
    .modern-finance .modern-unpaid-overview .reset-balance-box { min-height: 108px; padding: 20px; flex-direction: column; align-items: flex-start; gap: 12px; background: #fff; border: 1px solid #dde5e2 !important; box-shadow: none; border-radius: 16px; }
    .modern-finance .modern-unpaid-overview .balance-divider { display: none; }
    .modern-finance .modern-unpaid-overview .reset-balance-box:nth-child(3) { background: #283044; border-color: #283044 !important; }
    .modern-finance .modern-unpaid-overview .reset-balance-box:nth-child(3) :is(.reset-balance-label,.reset-balance-value) { color: #fff !important; }
    .modern-finance .modern-unpaid-overview .reset-balance-value { color: #283044 !important; font-size: 25px; }
    .modern-finance .unpaid-tabs { width: fit-content; background: #edf2ef; border: 1px solid #dde5e2; border-radius: 11px; padding: 4px; gap: 4px; margin-bottom: 16px; }
    .modern-finance .unpaid-tab { margin: 0; border: 0; border-radius: 8px; padding: 9px 24px; color: #657080; font-size: 13px; }
    .modern-finance .unpaid-tab.active { color: #283044; background: #fff; box-shadow: 0 2px 7px rgba(40,48,68,.06); }
    .modern-finance .unpaid-summary-bar { background: #fff; padding: 12px 16px; border: 1px solid #dde5e2; gap: 10px; z-index: auto; }
    .modern-finance .summary-chip { background: #f6f8f7; border: 0; padding: 8px 14px; border-radius: 10px; align-items: flex-start; }
    .modern-finance .summary-chip.expense { background: #f6f0ed; }
    .modern-finance .summary-chip.income { background: #ebf5ee; }
    .modern-finance .summary-chip .summary-value { font-size: 15px; color: #283044; }
    .modern-finance .view-toggle-btn.active { color: #283044; }
    .modern-finance #unpaidFilterBar { background: #f2f6f4 !important; border: 1px solid #dde5e2; border-top: 0; padding: 16px !important; gap: 12px !important; }
    .modern-finance .flt-label { margin-bottom: 4px; font-size: 11px; }
    .modern-finance .flt-input { padding: 8px 10px; border-color: #d7e0dd; border-radius: 8px; }
    .modern-finance :is(.grp-link,.check-expense-link,.loans-name-link) { color: #47748f; }
    .modern-finance .supplier-ledger-link { background: #edf3f6; border-color: #cfdee7; color: #47748f; border-radius: 8px; }
    .modern-finance .supplier-status-chip.similar { background: #f3efec; color: #77675e; border-color: #e2d8d2; }
    .modern-finance .supplier-status-chip.warn { background: #f6eee9; color: #8b6552; border-color: #e8d9ce; }
    .modern-finance #pane-grouped .mizrahi-table { table-layout: auto; min-width: 1200px; }
    .modern-finance #pane-grouped .mizrahi-table :is(th,td):first-child { width: 190px; min-width: 190px; }
    .modern-finance #pane-grouped .mizrahi-table :is(th,td):nth-child(5) { width: 70px; }
    .modern-finance #pane-grouped .mizrahi-table :is(th,td):last-child { min-width: 240px; }
    .modern-finance #pane-checks .mizrahi-table { table-layout: auto; min-width: 850px; }
    .modern-finance #pane-checks .mizrahi-table :is(th,td):nth-child(2) { width: 260px; }
    .modern-finance #pane-checks .mizrahi-table :is(th,td):last-child { width: 75px; }

    /* Loans keep authoritative API summaries and open their existing detail panel. */
    .modern-finance .modern-loans-overview { gap: 20px; padding: 0; background: transparent; border: 0; }
    .modern-finance .loans-totals { display: grid !important; grid-template-columns: repeat(3,minmax(0,1fr)); flex: 1; gap: 14px !important; }
    .modern-finance .summary-total-chip { min-height: 93px; background: #fff; border: 1px solid #dde5e2; border-radius: 15px; padding: 17px 21px; align-items: flex-start; justify-content: center; gap: 7px; }
    .modern-finance .summary-total-chip span:first-child { font-size: 12px; }
    .modern-finance .summary-total-chip span:last-child { font-size: 25px; color: #283044; }
    .modern-finance .summary-total-chip span:last-child:not(.loans-bal-neg) { color: #283044 !important; }
    .modern-finance .summary-total-chip:last-child { background: #ebf5ee; }
    .modern-finance .loans-filter-bar { padding: 16px 20px; border: 1px solid #dde5e2; background: #fff; border-radius: 13px; margin-bottom: 20px; gap: 18px; }
    .modern-finance .loans-filter-label { font-size: 12px; }
    .modern-finance .loans-search-input { min-height: 39px; border-color: #d7e0dd; padding-inline-start: 32px; border-radius: 9px; }
    .modern-finance #summaryTable tbody tr:hover td { background: #edf4f5 !important; }
    .modern-finance #summaryTable { table-layout: auto; min-width: 720px; }
    .modern-finance #summaryTable :is(th,td):first-child { width: 36%; min-width: 220px; }
    .modern-finance #summaryTable :is(th,td):last-child { width: 70px; }
    .modern-finance #searchTable { min-width: 900px; table-layout: auto; }
    .modern-finance .loans-bal-pos { color: #365d4c; }
    .modern-finance .loans-bal-neg { color: #995b50; }

    /* Supplier card and reconciliation workspace. */
    .modern-finance .sl-wrap { padding: 22px 0 35px; }
    .modern-finance .sl-topbar { padding: 15px 18px; border: 1px solid #dde5e2; border-radius: 13px; background: #fff; gap: 10px; margin-bottom: 18px; }
    .modern-finance .sl-search { padding: 9px 12px; border-color: #d7e0dd; font-size: 13px; border-radius: 9px; min-width: 240px; }
    .modern-finance .sl-title { color: #283044; font-size: 21px; font-weight: 700; }
    .modern-finance .sl-btn { padding: 8px 12px; border-radius: 8px; font-size: 12px; }
    .modern-finance .sl-btn-primary { background: #283044; color: #fff; border: 1px solid #283044; }
    .modern-finance .sl-btn-outline { color: #53616f; background: #fff; border: 1px solid #dde5e2; }
    .modern-finance .sl-btn-warning { background: #f5eee9; color: #8b6552; border: 1px solid #e7d7cc; }
    .modern-finance .sl-table-wrap { border-color: #dde5e2; border-radius: 0 0 16px 16px; max-height: 65vh; }
    .modern-finance #suppliersTable { min-width: 1140px; }
    .modern-finance #cardView > .sl-table-wrap .sl-table { min-width: 820px; }
    .modern-finance .sl-tiles { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 12px; margin-bottom: 20px; }
    .modern-finance .sl-tile { background: #fff; border: 1px solid #dde5e2; border-radius: 14px; padding: 17px 18px; }
    .modern-finance .sl-tile-label { color: #657080; font-size: 12px; margin-bottom: 8px; }
    .modern-finance .sl-tile-val { color: #283044; font-size: 23px; font-weight: 700; }
    .modern-finance .sl-tile-sub { font-size: 11px; color: #657080; margin-top: 6px; }
    .modern-finance .sl-matchbar { margin: 0; padding: 15px 19px; border: 1px solid #ccdde5; border-radius: 0; background: #edf3f6; font-size: 12px; }
    .modern-finance .sl-matchbar + .sl-table-wrap { border-top: 0; }
    .modern-finance .chip-sites { background: #edf3f6; color: #47748f; }
    .modern-finance .chip-credit { background: #ebf5ee; color: #365d4c; }
    .modern-finance .chip-debit { background: #f6efeb; color: #995b50; }
    .modern-finance .chip-unpaid, .modern-finance .chip-future { background: #f5eee9; color: #8b6552; }
    .modern-finance .ledger-open > td { background: #eaf1f4 !important; }
    .modern-finance .drill-table th { background: #edf3f6; color: #47748f; }
    .modern-finance .sl-select-box { accent-color: #78a1bb; width: 17px; height: 17px; }

    /* Site profitability: first totals, then costs, context and transactions. */
    .modern-finance .report-topbar { background: #fff; border: 1px solid #dde5e2; border-radius: 14px; padding: 16px; margin: 0 0 22px; gap: 12px; z-index: auto; }
    .modern-finance .report-title-icon { display: none; }
    .modern-finance .report-view-tabs { background: #edf2ef; border-color: #dde5e2; border-radius: 9px; }
    .modern-finance .report-view-tab { color: #657080; font-size: 12px; }
    .modern-finance .report-view-tab.active { color: #283044; background: #fff; box-shadow: 0 1px 4px rgba(40,48,68,.06); }
    .modern-finance .report-filter-form { gap: 10px; flex-wrap: wrap; }
    .modern-finance :is(.report-date-input,.report-tithe-mode-select,.report-completion-filter-select) { border-color: #d7e0dd; border-radius: 8px; font-size: 12px; min-height: 37px; }
    .modern-finance :is(.print-btn,.report-submit-btn) { border: 1px solid #d7e0dd; background: #fff; color: #53616f; border-radius: 9px; }
    .modern-finance .report-submit-btn { background: #283044; color: #fff; border-color: #283044; }
    .modern-finance .report-summary-toolbar { background: #fff; border: 1px solid #dde5e2; border-radius: 11px; padding: 12px 16px; margin-bottom: 14px; }
    .modern-finance .report-summary-toggle { color: #53616f; background: #f6f8f7; border-color: #dde5e2; }
    .modern-finance .report-summary { padding: 0; background: transparent; margin-bottom: 20px; }
    .modern-finance .metrics-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
    .modern-finance .metric-card { padding: 18px 20px; min-height: 112px; border-radius: 15px; border: 1px solid #dde5e2; box-shadow: none; background: #fff; gap: 8px; }
    .modern-finance .metric-card::after { display: none; }
    .modern-finance .metric-label { color: #657080; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
    .modern-finance .metric-value { color: #283044 !important; font-family: inherit; font-weight: 700; font-size: 25px; text-align: right; letter-spacing: -.3px; }
    .modern-finance .metric-card.profit { background: #ebf5ee; }
    .modern-finance .metric-card.profit-after { background: #f3efec; }
    .modern-finance .metric-pct { color: #657080 !important; background: #f3f6f4 !important; border-radius: 6px; font-size: 10px; padding: 3px 6px; }
    .modern-finance .metric-value.neg { color: #995b50 !important; }
    .modern-finance .analytics-strip { gap: 8px; }
    .modern-finance .analytics-chip { background: transparent; border: 1px solid #dde5e2; border-radius: 9px; padding: 7px 11px; }
    .modern-finance .analytics-chip .chip-value { color: #53616f; }
    .modern-finance .all-sites-report { display: block; }
    .modern-finance .all-sites-heading { padding: 0; margin: 0 0 18px; }
    .modern-finance .all-sites-heading h3 { color: #283044; font-size: 18px; margin: 0 0 6px; }
    .modern-finance .all-sites-heading p { font-size: 12px; color: #657080; }
    .modern-finance .all-sites-kpis { gap: 12px; margin-bottom: 20px; grid-template-columns: repeat(5,minmax(0,1fr)); }
    .modern-finance .all-sites-kpis article { background: #fff; border: 1px solid #dde5e2; border-radius: 15px; box-shadow: none; padding: 20px; }
    .modern-finance .all-sites-kpis article span { font-size: 12px; color: #657080; }
    .modern-finance .all-sites-kpis article strong { font-size: 25px; color: #283044; }
    .modern-finance .all-sites-kpis article:nth-child(3) { background: #ebf5ee; }
    .modern-finance .all-sites-kpis article small { font-size: 11px; color: #657080; }
    .modern-profit-comparison { display: grid; grid-template-columns: minmax(220px,.65fr) minmax(0,1fr); align-items: center; gap: 30px; border: 1px solid #dde5e2; border-radius: 15px; padding: 20px 22px; background: #fff; margin-bottom: 20px; }
    .modern-profit-comparison h3 { color: #283044; margin: 5px 0 8px; font-size: 16px; font-weight: 650; }
    .modern-profit-comparison p { color: #657080; margin: 0; font-size: 11px; line-height: 1.7; }
    .modern-comparison-bars { display: grid; gap: 16px; }
    .modern-comparison-bars span { display: flex; justify-content: space-between; gap: 15px; color: #657080; font-size: 12px; margin-bottom: 7px; }
    .modern-comparison-bars b { color: #283044; font-weight: 650; }
    .modern-comparison-bars i { display: block; height: 9px; border-radius: 20px; background: #f1f5f3; overflow: hidden; }
    .modern-comparison-bars em { display: block; height: 100%; border-radius: inherit; background: #78a1bb; }
    .modern-comparison-loss em { background: #bfa89e; }
    .modern-finance .site-forecast-summary { background: #fff; border: 1px solid #dde5e2; border-radius: 16px; padding: 19px; margin-bottom: 20px; box-shadow: none; }
    .modern-finance .site-forecast-kpis { gap: 10px; }
    .modern-finance .site-forecast-kpis article { background: #f6f8f7; border: 1px solid #e6ece8; border-radius: 12px; padding: 15px; }
    .modern-finance .site-forecast-kpis strong { color: #283044; font-size: 21px; }
    .modern-finance .site-forecast-breakdown span { background: #f6f8f7; color: #657080; border-color: #dde5e2; }
    .modern-finance .modern-unassigned-section .unassigned-detail-heading { background: #fff; padding: 18px 20px; border: 1px solid #dde5e2; border-radius: 16px 16px 0 0; margin: 0; }
    .modern-finance .unassigned-detail-heading h3 { color: #283044; font-size: 16px; }
    .modern-finance .unassigned-detail-heading p { font-size: 12px; color: #657080; line-height: 1.7; }
    .modern-finance .unassigned-editor-input { border-radius: 7px; font-size: 12px; }
    .modern-finance .site-subitem-label { color: #77675e; }
    .modern-finance .source-badge.src-m { background: #edf3f6; color: #47748f; }
    .modern-finance .source-badge.src-p { background: #f3efec; color: #77675e; }
    .modern-finance .report-empty-state { padding: 65px 25px; background: #fff; border: 1px dashed #cad7d0; border-radius: 16px; margin: 20px 0; }
    .modern-finance .report-empty-state svg { stroke: #78a1bb; }
    .modern-finance .report-empty-state .empty-title { color: #283044; font-size: 18px; }
    .modern-finance .report-empty-state .empty-sub { color: #657080; font-size: 13px; }

    /* Business report reuses its exact charts and drill-down data. */
    .modern-finance .business-report { --br-ink:#283044; --br-muted:#657080; --br-line:#dde5e2; --br-soft:#f6f8f7; --br-green:#365d4c; --br-green-dark:#283044; --br-red:#995b50; --br-gold:#8b786d; --br-blue:#78a1bb; padding: 28px 0 45px; background: transparent; max-width: none; }
    .modern-finance .br-header { align-items: flex-start; margin-bottom: 20px; }
    .modern-finance .br-header h1 { font-size: 36px; font-weight: 750; color: #283044; line-height: 1.2; letter-spacing: -.7px; }
    .modern-finance .br-header p { font-size: 14px; line-height: 1.7; }
    .modern-finance .br-header p:last-child { font-size: 11px; max-width: 780px; margin-top: 6px; }
    .modern-finance .br-eyebrow { color: #77675e; letter-spacing: .02em; font-size: 11px; }
    .modern-finance .br-button { border-radius: 9px; padding: 9px 13px; font-size: 12px; }
    .modern-finance .br-button.primary { background: #283044; color: #fff; }
    .modern-finance .br-button.secondary { border-color: #dde5e2; color: #53616f; background: #fff; }
    .modern-finance .br-period-panel { padding: 18px; border-radius: 14px; border-color: #dde5e2; gap: 15px; box-shadow: none; }
    .modern-finance .br-presets { background: #edf2ef; padding: 4px; border-radius: 10px; }
    .modern-finance .br-presets a { border-radius: 7px; color: #657080; padding: 8px 13px; font-size: 12px; }
    .modern-finance .br-presets a.active { color: #283044; background: #fff; box-shadow: 0 1px 5px rgba(40,48,68,.07); }
    .modern-finance .br-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 20px 0; }
    .modern-finance .br-kpi { background: #fff; border: 1px solid #dde5e2; border-radius: 16px; padding: 19px 21px; box-shadow: none; min-height: 110px; }
    .modern-finance .br-kpi::before, .modern-finance .br-kpi::after { display: none; }
    .modern-finance .br-kpi > span { color: #657080; font-size: 12px; }
    .modern-finance .br-kpi :is(strong,.br-kpi-amount) { color: #283044; font-size: 30px; font-weight: 700; line-height: 1.3; }
    .modern-finance .br-kpi.balance { background: #283044; border-color: #283044; }
    .modern-finance .br-kpi.balance :is(span,small,.br-kpi-amount) { color: #fff !important; }
    .modern-finance .br-kpi.profit { background: #ebf5ee; }
    .modern-finance .br-kpi small { color: #657080; font-size: 11px; line-height: 1.6; }
    .modern-finance .br-forecast-options { background: #fff; border: 1px solid #dde5e2; border-radius: 16px; padding: 20px; margin-bottom: 20px; box-shadow: none; }
    .modern-finance .br-forecast-options h2 { font-size: 16px; color: #283044; }
    .modern-finance .br-forecast-options form { gap: 10px; margin-top: 15px; }
    .modern-finance .br-forecast-options form label { background: #f6f8f7; border: 1px solid #e3ebe6; border-radius: 10px; padding: 12px; font-size: 12px; }
    .modern-finance .br-forecast-options form label:has(input:checked) { background: #ebf5ee; border-color: #cbdfd2; }
    .modern-finance .br-forecast-results { gap: 10px; margin-top: 17px; }
    .modern-finance .br-forecast-results article { background: #f6f8f7; border-radius: 11px; border: 1px solid #e3ebe6; padding: 14px; }
    .modern-finance .br-forecast-results article strong { color: #283044; font-size: 22px; }
    .modern-finance .br-forecast-results .final { background: #ebf5ee; border-color: #cbdfd2; }
    .modern-finance .br-card { border-color: #dde5e2; border-radius: 16px; box-shadow: none; background: #fff; }
    .modern-finance .br-card > header { padding: 20px; background: #fff; border-color: #e5ebe8; }
    .modern-finance .br-card h2 { color: #283044; font-size: 17px; }
    .modern-finance .br-bars i.income { background: #78a1bb; }
    .modern-finance .br-bars i.expense { background: #bfa89e; }
    .modern-finance .br-bars i.profit { background: #8b786d; }
    .modern-finance .br-bars i.profit.negative { background: #995b50; }
    .modern-finance .br-chart polyline { stroke: #283044; }
    .modern-finance .br-chart circle { fill: #283044; }
    .modern-finance .br-chart-legend .income::before { background: #78a1bb; }
    .modern-finance .br-chart-legend .expense::before { background: #bfa89e; }
    .modern-finance .br-chart-legend .profit::before { background: #8b786d; }
    .modern-finance .br-chart-legend .line::before { background: #283044; }
    .modern-finance .br-composition-list em.gross { background: #bfa89e; }
    .modern-finance .br-composition-list em.fixed { background: #78a1bb; }
    .modern-finance .br-composition-list em.misc { background: #8b786d; }
    .modern-finance .br-composition-list em.tax { background: #bfa89e; }
    .modern-finance .br-composition-list em.charity { background: #809e8b; }
    .modern-finance .br-composition-list em.house { background: #283044; }
    .modern-finance .br-composition-list em.vat { background: #a5c0d0; }
    .modern-finance .modern-scenario-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; }
    .modern-finance .modern-scenario-details > summary::-webkit-details-marker { display: none; }
    .modern-finance .modern-scenario-details > summary small { color: #657080; font-size: 11px; }
    .modern-finance .modern-scenario-details > summary small span { display: inline-block; font-size: 18px; padding-inline-start: 7px; transition: transform .15s ease; }
    .modern-finance .modern-scenario-details[open] > summary small span { transform: rotate(180deg); }
    .modern-finance .modern-scenario-details[open] > summary { margin-bottom: 12px; }
    .modern-finance .br-statement-detail > summary { padding: 15px 20px; }
    .modern-finance .br-statement-row { padding: 15px 20px; }
    .modern-finance .br-statement-detail[open] > summary { background: #f0f5f3; }
    .modern-finance .br-breakdown { background: #f9fbf9; }
    .modern-finance .br-drawer-header { background: #f2f6f4; border-color: #dde5e2; }

    /* Reconciliation is a calm two-panel workflow, with status colors kept legible. */
    .modern-finance .bs-wrap { padding: 23px 0 35px; }
    .modern-finance .bs-topbar { padding: 15px 18px; background: #fff; border: 1px solid #dde5e2; border-radius: 13px; margin-bottom: 18px; gap: 12px; }
    .modern-finance .bs-title { font-size: 15px; font-weight: 650; color: #283044; }
    .modern-finance .bs-reset-box { background: #f6f8f7; border-color: #dde5e2; border-radius: 9px; color: #53616f; flex-wrap: wrap; gap: 7px 18px; max-width: 100%; }
    .modern-finance .bs-steps { border: 1px solid #dde5e2; border-radius: 14px; background: #fff; padding: 8px; gap: 8px; margin-bottom: 22px; }
    .modern-finance .bs-step { background: #f6f8f7; border-radius: 9px; padding: 12px 17px; font-size: 13px; border-color: transparent; color: #657080; }
    .modern-finance .bs-step.active { background: #eaf1f5; color: #283044; border-color: #ccdde5; }
    .modern-finance .bs-step.ok { background: #ebf5ee; color: #365d4c; }
    .modern-finance .bs-section { padding: 20px; background: #fff; border: 1px solid #dde5e2; border-radius: 16px; margin-bottom: 20px; }
    .modern-finance .bs-section-title { font-size: 17px; color: #283044; margin-bottom: 14px; }
    .modern-finance .bs-badge { background: #e9f0f4; color: #47748f; padding: 3px 9px; }
    .modern-finance .bs-btn { font-size: 12px; padding: 8px 12px; border-radius: 8px; }
    .modern-finance .bs-btn-primary { background: #283044; border-color: #283044; }
    .modern-finance .bs-btn-success { background: #365d4c; }
    .modern-finance .bs-btn-outline { color: #53616f; border: 1px solid #dde5e2; background: #fff; }
    .modern-finance .bs-btn-warning { background: #f2e9e3; color: #8b6552; border: 1px solid #dfccbf; }
    .modern-finance .bs-btn-danger { background: #faf1ee; color: #995b50; border: 1px solid #e8d3cb; }
    .modern-finance .bs-alert { border-radius: 13px; padding: 16px 19px; }
    .modern-finance .bs-alert.info { background: #edf3f6; border-color: #cedee7; }
    .modern-finance .bs-alert.success { background: #ebf5ee; border-color: #c9dfd1; }
    .modern-finance .bs-alert.warn { background: #f7f1ec; border-color: #e7d7cb; }
    .modern-finance .sbs-wrap { gap: 18px; margin-top: 18px; }
    .modern-finance .sbs-panel-title { padding: 14px; font-size: 14px; color: #283044; background: #edf3f6; border-color: #dde5e2; border-radius: 12px 12px 0 0; }
    .modern-finance #sitePanel .sbs-panel-title { background: #ebf5ee; }
    .modern-finance .sbs-filters { background: #fafcfa; border-color: #dde5e2; padding: 12px; gap: 7px; }
    .modern-finance .sbs-filters :is(input,select) { padding: 7px 8px; border-color: #d7e0dd; border-radius: 7px; }
    .modern-finance .sbs-table-wrap { max-height: 57vh; border-color: #dde5e2; border-radius: 0 0 12px 12px; }
    .modern-finance .sbs-table { min-width: 580px; }
    .modern-finance .sbs-table tr.selected td { background: #e5eff4 !important; }
    .modern-finance .sbs-table tr.matched-row td { background: #edf2ef !important; }
    .modern-finance .match-bar { padding: 15px; background: #edf3f6; border-color: #cadde7; border-radius: 12px; gap: 16px; }
    .modern-finance .approve-edit { border-color: #d9e4e7; border-radius: 10px; padding: 14px; }
    .modern-finance .am-card { padding: 17px 20px; border-radius: 13px; border-color: #dde5e2; }
    .modern-finance .ub-card { background: #faf5f1; border-color: #e4d8d0; border-radius: 11px; padding: 15px; }

    /* Existing dialogs and side panels get the same surface and controls. */
    .modern-finance :is(.sl-modal,.split-modal,#importPanel,#historyPanel,#autoImportPanel,#bulkEditPanel,#subGroupPanel,#mergeReviewPanel,#recentMergesPanel,#reassignPanel) { border: 1px solid #dde5e2; border-radius: 18px !important; box-shadow: 0 24px 80px rgba(40,48,68,.22) !important; }
    .modern-finance :is(.sl-modal-bg,.split-modal-bg,#importOverlay,#historyOverlay,#autoImportOverlay,#bulkEditOverlay,#subGroupOverlay,#mergeReviewOverlay,#recentMergesOverlay,#reassignOverlay) { background: rgba(40,48,68,.4) !important; backdrop-filter: blur(4px); }
    .modern-finance :is(#detailPanel,#checkSidePanel,#grpDocPanel,#grpDetailPanel,.comments-panel,.gc-drawer) { background: #fff !important; border-inline-end: 1px solid #dde5e2; box-shadow: 12px 0 65px rgba(40,48,68,.18) !important; }
    .modern-finance :is(.sl-modal,.split-modal,#bulkEditPanel,#reassignPanel) :is(input,select,textarea) { border-color: #d7e0dd; border-radius: 8px; font-family: inherit; }
    .modern-finance :is(.amount-pos,.sbs-amount-pos,.am-amount-pos) { color: #365d4c; }
    .modern-finance :is(.amount-neg,.sbs-amount-neg,.am-amount-neg) { color: #995b50; }
}

/* Forecast is also loaded in an iframe and as a standalone printable document. */
.modern-forecast-content { --fc-blue:#47748f; --fc-ink:#283044; --fc-muted:#657080; --fc-line:#dde5e2; --fc-bg:#f6f8f7; --fc-green:#365d4c; --fc-red:#995b50; font-family: 'Heebo',Arial,sans-serif; }
@media screen {
    .modern-finance .modern-forecast-content { background: transparent; padding: 26px 0 38px; }
    .modern-forecast-content.fc-embed { padding: 20px; }
    .modern-forecast-content .fc-header { align-items: flex-start; margin-bottom: 21px; }
    .modern-forecast-content .fc-header h1 { font-size: 36px; color: #283044; font-weight: 750; letter-spacing: -.7px; margin: 4px 0 8px; }
    .modern-forecast-content .fc-header p { font-size: 14px; line-height: 1.7; }
    .modern-forecast-content .fc-eyebrow { color: #77675e; letter-spacing: .02em; }
    .modern-forecast-content .fc-report-dates { margin-top: 9px; font-size: 11px; }
    .modern-forecast-content .fc-report-action { padding: 9px 13px; border-color: #dde5e2; border-radius: 9px; }
    .modern-forecast-content .fc-site-filter { background: #fff; border: 1px solid #dde5e2; border-radius: 10px; padding: 8px 12px; }
    .modern-forecast-content .fc-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin-bottom: 20px; }
    .modern-forecast-content .fc-kpis article { padding: 20px; border-radius: 15px; gap: 9px; min-height: 116px; background: #fff; border-color: #dde5e2; }
    .modern-forecast-content .fc-kpis strong { color: #283044; font-size: 28px; line-height: 1.3; }
    .modern-forecast-content .fc-kpis article:first-child { background: #283044; border-color: #283044; }
    .modern-forecast-content .fc-kpis article:first-child :is(span,strong,small) { color: #fff; }
    .modern-forecast-content .fc-kpis article.good { background: #ebf5ee; }
    .modern-forecast-content .fc-kpis article.bad { background: #f7efeb; }
    .modern-forecast-content .fc-kpis span { font-size: 12px; }
    .modern-forecast-content .fc-kpis small { font-size: 11px; line-height: 1.6; }
    .modern-forecast-content :is(.fc-summary-card,.fc-timeline-card,.fc-sites-card,.fc-payments-card) { border: 1px solid #dde5e2; border-radius: 16px; box-shadow: none; margin-bottom: 20px; }
    .modern-forecast-content :is(.fc-summary-card,.fc-timeline-card,.fc-sites-card,.fc-payments-card) > header { padding: 19px 20px; border-color: #e5ebe8; background: #fff; }
    .modern-forecast-content h2 { font-size: 17px; color: #283044; }
    .modern-forecast-content .fc-summary-details > summary { padding: 17px 20px; font-size: 14px; color: #53616f; background: #fff; }
    .modern-forecast-content :is(.fc-summary-table,.fc-timeline-table,.fc-sites-table) { font-size: 12px; }
    .modern-forecast-content :is(.fc-summary-table,.fc-timeline-table,.fc-sites-table) th,
    .modern-forecast-content :is(.fc-summary-table,.fc-timeline-table,.fc-sites-table) td { border-color: #e4ebe7; padding: 11px 12px; }
    .modern-forecast-content .fc-summary-table th { background: #f2f6f4; color: #53616f; }
    .modern-forecast-content .fc-summary-table .fc-summary-current { background: #e9f0f4; color: #283044; }
    .modern-forecast-content .fc-timeline-table .fc-group-planned { background: #f1f6f8; color: #47748f; }
    .modern-forecast-content .fc-timeline-table .fc-group-actual { background: #f1f7f3; color: #365d4c; }
    .modern-forecast-content .fc-timeline-table .fc-group-planned-total { background: #f4efec; color: #77675e; }
    .modern-forecast-content .fc-timeline-table .fc-group-actual-total { background: #ecf3ef; color: #365d4c; }
    .modern-forecast-content .fc-timeline-table thead .fc-group-planned { background: #e6eff4; }
    .modern-forecast-content .fc-timeline-table thead .fc-group-actual { background: #ebf5ee; }
    .modern-forecast-content .fc-timeline-table thead .fc-group-planned-total { background: #ede3dd; }
    .modern-forecast-content .fc-timeline-table thead .fc-group-actual-total { background: #dfebe3; }
    .modern-forecast-content .fc-current-month-label { background: #dfeaf0; color: #47748f; }
    .modern-forecast-content .fc-sites-table thead th { background: #f1f5f3; color: #53616f; }
    .modern-forecast-content .fc-sites-table .fc-site-current-month { background: #e9f0f4; }
    .modern-forecast-content .fc-site-count { background: #ebf5ee; color: #365d4c; padding: 6px 11px; border-radius: 20px; font-size: 12px; }
    .modern-forecast-content .fc-summary-note,
    .modern-forecast-content .fc-timeline-notes { padding: 12px 20px; background: #f9fbf9; color: #657080; font-size: 11px; line-height: 1.7; }
    .modern-forecast-content :is(.fc-open-actions a,.fc-open-actions button,.fc-payments-card button) { background: #283044; border-radius: 8px; }
    .modern-forecast-content .fc-payments-card .delete { background: #f7eeeb; color: #995b50; }
    .modern-forecast-content .fc-month-editor > summary { color: #506d82; }
    .modern-forecast-content .fc-payment-count { color: #506d82; background: #e9f0f4; }
    .modern-forecast-content .fc-add-payment { color: #506d82; background: #edf3f6; border-color: #c2d6e1; }
    .modern-forecast-content .fc-add-payment:hover { background: #e3edf2; }
    .modern-forecast-content .fc-sites-table thead .fc-site-current-month { color: #506d82; }
    .modern-forecast-content .fc-month-numbers b.fc-balance-positive { color: #365d4c; }
    .modern-forecast-content .fc-month-numbers b.fc-balance-negative { color: #995b50; }
}

@media screen and (max-width: 1250px) {
    .modern-pagi .modern-ledger-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-pagi .modern-ledger-summary .no-site-filter-card { grid-column: 1 / -1; }
    .modern-finance .all-sites-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .modern-finance .br-forecast-results { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media screen and (max-width: 1200px) {
    body.modern-finance:is(.cashbook-page,.report-page) .site-body { padding-inline: 22px; }
}
@media screen and (max-width: 1100px) {
    .modern-finance .modern-ledger-summary { grid-template-columns: 1fr; }
    .modern-finance .modern-unpaid-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media screen and (max-width: 960px) {
    body.modern-finance:is(.cashbook-page,.report-page) .site-body { padding: 22px 18px 18px; }
    .modern-ledger-summary { grid-template-columns: 1fr; }
    .modern-finance .modern-unpaid-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-finance .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-finance .sbs-wrap { flex-direction: column; }
    .modern-finance .sbs-panel { width: 100%; }
    .modern-finance .sbs-table-wrap { max-height: 50vh; }
    .modern-finance .br-header { flex-wrap: wrap; }
    .modern-finance .br-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-finance .br-header-actions { flex-wrap: wrap; }
    .modern-finance #grpDetailPanel { left: 0 !important; width: 94vw !important; }
}
@media screen and (max-width: 600px) {
    body.modern-finance:is(.cashbook-page,.report-page) .site-body { padding: 18px 12px; }
}
@media screen and (max-width: 650px) {
    .modern-finance-hero { align-items: flex-start; flex-direction: column; gap: 13px; padding-bottom: 19px; }
    .modern-finance-hero h1, .modern-finance .br-header h1, .modern-forecast-content .fc-header h1 { font-size: 28px; }
    .modern-finance-hero p { font-size: 13px; }
    .modern-context-badge { font-size: 11px; padding: 6px 10px; }
    .modern-finance .modern-ledger-summary { grid-template-columns: 1fr; gap: 10px; }
    .modern-pagi .modern-ledger-summary .no-site-filter-card { grid-column: auto; }
    .modern-finance .modern-ledger-summary .reset-balance-box { min-height: 99px; padding: 17px; justify-content: space-between; }
    .modern-finance .no-site-filter-card { min-width: 0; grid-template-columns: .85fr 1fr 1fr; }
    .modern-finance .no-site-segment { padding: 13px 8px; min-width: 0; }
    .modern-finance .no-site-segment strong { font-size: 15px; }
    .modern-finance .no-site-segment-label { font-size: 10px; }
    .modern-finance .no-site-segment strong em { display: block; margin: 3px 0 0; }
    .modern-finance .mizrahi-topbar { padding: 12px; }
    .modern-finance .modern-tools-label { flex-basis: 100%; margin-bottom: 2px; }
    .modern-finance .modern-ledger-toolbar .top-action-btn { flex-grow: 1; justify-content: center; font-size: 11px; }
    .modern-finance .modern-unpaid-overview { gap: 10px; }
    .modern-finance .modern-unpaid-overview .reset-balance-box { min-width: 0 !important; padding: 15px 12px; min-height: 100px; }
    .modern-finance .modern-unpaid-overview .reset-balance-value { font-size: 21px; }
    .modern-finance .modern-unpaid-overview .reset-balance-label { font-size: 11px; white-space: normal; }
    .modern-finance .unpaid-summary-bar { gap: 8px; padding: 10px; }
    .modern-finance .summary-chip { padding: 8px 10px; }
    .modern-section-heading { padding: 15px 13px; }
    .modern-section-heading h2 { font-size: 14px; }
    .modern-section-heading p { font-size: 11px; }
    .modern-table-hint { white-space: normal; }
    .modern-finance .mizrahi-scroll, .modern-finance .report-scroll { max-height: 65vh; }
    .modern-finance .loans-totals { gap: 9px !important; }
    .modern-finance .summary-total-chip { padding: 13px 10px; min-height: 86px; }
    .modern-finance .summary-total-chip span:last-child { font-size: 19px; }
    .modern-finance .loans-filter-bar { padding: 14px; }
    .modern-finance .loans-filter-item { min-width: 0; width: 100%; }
    .modern-finance .sl-wrap, .modern-finance .bs-wrap { padding-top: 20px; }
    .modern-finance .sl-topbar { padding: 13px; }
    .modern-finance .sl-search { width: 100%; min-width: 0; }
    .modern-finance .sl-tiles { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    .modern-finance .sl-tile { padding: 14px; }
    .modern-finance .sl-tile-val { font-size: 21px; }
    .modern-finance .report-topbar { padding: 13px; }
    .modern-finance .report-filter-form { width: 100%; }
    .modern-finance .date-range-wrap { flex-wrap: wrap; }
    .modern-finance .metrics-grid { gap: 10px; }
    .modern-finance .metric-card { padding: 15px 13px; min-height: 102px; }
    .modern-finance .metric-value { font-size: 22px; }
    .modern-finance .all-sites-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    .modern-finance .all-sites-kpis article { padding: 15px 13px; }
    .modern-finance .all-sites-kpis article strong { font-size: 22px; }
    .modern-finance .all-sites-kpis article:nth-child(3) { grid-column: 1 / -1; }
    .modern-profit-comparison { grid-template-columns: 1fr; padding: 17px; gap: 17px; }
    .modern-finance .bs-section { padding: 14px; }
    .modern-finance .bs-steps { flex-wrap: wrap; gap: 6px; }
    .modern-finance .bs-step { padding: 10px; font-size: 11px; flex: 1; }
    .modern-finance .br-kpis { gap: 10px; }
    .modern-finance .br-kpi { padding: 15px 13px; min-height: 107px; }
    .modern-finance .br-kpi :is(strong,.br-kpi-amount) { font-size: 23px; }
    .modern-finance .br-forecast-options { padding: 15px; }
    .modern-finance .br-vat-mode-form { flex-wrap: wrap; min-width: 0; }
    .modern-finance .br-presets { flex-wrap: wrap; }
    .modern-finance .br-presets a { padding-inline: 10px; }
    .modern-finance .modern-scenario-details > summary { align-items: flex-start; flex-direction: column; gap: 8px; }
    .modern-finance .br-forecast-results { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-finance .br-forecast-results article strong { font-size: 20px; }
    .modern-report-nav { width: 100%; }
    .modern-report-nav a { padding: 8px 9px; font-size: 11px; }
    .modern-forecast-content .fc-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    .modern-forecast-content .fc-kpis article { padding: 15px 13px; min-height: 111px; }
    .modern-forecast-content .fc-kpis strong { font-size: 23px; }
    .modern-forecast-content.fc-embed { padding: 12px; }
    .modern-forecast-content .fc-sites-card > header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media screen and (max-width: 420px) {
    .modern-finance .no-site-filter-card { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-finance .no-site-overview { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; }
    .modern-finance .no-site-overview strong em { display: inline; margin-inline-start: 4px; }
    .modern-finance .no-site-segment strong { font-size: clamp(12px,3.7vw,15px); }
    .modern-finance .loans-totals { grid-template-columns: 1fr; }
    .modern-finance .summary-total-chip { flex-direction: row; align-items: center; justify-content: space-between; min-height: 61px; padding: 13px 17px; }
    .modern-finance .bs-topbar .bs-btn { white-space: normal; text-align: center; }
}
@media screen and (min-width: 1800px) {
    body.modern-finance:is(.cashbook-page,.report-page) .site-body { padding-inline: 48px; }
}

@media print {
    .modern-finance-hero, .modern-section-heading, .modern-report-nav { display: none !important; }
    .modern-finance .modern-ledger-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
    .modern-finance .modern-ledger-toolbar { display: none !important; }
}

/* The two ledger workspaces use all remaining screen space for their tables. */
@media screen {
    html:has(body.modern-finance.modern-ledger) {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
    body.modern-finance.modern-ledger {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }
    body.modern-finance.modern-ledger.cashbook-page .site-body {
        display: flex;
        flex-direction: column;
        height: calc(100vh - var(--modern-topbar-height,50px));
        height: calc(100dvh - var(--modern-topbar-height,50px));
        min-height: 0;
        overflow: hidden;
        box-sizing: border-box;
    }
    body.modern-finance.modern-ledger.cashbook-page .site-body > main {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        overflow: auto;
    }
    body.modern-finance.modern-ledger #mainContent > :is(#tokenForm,#filterForm) {
        display: none;
    }
    body.modern-finance.modern-ledger #mainContent > * {
        flex-shrink: 0;
    }
    body.modern-finance.modern-ledger.cashbook-page .site-body > main > .mizrahi-scroll {
        flex: 1 1 0;
        min-height: 160px;
        max-height: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
}

/* Short screens retain a document scrollbar so every control remains reachable. */
@media screen and (max-height: 599px), screen and (max-width: 359px) {
    html:has(body.modern-finance.modern-ledger) {
        height: auto;
        min-height: 100%;
        overflow: auto;
    }
    body.modern-finance.modern-ledger {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: visible;
    }
    body.modern-finance.modern-ledger.cashbook-page .site-body {
        height: auto;
        min-height: calc(100vh - var(--modern-topbar-height,50px));
        min-height: calc(100dvh - var(--modern-topbar-height,50px));
        overflow: visible;
    }
    body.modern-finance.modern-ledger.cashbook-page .site-body > main {
        display: block;
        flex: none;
        overflow: visible;
    }
    body.modern-finance.modern-ledger.cashbook-page .site-body > main > .mizrahi-scroll {
        flex: none;
        max-height: 75vh;
        max-height: 75dvh;
    }
}

@media print {
    body.modern-finance.modern-ledger .site-body > main { display: block !important; }
    body.modern-finance.modern-ledger .mizrahi-scroll {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        flex: none !important;
        overflow: visible !important;
    }
}
