/* Keep overflow inside the data region, never outside the page/card. */
/* Dialogs must fit a laptop viewport at normal zoom, including their padding. */
.invoices-page .invoice-modal-overlay,
.payment-requests-page .request-form-overlay,
.maintenance-page .maintenance-modal-overlay { padding: 12px; overflow-y: auto; align-items: flex-start; }
.invoices-page .invoice-modal,
.payment-requests-page .request-form-modal,
.maintenance-page .maintenance-modal {
    box-sizing: border-box; min-width: 0; width: min(1180px, 100%);
    max-height: calc(100dvh - 24px); margin: auto; overflow-y: auto;
    overscroll-behavior: contain;
}
.invoice-modal .form-field, .request-form-modal .form-field,
.maintenance-modal .form-group { min-width: 0; }
.invoice-modal input, .invoice-modal select,
.request-form-modal input, .request-form-modal select,
.maintenance-modal input, .maintenance-modal select { min-width: 0; max-width: 100%; box-sizing: border-box; }
.allocation-confirm-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; }
.allocation-confirm-actions p { flex: 1 1 260px; }
body:has(.invoice-modal-overlay, .request-form-overlay, .maintenance-modal-overlay, .lote-overlay) { overflow: hidden; }
@media (max-width: 1000px) {
    .invoices-page .invoice-item-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .invoices-page .rateio-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 800px) {
    .invoices-page .invoice-modal, .payment-requests-page .request-form-modal,
    .maintenance-page .maintenance-modal { padding: 16px; }
}
.fincore-workspace, .fincore-content,
.fincore-content > *, .module-page, .finance-page,
.table-card, .finance-table-card { min-width: 0; max-width: 100%; }

.fincore-content .summary-grid,
.fincore-content .finance-summary-grid,
.fincore-content .feature-cards {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.fincore-content .summary-card > div:last-child,
.fincore-content .finance-summary-card > div:last-child { min-width: 0; flex: 1; }
.fincore-content .summary-card strong,
.fincore-content .finance-summary-card strong,
.fincore-content .summary-card small,
.fincore-content .finance-summary-card small {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.finance-dashboard-page .finance-responsive-table,
.finance-dashboard-page .payment-batches-scroll,
.approvals-page .finance-table-wrapper,
.invoices-page .table-responsive,
.financial-classifications-page .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
}
.finance-dashboard-page .finance-dashboard-table {
    min-width: 1200px;
    table-layout: auto;
}
.finance-dashboard-page .finance-dashboard-table th,
.finance-dashboard-page .finance-dashboard-table td { overflow-wrap: normal; word-break: normal; }
.finance-dashboard-page .payment-batches-table,
.approvals-page .finance-table { min-width: 1150px; }
.approvals-page .finance-table th,
.approvals-page .finance-table td { overflow-wrap: normal; word-break: normal; }
.invoices-page .invoice-list-table { min-width: 1100px; }
.invoices-page .invoice-status-badge {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.25;
}

/* Reserve room for actions below the last row instead of hiding the menu. */
.financial-classifications-page .data-table tbody tr .kebab-menu {
    top: calc(100% + .45rem);
    bottom: auto;
    right: 0;
    left: auto;
    transform: none;
}
.financial-classifications-page .table-responsive:has(.is-open) { padding-bottom: 150px; }
.finance-dashboard-page .finance-responsive-table:has(.is-open),
.invoices-page .table-responsive:has(.is-open) {
    padding-block: 180px;
}

/* Lote actions open below the trigger without shifting the table header. */
.approvals-page .finance-table tbody tr .kebab-menu {
    top: calc(100% + .45rem);
    bottom: auto;
}
.approvals-page .finance-table-wrapper:has(.is-open) {
    padding-top: 0;
    padding-bottom: 100px;
}

@media (max-width: 900px) {
    .fincore-content .module-header,
    .fincore-content .finance-page-header,
    .fincore-content .finance-table-header { flex-wrap: wrap; }
    .fincore-content .module-header-actions { flex-shrink: 1; }
}
/* Password visibility controls also work on server-rendered account forms. */
.form-floating:has([data-password-toggle]) { position: relative; }
.form-floating:has([data-password-toggle]) > input { padding-right: 58px; }
