/* Local modern ledger presentation: compact summaries and a floating action panel. */
@media screen {
    .modern-ledger .modern-ledger-summary { grid-template-columns: minmax(280px,.8fr) minmax(0,1.5fr) auto; gap: 12px; margin-bottom: 12px; }
    .modern-pagi .modern-ledger-summary { grid-template-columns: minmax(220px,.85fr) minmax(180px,.65fr) minmax(0,1.5fr) auto; }
    .modern-ledger .modern-ledger-summary .reset-balance-box { min-height: 72px; padding: 10px 16px; gap: 4px; border-radius: 12px; }
    .modern-ledger .modern-ledger-summary .reset-balance-value { font-size: 23px; line-height: 1.2; }
    .modern-ledger .modern-ledger-summary .balance-date-input { padding-bottom: 2px; font-size: 12px; }
    .modern-pagi .modern-ledger-summary .reset-balance-box:nth-child(2) { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto auto; align-content: space-between; }
    .modern-pagi .modern-ledger-summary .reset-balance-box:nth-child(2) .balance-top-row { grid-column: 1; grid-row: 1; }
    .modern-pagi .modern-ledger-summary .reset-balance-box:nth-child(2) .balance-amount-wrap { display: contents; }
    .modern-pagi .modern-ledger-summary .reset-balance-box:nth-child(2) .balance-amount-label { grid-column: 2; grid-row: 1; align-self: center; }
    .modern-pagi .modern-ledger-summary .reset-balance-box:nth-child(2) .reset-balance-value { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
    .modern-ledger .modern-ledger-summary .no-site-filter-card { grid-column: auto; min-width: 0; grid-template-columns: minmax(70px,.85fr) repeat(2,minmax(105px,1fr)); min-height: 72px; border-radius: 12px; }
    .modern-ledger .modern-ledger-summary .no-site-segment { padding: 10px 12px; gap: 4px; }
    .modern-ledger .modern-ledger-summary .no-site-segment strong { font-size: 17px; line-height: 1.2; }
    .modern-ledger .modern-ledger-summary .no-site-segment-label { font-size: 11px; }
    .modern-finance :is(.mizrahi-scroll,.report-scroll) { border-radius: 12px; }

    /* Match each existing Pagi field to the corresponding Mizrahi column. */
    .modern-pagi .pagi-table { min-width: 1620px; }
    .modern-pagi .pagi-table :is(th,td):nth-child(1) { width: 110px; }
    .modern-pagi .pagi-table :is(th,td):is(:nth-child(2),:nth-child(10)) { width: 150px; }
    .modern-pagi .pagi-table :is(th,td):nth-child(3) { width: 185px; }
    .modern-pagi .pagi-table :is(th,td):nth-child(4) { width: 165px; }
    .modern-pagi .pagi-table :is(th,td):nth-child(5) { width: 225px; }
    .modern-pagi .pagi-table :is(th,td):is(:nth-child(6),:nth-child(7)) { width: 110px; }
    .modern-pagi .pagi-table :is(th,td):nth-child(8) { width: 120px; }
    .modern-pagi .pagi-table :is(th,td):nth-child(9) { width: 295px; }
}

.modern-ledger-action-menu { display: flex; align-items: center; justify-content: center; padding: 0; margin: 0; }
.modern-ledger-actions-trigger {
    display: inline-flex; align-items: center; gap: 8px; min-height: 36px;
    padding: 8px 12px; border: 1px solid #283044; border-radius: 10px;
    background: #283044; color: #fff; box-shadow: 0 2px 6px rgba(40,48,68,.12); white-space: nowrap; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.35; cursor: pointer;
}
.modern-ledger-actions-trigger:hover,
.modern-ledger-actions-trigger[aria-expanded="true"] { background: #3c4a60; border-color: #3c4a60; }
.modern-ledger-actions-trigger:focus-visible { outline: 3px solid rgba(120,161,187,.55); outline-offset: 3px; }
.modern-ledger-actions-chevron { margin-inline-start: 4px; transition: transform .12s ease; }
.modern-ledger-actions-trigger[aria-expanded="true"] .modern-ledger-actions-chevron { transform: rotate(180deg); }
.modern-ledger-actions-panel {
    position: fixed; inset: auto; margin: 0; box-sizing: border-box;
    width: min(420px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto;
    padding: 12px; border: 1px solid #d6e2dd; border-radius: 14px; background: #fff;
    color: #283044; box-shadow: 0 12px 38px rgba(40,48,68,.16); direction: rtl;
}
.modern-ledger-actions-panel::backdrop { background: transparent; }
.modern-ledger-actions-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding-inline-start: 4px; font-size: 13px; }
.modern-ledger-actions-heading .modern-icon-button { width: 28px; height: 28px; font-size: 21px; }
.modern-ledger-actions-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.modern-finance .modern-ledger-actions-grid .top-action-btn { min-height: 39px; width: 100%; margin: 0; padding: 9px 10px; justify-content: flex-start; text-align: start; white-space: normal; }
.modern-finance .modern-ledger-actions-grid .top-action-btn svg { flex-shrink: 0; }
@media screen and (min-width: 1101px) and (max-width: 1250px) {
    .modern-ledger .modern-ledger-summary .no-site-segment { padding-inline: 8px; }
    .modern-ledger .modern-ledger-summary .no-site-segment strong { font-size: 15px; }
}
@media screen and (max-width: 1100px) {
    .modern-ledger .modern-ledger-summary { grid-template-columns: minmax(0,1fr) auto; }
    .modern-ledger .modern-ledger-summary .reset-balance-box { grid-column: 1 / -1; }
    .modern-ledger .modern-ledger-summary .no-site-filter-card { grid-column: 1; min-width: 0; }
    .modern-ledger .modern-ledger-action-menu { grid-column: 2; }
}
@media screen and (max-width: 650px) {
    .modern-ledger .modern-ledger-summary { gap: 8px; }
    .modern-ledger .modern-ledger-summary .reset-balance-value { font-size: 21px; }
    .modern-ledger .modern-ledger-summary .no-site-filter-card { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .modern-ledger .modern-ledger-summary .no-site-overview { grid-column: 1 / -1; grid-row: 1; flex-direction: row; justify-content: space-between; }
    .modern-ledger .modern-ledger-summary .no-site-overview strong em { display: inline; margin-inline-start: 4px; }
    .modern-ledger .modern-ledger-summary .no-site-income { grid-column: 1; grid-row: 2; }
    .modern-ledger .modern-ledger-summary .no-site-expense { grid-column: 2; grid-row: 2; }
    .modern-ledger .modern-ledger-summary .no-site-segment { padding-inline: 8px; }
    .modern-ledger .modern-ledger-summary .no-site-segment strong { font-size: 14px; }
    .modern-ledger .excel-filter { box-sizing: border-box; min-width: 0; width: 240px; max-width: calc(100vw - 24px); }
    .modern-ledger .excel-filter .range-filter { flex-direction: column; align-items: stretch; }
    .modern-ledger .excel-filter .range-filter input { box-sizing: border-box; width: 100% !important; min-width: 0 !important; }
}
@media screen and (max-width: 359px) {
    .modern-ledger .modern-ledger-summary .no-site-segment { padding-inline: 4px; }
    .modern-ledger .modern-ledger-summary .no-site-segment strong { font-size: 12px; }
}
@media print { .modern-ledger-action-menu, .modern-ledger-actions-panel { display: none !important; } }

/* Row popovers stay in their table cell while the browser paints them above scrolling. */
@media screen {
    .modern-mizrahi.modern-row-actions-enabled .mizrahi-table :is(th,td):nth-child(2) {
        width: 60px;
        padding-inline: 6px;
    }
    .modern-mizrahi .modern-row-actions-trigger {
        position: relative; display: inline-flex; align-items: center; justify-content: center;
        width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 8px;
        background: transparent; color: #53616f; cursor: pointer;
    }
    .modern-mizrahi .modern-row-actions-trigger:hover,
    .modern-mizrahi .modern-row-actions-trigger[aria-expanded="true"] {
        background: #e8eeeb; border-color: #d6e2dd; color: #283044;
    }
    .modern-mizrahi .modern-row-actions-trigger:focus-visible,
    .modern-mizrahi .modern-row-actions-panel .act-btn:focus-visible {
        outline: 2px solid #78a1bb; outline-offset: 2px;
    }
    .modern-mizrahi td.actions:has(.act-comment.has-comments) .modern-row-actions-trigger {
        color: #2563eb;
    }
    .modern-mizrahi td.actions:has(.act-comment.has-comments) .modern-row-actions-trigger::after {
        content: ''; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px;
        border-radius: 50%; background: #2563eb;
    }
    .modern-mizrahi .modern-row-actions-panel {
        position: fixed; inset: auto; margin: 0; box-sizing: border-box;
        width: min(190px,calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto;
        padding: 5px; border: 1px solid #d6e2dd; border-radius: 10px; background: #fff;
        color: #283044; box-shadow: 0 8px 28px rgba(40,48,68,.18); direction: rtl; text-align: start;
    }
    .modern-mizrahi .modern-row-actions-panel::backdrop { background: transparent; }
    .modern-mizrahi .modern-row-actions-panel .act-btn {
        display: flex; align-items: center; justify-content: flex-start; gap: 9px;
        width: 100%; min-height: 36px; padding: 8px 10px; margin: 0; opacity: 1;
        font-family: inherit; font-size: 12px; line-height: 1.4; text-align: start; white-space: normal;
    }
    .modern-mizrahi .modern-row-actions-panel .act-btn svg { flex-shrink: 0; }
    .modern-mizrahi .modern-row-actions-panel .act-delete { color: #c0392b; }
    .modern-mizrahi .modern-row-actions-panel .act-btn:disabled { opacity: .5; cursor: wait; }
    .modern-mizrahi .modern-row-actions-panel .comment-badge {
        position: static; margin-inline-start: auto; flex-shrink: 0;
    }
}
@media print {
    .modern-row-actions-trigger, .modern-row-actions-panel { display: none !important; }
}
