/* ============================================
   Unified Table Styles
   ============================================
   Base:    .erp-table
   Compact: .erp-table-compact (nested/secondary)
   Hover:   .erp-table-hover (interactive rows)
   ============================================ */

/* --- Base table --- */
.erp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.erp-table th {
    background: var(--background);
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.erp-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

/* --- Interactive rows modifier --- */
.erp-table-hover tr:hover {
    background: var(--background);
}

/* --- Compact variant (nested/secondary) ---
   Self-sufficient: usable standalone or combined
   with .erp-table for an override. */
.erp-table-compact {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.erp-table-compact th {
    padding: 0.25rem 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.erp-table-compact td {
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.erp-table-compact tbody tr:last-child td {
    border-bottom: none;
}

/* --- Column utilities --- */
.col-narrow {
    white-space: nowrap;
    width: 1%;
}

.col-flex {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.col-numeric {
    text-align: right;
    white-space: nowrap;
}

/* --- Actions column --- */
.erp-table .actions-col {
    text-align: center;
    white-space: nowrap;
    width: 1%;
}

.actions-col > * + * {
    margin-left: 0.25rem;
}

/* --- Shortage row highlight --- */
.row-shortage td {
    background: var(--danger-bg, #fff0f0);
    color: var(--danger-text, #c0392b);
}

/* --- Detail row (collapsible content below data rows) --- */
.detail-row.hidden {
    display: none;
}

/* --- Main list integration --- */

/* Checkbox column: restore center alignment that
   .erp-table th { text-align: left } would override */
.erp-table .th-checkbox,
.erp-table .td-checkbox {
    text-align: center;
}

/* Sort/filter headers contain interactive controls
   (.th-sort-btn) with their own 0.25rem
   0.5rem padding; reduce th padding so total aligns
   with data cell padding (0.5rem 0.75rem) */
.erp-table .th-sortable {
    padding: 0.25rem;
}
