.swtp-wrapper {
	width: 100%;
	margin: 20px 0;
}

/* Wrapper DataTables generates around the whole widget (search box,
   length menu, the scrollable table, pagination). Keep it from ever
   forcing the outer page to scroll horizontally. */
.swtp-wrapper .dataTables_wrapper {
	width: 100%;
	max-width: 100%;
}

table.swtp-table {
	border-collapse: collapse;
	font-size: 14px;
}

table.swtp-table thead th {
	background: #f5f5f5;
	text-align: left;
	padding: 10px 8px;
	border-bottom: 2px solid #ddd;
	white-space: nowrap;
	position: sticky;
	top: 0;
	z-index: 1;
}

table.swtp-table tbody td {
	padding: 8px;
	border-bottom: 1px solid #eee;
	white-space: nowrap;
}

table.swtp-table tbody tr:hover {
	background: #fafafa;
}

/* DataTables builds these wrapper divs when scrollX/scrollY are on.
   This is the actual element that scrolls in both directions. */
.dataTables_scrollBody {
	-webkit-overflow-scrolling: touch; /* smooth momentum scroll on iOS */
	overflow: auto !important;
	border-bottom: 1px solid #ddd;
}

.dataTables_scrollHead,
.dataTables_scrollFoot {
	overflow: hidden;
}

/* Small visual hint that the table can be swiped horizontally */
.dataTables_scrollBody::-webkit-scrollbar {
	height: 8px;
	width: 8px;
}
.dataTables_scrollBody::-webkit-scrollbar-thumb {
	background: #c8c8c8;
	border-radius: 4px;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
	font-size: 13px;
	margin-bottom: 8px;
}

.dataTables_wrapper .dataTables_filter input {
	margin-left: 6px;
	padding: 4px 8px;
}

@media screen and (max-width: 782px) {
	.dataTables_wrapper .dataTables_length,
	.dataTables_wrapper .dataTables_filter {
		display: block;
		width: 100%;
		text-align: left;
	}

	.dataTables_wrapper .dataTables_length select {
		margin-left: 6px;
	}

	.dataTables_wrapper .dataTables_filter input {
		width: 100%;
		margin-left: 0;
		margin-top: 4px;
		box-sizing: border-box;
	}

	.dataTables_wrapper .dataTables_info {
		text-align: center;
	}

	.dataTables_wrapper .dataTables_paginate {
		text-align: center;
	}
}

/* -----------------------------------------------------------------
   Mobile "card" layout.
   frontend.js adds the swtp-mobile-cards class and skips scrollX/
   scrollY on small screens, and stamps every <td> with data-label
   (the column's header text). Here we turn each table row into a
   self-contained card of "Label: value" lines instead of forcing a
   cramped, horizontally-scrolling table onto a phone screen.
   ------------------------------------------------------------------ */
@media screen and (max-width: 782px) {
	table.swtp-table.swtp-mobile-cards {
		width: 100% !important;
		border: none;
	}

	table.swtp-table.swtp-mobile-cards thead {
		display: none;
	}

	table.swtp-table.swtp-mobile-cards,
	table.swtp-table.swtp-mobile-cards tbody,
	table.swtp-table.swtp-mobile-cards tr,
	table.swtp-table.swtp-mobile-cards td {
		display: block;
		width: 100%;
	}

	table.swtp-table.swtp-mobile-cards tbody tr {
		margin: 0 0 12px 0;
		padding: 4px 0;
		border: 1px solid #e2e2e2;
		border-radius: 8px;
		background: #fff;
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
		white-space: normal;
	}

	table.swtp-table.swtp-mobile-cards tbody tr:hover {
		background: #fff;
	}

	/* !important on white-space overrides DataTables' own ".nowrap"
	   class on the <table>, which shares the same CSS specificity. */
	table.swtp-table.swtp-mobile-cards td {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 12px;
		padding: 8px 12px;
		border-bottom: 1px solid #f0f0f0;
		white-space: normal !important;
		font-size: 14px;
	}

	table.swtp-table.swtp-mobile-cards td:last-child {
		border-bottom: none;
	}

	table.swtp-table.swtp-mobile-cards td::before {
		content: attr(data-label);
		flex: 0 0 42%;
		max-width: 42%;
		font-weight: 600;
		color: #555;
		text-align: left;
	}

	table.swtp-table.swtp-mobile-cards td:not(:empty) {
		text-align: right;
	}

	/* First cell of each row (typically the row number / primary key)
	   reads as the card's title instead of a plain label:value line. */
	table.swtp-table.swtp-mobile-cards td:first-child {
		background: #f7f7f7;
		border-radius: 8px 8px 0 0;
		border-bottom: 1px solid #eee;
		font-weight: 600;
	}

	table.swtp-table.swtp-mobile-cards td:first-child::before {
		color: #333;
	}
}
