/* Live Sheet Table: front end. Colors and fonts arrive as CSS custom properties on .lst-wrap. */

.lst-wrap {
	--lst-header-bg: #1f2933;
	--lst-header-text: #ffffff;
	--lst-body-bg: #ffffff;
	--lst-body-text: #1f2933;
	--lst-stripe-bg: #f5f7f9;
	--lst-hover-bg: #eaf1ff;
	--lst-border: #dce1e6;
	--lst-accent: #2563eb;
	--lst-radius: 6px;

	font-family: var(--lst-font, inherit);
	font-size: var(--lst-font-size, inherit);
	margin: 0 0 1.5em;
	max-width: var(--lst-max-width, none);
}

.lst-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Toolbar */
.lst-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75em 1.25em;
	margin-bottom: 0.75em;
}

.lst-search-field {
	position: relative;
	flex: 1 1 18em;
	max-width: 28em;
}

.lst-search-icon {
	position: absolute;
	left: 0.75em;
	top: 50%;
	width: 1em;
	height: 1em;
	transform: translateY(-50%);
	opacity: 0.55;
	pointer-events: none;
	color: var(--lst-body-text);
	z-index: 1;
}

.lst-wrap .lst-search {
	font: inherit;
}

.lst-wrap.lst-wrap .lst-search {
	box-sizing: border-box !important;
	width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0.6em 0.85em 0.6em 2.3em !important;
	color: var(--lst-body-text) !important;
	background: var(--lst-body-bg) !important;
	border: 1px solid var(--lst-border) !important;
	border-radius: var(--lst-radius) !important;
	box-shadow: none !important;
}

.lst-wrap.lst-wrap .lst-search:focus {
	outline: 2px solid var(--lst-accent) !important;
	outline-offset: 1px !important;
	border-color: var(--lst-accent) !important;
}

.lst-count {
	margin: 0;
	font-size: 0.875em;
	opacity: 0.75;
}

/* Table */
.lst-scroll {
	overflow-x: auto;
	border: 1px solid var(--lst-border);
	border-radius: var(--lst-radius);
	background: var(--lst-body-bg);
	-webkit-overflow-scrolling: touch;
}

.lst-scroll:focus-visible {
	outline: 2px solid var(--lst-accent);
	outline-offset: 2px;
}

.lst-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	border: 0;
	background: var(--lst-body-bg);
	color: var(--lst-body-text);
	font-size: 1em;
	table-layout: auto;
}

.lst-table th,
.lst-table td {
	padding: 0.7em 0.9em;
	text-align: left;
	vertical-align: top;
	border: 0;
	border-bottom: 1px solid var(--lst-border);
}

.lst-table thead th {
	background: var(--lst-header-bg);
	color: var(--lst-header-text);
	font-family: var(--lst-header-font, var(--lst-font, inherit));
	font-weight: 600;
	white-space: nowrap;
	border-bottom: 0;
}

.lst-wrap:not(.lst-ready) .lst-table tbody tr:nth-child(even) td,
.lst-table tbody tr.lst-alt td {
	background: var(--lst-stripe-bg);
}

.lst-table tbody tr:hover td {
	background: var(--lst-hover-bg);
}

.lst-table tbody tr:last-child td {
	border-bottom: 0;
}

/*
 * Theme shield.
 * Themes and page builders (Beaver Builder's global button styles, for one) style every
 * <button>, <input> and <th> on the page with long selectors. The doubled .lst-wrap class
 * outranks those selectors, and !important covers the properties themes most often force.
 * Colors still come from the --lst-* variables, so plugin and module settings stay in charge.
 * Typography is left out on purpose so Beaver Builder's typography fields can still apply.
 */
.lst-wrap.lst-wrap .lst-table thead th {
	background: var(--lst-header-bg) !important;
	color: var(--lst-header-text) !important;
}

.lst-wrap.lst-wrap .lst-table tbody td {
	color: var(--lst-body-text) !important;
	background: var(--lst-body-bg) !important;
}

.lst-wrap.lst-wrap:not(.lst-ready) .lst-table tbody tr:nth-child(even) td,
.lst-wrap.lst-wrap .lst-table tbody tr.lst-alt td {
	background: var(--lst-stripe-bg) !important;
}

.lst-wrap.lst-wrap .lst-table tbody tr:hover td {
	background: var(--lst-hover-bg) !important;
}

