/*
Table primitives and semantic column widths.
When adding new table columns, assign a column class by data type instead of
hard-coding per-screen widths.
*/

.erp-table {
    table-layout: fixed;
    width: 100%;
}

.erp-table th,
.erp-table td {
    min-width: 0;
}

.erp-table .col-doc,
.erp-table .col-date,
.erp-table .col-code,
.erp-table .col-status,
.erp-table .col-actions,
.erp-table .col-qty,
.erp-table .col-money,
.erp-table .col-uom {
    white-space: nowrap;
}

.erp-table .col-doc {
    width: var(--erp-table-doc-width, 128px);
}

.erp-table .col-date {
    width: var(--erp-table-date-width, 112px);
}

.erp-table .col-code {
    width: var(--erp-table-code-width, 128px);
}

.erp-table .col-status {
    width: var(--erp-table-status-width, 104px);
}

.erp-table .col-actions {
    width: var(--erp-table-actions-width, 132px);
}

.erp-table .col-qty {
    text-align: right;
    width: var(--erp-table-qty-width, 128px);
}

.erp-table .col-money {
    text-align: right;
    width: var(--erp-table-money-width, 156px);
}

.erp-table .col-uom {
    width: var(--erp-table-uom-width, 92px);
}

.erp-table .col-partner {
    min-width: var(--erp-table-partner-min, 220px);
}

.erp-table .col-material {
    min-width: var(--erp-table-material-min, 280px);
}

.erp-table .cell-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-table .cell-actions {
    align-items: center;
    display: inline-flex;
    flex-wrap: nowrap;
    gap: var(--erp-gap-sm, 8px);
    white-space: nowrap;
}

/*
Workable table guard.
Transactional screens must fit inside the workspace tab. Data stays on one row;
long values truncate instead of making the whole page horizontally scroll.
*/
html[data-ui-theme] body:not(.auth-page) table,
html[data-ui-theme] body:not(.auth-page) table[data-bee-column-classified="1"],
html[data-ui-theme] body:not(.auth-page) #masterTable[data-bee-column-classified="1"] {
    table-layout: fixed !important;
    width: 100% !important;
    max-width: 100% !important;
}

html[data-ui-theme] body:not(.auth-page) .table-scroll,
html[data-ui-theme] body:not(.auth-page) .report-table-shell,
html[data-ui-theme] body:not(.auth-page) .purchase-table-wrap,
html[data-ui-theme] body:not(.auth-page) .sales-table-wrap,
html[data-ui-theme] body:not(.auth-page) .movement-table-wrap,
html[data-ui-theme] body:not(.auth-page) .master-table-wrap {
    max-width: 100%;
    overflow-x: hidden !important;
}

html[data-ui-theme] body:not(.auth-page) th,
html[data-ui-theme] body:not(.auth-page) td {
    min-width: 0 !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap !important;
}

html[data-ui-theme] body:not(.auth-page) td > br {
    display: none;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-index {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 52px !important;
    text-align: center;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-code {
    width: 128px !important;
    min-width: 0 !important;
    max-width: 148px !important;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-date {
    width: 112px !important;
    min-width: 0 !important;
    max-width: 120px !important;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-status {
    width: 104px !important;
    min-width: 0 !important;
    max-width: 116px !important;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-qty,
html[data-ui-theme] body:not(.auth-page) .bee-col-number {
    width: 112px !important;
    min-width: 0 !important;
    max-width: 128px !important;
    text-align: right;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-amount,
html[data-ui-theme] body:not(.auth-page) .numeric-cell.bee-col-amount {
    width: 144px !important;
    min-width: 0 !important;
    max-width: 164px !important;
    text-align: right;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-action,
html[data-ui-theme] body:not(.auth-page) .action-cell,
html[data-ui-theme] body:not(.auth-page) .master-action-cell {
    width: 104px !important;
    min-width: 88px !important;
    max-width: 124px !important;
    overflow: visible !important;
    text-align: right;
    white-space: nowrap !important;
}

html[data-ui-theme] body:not(.auth-page) .bee-col-text {
    min-width: 0 !important;
    max-width: none !important;
}

html[data-ui-theme] body:not(.auth-page) .row-actions,
html[data-ui-theme] body:not(.auth-page) .list-actions,
html[data-ui-theme] body:not(.auth-page) .master-row-actions,
html[data-ui-theme] body:not(.auth-page) .cell-actions {
    align-items: center;
    display: inline-flex;
    flex-wrap: nowrap !important;
    gap: 6px;
    justify-content: flex-end;
}

html[data-ui-theme] body:not(.auth-page) td.action-cell > form,
html[data-ui-theme] body:not(.auth-page) td.master-action-cell > form,
html[data-ui-theme] body:not(.auth-page) td.action-cell > .actions,
html[data-ui-theme] body:not(.auth-page) td.master-action-cell > .actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
}

html[data-ui-theme] body:not(.auth-page) .status-pill,
html[data-ui-theme] body:not(.auth-page) .erp-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[data-ui-theme] body:not(.auth-page) .cell-truncate,
html[data-ui-theme] body:not(.auth-page) .erp-truncate,
html[data-ui-theme] body:not(.auth-page) .text-clip {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html[data-ui-theme] body:not(.auth-page) td input,
html[data-ui-theme] body:not(.auth-page) td select,
html[data-ui-theme] body:not(.auth-page) td textarea {
    min-width: 0;
    max-width: 100%;
}
