.sc-table-wrap {
	margin: 24px 0;
	font-family: var( --font-body, -apple-system, BlinkMacSystemFont, sans-serif );
	color: var( --text-body, #2a3b48 );
	font-size: 15px;
}

.sc-table-caption {
	font-family: var( --font-head, Georgia, serif );
	color: var( --navy, #0f2f4c );
	font-weight: 600;
	margin-bottom: 8px;
	font-size: 17px;
}

.sc-table-not-found {
	color: #b32d2e;
	font-style: italic;
}

/* controls: search box + row count, injected by frontend.js */
.sc-table-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
	flex-wrap: wrap;
}

.sc-table-search {
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1.5px solid var( --border-strong, #d9d4c8 );
	border-radius: 20px;
	padding: 6px 14px;
	background: var( --sand, #faf9f6 );
	flex: 1 1 240px;
	max-width: 320px;
}

.sc-table-search input {
	border: none;
	background: transparent;
	outline: none;
	font-size: 16px; /* iOS Safari auto-zooms on focus for inputs under 16px */
	width: 100%;
	font-family: inherit;
	color: var( --text, #152a3a );
}

.sc-table-search svg {
	flex: none;
	width: 15px;
	height: 15px;
	stroke: var( --muted, #8a97a3 );
}

.sc-table-count {
	font-size: 12.5px;
	color: var( --text-muted, #5b6a76 );
	white-space: nowrap;
}

.sc-priority-toggle {
	display: none;
	border: 1.5px solid var( --border-strong, #d9d4c8 );
	background: #fff;
	border-radius: 20px;
	padding: 6px 14px;
	font-size: 13px;
	cursor: pointer;
	color: var( --navy, #0f2f4c );
	margin-bottom: 10px;
}

/* base table */
.sc-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	position: relative;
	border: 1px solid var( --border, #eceae4 );
	border-radius: 8px;
}

table.sc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

table.sc-table thead th {
	background: var( --navy, #0f2f4c );
	color: #fff;
	text-align: left;
	padding: 11px 14px;
	font-family: var( --font-head, Georgia, serif );
	font-weight: 600;
	white-space: nowrap;
}

table.sc-table th.sc-sortable {
	cursor: pointer;
	user-select: none;
}

.sc-sort-icon::after {
	content: '\2195';
	display: inline-block;
	margin-left: 6px;
	opacity: 0.45;
	font-size: 11px;
}

th[aria-sort='ascending'] .sc-sort-icon::after {
	content: '\25B2';
	opacity: 1;
}

th[aria-sort='descending'] .sc-sort-icon::after {
	content: '\25BC';
	opacity: 1;
}

table.sc-table tbody td {
	padding: 10px 14px;
	border-bottom: 1px solid var( --border, #eceae4 );
	vertical-align: top;
}

table.sc-table tbody tr:nth-child( even ) td {
	background: var( --sand-dark, #f2efe6 );
}

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

table.sc-table tbody td a {
	color: var( --link, #0f2f4c );
}

table.sc-table tbody td a:hover {
	color: var( --link-hover, #c9522f );
}

/* pagination */
.sc-table-pagination {
	display: flex;
	gap: 6px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 14px;
}

.sc-table-pagination button {
	border: 1.5px solid var( --border-strong, #d9d4c8 );
	background: #fff;
	border-radius: 6px;
	min-width: 32px;
	padding: 5px 9px;
	font-size: 13px;
	cursor: pointer;
	color: var( --text, #152a3a );
}

.sc-table-pagination button[aria-current='true'] {
	background: var( --navy, #0f2f4c );
	border-color: var( --navy, #0f2f4c );
	color: #fff;
}

.sc-table-pagination button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ---- mobile layouts (≤767px) ---- */
@media ( max-width: 767px ) {
	/* stacked cards: header row hidden, each cell becomes label:value */
	.sc-table-layout-cards .sc-table-scroll {
		overflow: visible;
		border: none;
	}

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

	.sc-table-layout-cards table.sc-table thead {
		display: none;
	}

	.sc-table-layout-cards table.sc-table tbody tr {
		margin-bottom: 14px;
		border: 1px solid var( --border, #eceae4 );
		border-radius: 8px;
		overflow: hidden;
		background: #fff;
		box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.06 );
	}

	.sc-table-layout-cards table.sc-table tbody td {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 14px;
		text-align: right;
		background: none !important;
	}

	.sc-table-layout-cards table.sc-table tbody td::before {
		content: attr( data-label );
		font-weight: 600;
		font-family: var( --font-head, Georgia, serif );
		color: var( --navy, #0f2f4c );
		text-align: left;
		margin-right: auto;
	}

	.sc-table-layout-cards table.sc-table tbody td:empty::before {
		content: none;
	}

	/* horizontal scroll: sticky first column + scroll shadow cue */
	.sc-table-layout-scroll .sc-table-scroll {
		box-shadow: inset -8px 0 6px -6px rgba( 0, 0, 0, 0.08 );
	}

	.sc-table-layout-scroll .sc-table-scroll.sc-scrolled-end {
		box-shadow: none;
	}

	.sc-table-layout-scroll table.sc-table th:first-child,
	.sc-table-layout-scroll table.sc-table td:first-child {
		position: sticky;
		left: 0;
		background: #fff;
		box-shadow: 2px 0 4px rgba( 0, 0, 0, 0.06 );
	}

	.sc-table-layout-scroll table.sc-table thead th:first-child {
		background: var( --navy, #0f2f4c );
	}

	/* priority columns: hide flagged columns, reveal via toggle */
	.sc-priority-toggle {
		display: inline-block;
	}

	.sc-table-layout-priority th.sc-priority-hide,
	.sc-table-layout-priority td.sc-priority-hide {
		display: none;
	}

	.sc-table-layout-priority.sc-show-all th.sc-priority-hide,
	.sc-table-layout-priority.sc-show-all td.sc-priority-hide {
		display: table-cell;
	}
}
