/*
 * PureCSS.com
 * https://purecss.com/sticky-table-header/
 * A table header that stays fixed while scrolling using position: sticky on <thead>.
 */

.demo-sticky-table-header .table-scroll {
		max-height: 240px;
		overflow-y: auto;
		border: 1px solid var(--border);
		border-radius: var(--radius-lg);
	}

.demo-sticky-table-header table {
		width: 100%;
		border-collapse: collapse;
		font-size: .875rem;
	}

.demo-sticky-table-header thead th {
		position: sticky;
		top: 0;
		z-index: 1;
		background: var(--surface);
		padding: .75rem 1rem;
		text-align: left;
		font-weight: 600;
		font-size: .8rem;
		text-transform: uppercase;
		letter-spacing: .06em;
		color: var(--text-muted);
		border-bottom: 1px solid var(--border);
	}

.demo-sticky-table-header tbody tr {
		border-bottom: 1px solid var(--border);
		transition: background .15s;
	}

:is(.demo-sticky-table-header tbody tr):last-child {
			border-bottom: none;
		}

:is(.demo-sticky-table-header tbody tr):hover {
			background: var(--surface-2);
		}

.demo-sticky-table-header tbody td {
		padding: .65rem 1rem;
		color: var(--text);
	}

:is(.demo-sticky-table-header tbody td):first-child {
			font-weight: 500;
		}

.demo-sticky-table-header .badge-status {
		display: inline-block;
		padding: .2rem .6rem;
		border-radius: 99px;
		font-size: .75rem;
		font-weight: 600;
	}

.demo-sticky-table-header .badge-active {
		background: rgba(87, 217, 163, .12);
		color: var(--teal);
	}

.demo-sticky-table-header .badge-pending {
		background: rgba(255, 212, 68, .12);
		color: var(--yellow);
	}

.demo-sticky-table-header .badge-inactive {
		background: var(--surface-2);
		color: var(--text-muted);
	}

/* ── Variant: sticky header and sticky first column ── */

/* both axes scroll, so both axes can pin */
.demo-sticky-table-header .table-scroll-2d {
		width: 100%;
		overflow: auto;
	}

/* wider than its container, or there is nothing to scroll sideways */
.demo-sticky-table-header .table-2d {
		min-width: 980px;
	}

.demo-sticky-table-header .table-2d thead th {
		z-index: 2;
		/* a collapsed border belongs to the table and scrolls away with it,
		   an inset shadow belongs to the cell and travels with it */
		border-bottom: none;
		box-shadow: inset 0 -1px 0 var(--border);
	}

.demo-sticky-table-header .table-2d tbody th {
		position: sticky;
		left: 0;
		z-index: 1;
		background: var(--surface);
		padding: .65rem 1rem;
		text-align: left;
		font-weight: 600;
		font-size: .85rem;
		color: var(--text);
		box-shadow: inset -1px 0 0 var(--border);
	}

/* the corner cell pins on both axes, so it has to outrank both */
.demo-sticky-table-header .table-2d thead th:first-child {
		left: 0;
		z-index: 3;
		box-shadow: inset -1px -1px 0 var(--border);
	}

.demo-sticky-table-header .table-2d tbody td {
		white-space: nowrap;
	}

/* ── Variant: totals pinned to the bottom edge ── */

.demo-sticky-table-header .table-scroll-foot {
		width: 100%;
	}

.demo-sticky-table-header .table-foot tfoot td {
		position: sticky;
		bottom: 0;
		z-index: 1;
		background: var(--surface-2);
		padding: .65rem 1rem;
		font-weight: 600;
		color: var(--text);
		/* the line that matters here is above the row, not below it */
		box-shadow: inset 0 1px 0 var(--border);
	}

/* The card preview scrolls to show the sticky header, so it keeps its pointer events
   instead of letting clicks fall through to the card link. */
.card-preview .demo-sticky-table-header {
	pointer-events: auto;
}
