/* 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; }

/* Keep operational tables readable on phones; scroll the table, not the page. */
.fuel-page .table-responsive,
.approvals-page .approval-items-table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}
.fuel-page .app-table { min-width: 1120px; }
.approvals-page .approval-items-table { min-width: 1280px; }
.fuel-page .app-table th, .fuel-page .app-table td,
.approvals-page .approval-items-table th, .approvals-page .approval-items-table td {
    overflow-wrap: break-word;
    word-break: normal;
}
.approvals-page .approval-items-table input[type=checkbox] {
    width: 20px; height: 20px; min-width: 20px; min-height: 20px; padding: 0;
}
@media (max-width: 760px) {
    .fuel-page .app-table th, .fuel-page .app-table td,
    .approvals-page .approval-items-table th, .approvals-page .approval-items-table td {
        padding: 12px;
        font-size: 14px;
        line-height: 1.45;
        vertical-align: top;
    }
    .approvals-page .approval-items-dialog { min-width: 0; max-width: 100%; }
    .fuel-page .kebab-button { min-width: 44px; min-height: 44px; }
    .approvals-page .approval-items-table .btn { min-height: 44px; }
    .mobile-table-hint { display: block; padding: 8px 16px; margin: 0; color: #526780; font-size: 13px; }
}
@media (min-width: 761px) { .mobile-table-hint { display: none; } }
.payment-requests-page .data-table.requests-overview-table {
    width: 100%; min-width: 940px; table-layout: fixed;
}
.payment-requests-page .data-table.requests-overview-table :is(th, td) {
    width: auto; min-width: 0; text-align: left; vertical-align: top;
    padding: 18px 16px; line-height: 1.5; word-break: normal; overflow-wrap: break-word;
}
.payment-requests-page .data-table.requests-overview-table :is(th, td):nth-child(1) { width: 128px; white-space: nowrap; }
.payment-requests-page .data-table.requests-overview-table :is(th, td):nth-child(2) { width: 23%; }
.payment-requests-page .data-table.requests-overview-table :is(th, td):nth-child(4) { width: 138px; text-align: right; white-space: nowrap; }
.payment-requests-page .data-table.requests-overview-table :is(th, td):nth-child(5) { width: 182px; }
.payment-requests-page .data-table.requests-overview-table :is(th, td):nth-child(6) { width: 76px; text-align: center; }
.payment-requests-page .requests-overview-table td > strong { display: block; font-weight: 600; }
.payment-requests-page .requests-overview-table td > small { display: block; margin-top: 5px; color: #526783; font-size: 13px; line-height: 1.45; }
.payment-requests-page .requests-overview-table .request-status-badge { min-width: 0; padding: 6px 12px; font-size: 13px; }
.payment-requests-page .requests-overview-table td > .urgent { color: #b91c1c; margin: 0 0 6px; }
