/**
 * List table layout + column widths (all app list/data tables).
 * Loaded on app pages via includes/head.php.
 *
 * Strategy (table-layout: auto):
 * - Compact columns: width 1% + white-space nowrap (shrink to content).
 * - Text-heavy columns: no width — absorb remaining space; ellipsis when tight.
 * Avoid min-width on many columns: with fixed layout that causes overlap.
 */

.table.list-table,
.list-table {
	width: 100%;
	table-layout: auto;
	border-collapse: collapse;
}

/* Prevent cell content painting over neighbouring columns when space is tight */
.list-table thead th,
.list-table tbody td {
	overflow: hidden;
}

.table-responsive > .list-table {
	margin-bottom: 0;
}

/* ─── Checkbox column ─────────────────────────────────────────── */
.list-table .list-col-select,
.list-table .client-col-select {
	width: 2.75rem;
	min-width: 2.75rem;
	max-width: 2.75rem;
	padding-left: 12px;
	padding-right: 8px;
	text-align: center;
	white-space: nowrap;
	vertical-align: middle;
}

.list-table .list-col-select .form-check-input,
.list-table .client-col-select .form-check-input {
	margin: 0;
	flex-shrink: 0;
	float: none;
	vertical-align: middle;
	cursor: pointer;
}

/* ─── Document list columns (invoices, quotations, notes, proforma) ─ */
.list-table .doc-list-col-number {
	width: 1%;
	min-width: 3.25rem;
	max-width: 5.5rem;
	white-space: nowrap;
}

.list-table .doc-list-col-client {
	width: auto;
	min-width: 10rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.list-table .doc-list-col-date {
	width: 1%;
	min-width: 6.25rem;
	max-width: 7.5rem;
	white-space: nowrap;
}

.list-table .doc-list-col-amount {
	width: 1%;
	min-width: 6.75rem;
	max-width: 10rem;
	white-space: nowrap;
	text-align: right;
}

.list-table thead .doc-list-col-amount {
	text-align: right;
}

.list-table .doc-list-col-status {
	width: 1%;
	min-width: 5.25rem;
	max-width: 8rem;
	white-space: nowrap;
}

/* ─── Clients ───────────────────────────────────────────────── */
.list-table .clients-col-name {
	width: 20%;
	min-width: 9rem;
	max-width: 15rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: middle;
}

.list-table .clients-col-phone {
	width: 1%;
	min-width: 7.25rem;
	max-width: 8.5rem;
	white-space: nowrap;
	vertical-align: middle;
}

.list-table .clients-col-email {
	width: 1%;
	min-width: 10.5rem;
	max-width: 14rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: middle;
}

.list-table .clients-col-address {
	width: auto;
	min-width: 12rem;
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
	line-height: 1.45;
	vertical-align: top;
}

.list-table .clients-col-gstin {
	width: 1%;
	min-width: 9rem;
	max-width: 11rem;
	white-space: nowrap;
	vertical-align: middle;
}

/* ─── Expenses ──────────────────────────────────────────────── */
.list-table .expenses-col-date,
.list-table .expenses-col-amount,
.list-table .expenses-col-status,
.list-table .expenses-col-category,
.list-table .expenses-col-payment {
	width: 1%;
	white-space: nowrap;
}

.list-table .expenses-col-description {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.list-table .expenses-col-vendor {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.list-table .expenses-col-amount {
	text-align: right;
}

.list-table thead .expenses-col-amount {
	text-align: right;
}

/* ─── Inventory ─────────────────────────────────────────────── */
.list-table .inventory-col-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.list-table .inventory-col-type,
.list-table .inventory-col-code {
	width: 1%;
	white-space: nowrap;
}

.list-table .inventory-col-qty,
.list-table .inventory-col-rate,
.list-table .inventory-col-discount,
.list-table .inventory-col-tax {
	width: 1%;
	white-space: nowrap;
	text-align: right;
}

.list-table thead .inventory-col-qty,
.list-table thead .inventory-col-rate,
.list-table thead .inventory-col-discount,
.list-table thead .inventory-col-tax {
	text-align: right;
}

/* ─── Users ─────────────────────────────────────────────────── */
.list-table .users-col-username {
	width: auto;
	min-width: 9rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.list-table .users-col-login {
	width: 1%;
	min-width: 8.5rem;
	max-width: 10.5rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.list-table .users-col-status {
	width: 1%;
	min-width: 5.5rem;
	max-width: 7rem;
	white-space: nowrap;
}

.list-table .users-col-created {
	width: 1%;
	min-width: 6.75rem;
	max-width: 8.5rem;
	white-space: nowrap;
}

.list-table .users-col-actions {
	width: 1%;
	min-width: 12.5rem;
	white-space: nowrap;
	overflow: visible;
}

/* ─── TDS / generic data tables inside app cards ──────────────── */
.table.osinv-data-table,
.osinv-data-table.table {
	width: 100%;
	table-layout: auto;
}

.osinv-data-table .osinv-col-date,
.osinv-data-table .osinv-col-section,
.osinv-data-table .osinv-col-ref,
.osinv-data-table .osinv-col-amount,
.osinv-data-table .osinv-col-status,
.osinv-data-table .osinv-col-actions {
	width: 1%;
	white-space: nowrap;
}

.osinv-data-table .osinv-col-name,
.osinv-data-table .osinv-col-client,
.osinv-data-table .osinv-col-desc {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.osinv-data-table .osinv-col-ref {
	overflow: hidden;
	text-overflow: ellipsis;
}

.osinv-data-table .osinv-col-amount {
	text-align: right;
}

.osinv-data-table thead .osinv-col-amount {
	text-align: right;
}

.osinv-data-table .osinv-col-actions {
	text-align: right;
}

/* ─── Sendouts history table ──────────────────────────────────── */
.sendouts-table {
	table-layout: auto;
}

.sendouts-table__when,
.sendouts-table__doc,
.sendouts-table__status,
.sendouts-table__actions {
	width: 1%;
	white-space: nowrap;
}

.sendouts-table__to,
.sendouts-table__subject {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Dashboard iframe: horizontal scroll when the pane is narrower than the table */
body.doc-list-in-dashboard .list-table {
	min-width: 52rem;
}

body.doc-list-in-dashboard .clients-data-table.list-table {
	min-width: 58rem;
}

/* Mobile: list tables scroll horizontally inside panel */
@media (max-width: 767.98px) {
	.doc-list-panel__body .table-responsive,
	.clients-panel__body .table-responsive,
	.expenses-panel__body .table-responsive,
	.inventory-panel__body .table-responsive,
	.users-panel__body .table-responsive {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.list-table {
		min-width: 44rem;
	}
}