/* Sort buttons */
.lst-wrap.lst-wrap .lst-table .lst-sort,
.lst-wrap.lst-wrap .lst-table .lst-sort:hover,
.lst-wrap.lst-wrap .lst-table .lst-sort:focus,
.lst-wrap.lst-wrap .lst-table .lst-sort:active {
	all: unset !important;
	box-sizing: border-box !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 0.45em !important;
	width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	color: inherit !important;
	font: inherit !important;
	letter-spacing: inherit !important;
	text-transform: inherit !important;
	text-decoration: none !important;
	text-align: left !important;
	cursor: pointer !important;
}

.lst-wrap.lst-wrap .lst-table .lst-sort:focus-visible {
	outline: 2px solid var(--lst-accent) !important;
	outline-offset: 3px !important;
	border-radius: 2px !important;
}

.lst-sort-icon {
	display: inline-flex;
	flex-direction: column;
	gap: 2px;
	opacity: 0.45;
}

.lst-sort-icon::before,
.lst-sort-icon::after {
	content: "";
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
}

.lst-sort-icon::before { border-bottom: 5px solid currentColor; }
.lst-sort-icon::after  { border-top: 5px solid currentColor; }

.lst-table th[aria-sort="ascending"] .lst-sort-icon,
.lst-table th[aria-sort="descending"] .lst-sort-icon { opacity: 1; }
.lst-table th[aria-sort="ascending"] .lst-sort-icon::after { opacity: 0.25; }
.lst-table th[aria-sort="descending"] .lst-sort-icon::before { opacity: 0.25; }

/* Empty state, pager, updated stamp */
.lst-empty {
	margin: 0.75em 0 0;
	padding: 1em;
	text-align: center;
	border: 1px dashed var(--lst-border);
	border-radius: var(--lst-radius);
}

.lst-pager {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75em;
	margin-top: 0.75em;
	font-size: 0.9em;
}

.lst-pager button {
	font: inherit;
}

.lst-wrap.lst-wrap .lst-pager button,
.lst-wrap.lst-wrap .lst-pager button:hover,
.lst-wrap.lst-wrap .lst-pager button:focus {
	width: auto !important;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0.4em 0.9em !important;
	color: var(--lst-accent) !important;
	background: transparent !important;
	border: 1px solid var(--lst-border) !important;
	border-radius: var(--lst-radius) !important;
	box-shadow: none !important;
	font: inherit !important;
	letter-spacing: inherit !important;
	text-transform: inherit !important;
	text-decoration: none !important;
	cursor: pointer;
}

.lst-wrap.lst-wrap .lst-pager button:hover:not(:disabled) {
	border-color: var(--lst-accent) !important;
}

.lst-wrap.lst-wrap .lst-pager button:focus-visible {
	outline: 2px solid var(--lst-accent) !important;
	outline-offset: 1px !important;
}

.lst-wrap.lst-wrap .lst-pager button:disabled {
	opacity: 0.4;
	cursor: default;
}

.lst-updated {
	margin: 0.75em 0 0;
	font-size: 0.85em;
	opacity: 0.75;
}

.lst-notice {
	padding: 0.75em 1em;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
	color: #1d2327;
}

/* Layout: centered stack */
.lst-wrap.lst-align-center {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

.lst-wrap.lst-align-center .lst-toolbar {
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.lst-wrap.lst-align-center .lst-search-field {
	flex: none;
	width: 100%;
}

.lst-wrap.lst-wrap.lst-align-center .lst-search {
	text-align: left !important;
}

.lst-wrap.lst-wrap.lst-align-center .lst-table th,
.lst-wrap.lst-wrap.lst-align-center .lst-table td {
	text-align: center !important;
}

.lst-wrap.lst-wrap.lst-align-center .lst-table .lst-sort,
.lst-wrap.lst-wrap.lst-align-center .lst-table .lst-sort:hover,
.lst-wrap.lst-wrap.lst-align-center .lst-table .lst-sort:focus,
.lst-wrap.lst-wrap.lst-align-center .lst-table .lst-sort:active {
	justify-content: center !important;
	text-align: center !important;
}

.lst-wrap.lst-align-center .lst-pager {
	justify-content: center;
}

@media (prefers-reduced-motion: no-preference) {
	.lst-table tbody td { transition: background-color 0.12s ease; }
}
