/**
 * XML FTP Tables – wygląd tabeli na stronie.
 *
 * Kolory oparte na półprzezroczystej szarości dopasowują się do jasnych i ciemnych
 * motywów. Każdą wartość można nadpisać zmiennymi CSS w motywie, np.:
 * .xft-table-wrap { --xft-accent: #c00; }
 */

.xft-table-wrap {
	--xft-accent: #2563eb;
	--xft-accent-text: #fff;
	--xft-border: rgba(127, 127, 127, 0.28);
	--xft-header-bg: rgba(127, 127, 127, 0.11);
	--xft-stripe: rgba(127, 127, 127, 0.05);
	--xft-hover: rgba(127, 127, 127, 0.1);
	--xft-radius: 6px;
	--xft-font-size: 0.9em;
	--xft-cell-padding: 0.55em 0.75em;

	margin: 1.5em 0;
	font-size: var(--xft-font-size);
	line-height: 1.45;
}

.xft-table-wrap *,
.xft-table-wrap *::before,
.xft-table-wrap *::after {
	box-sizing: border-box;
}

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

/* Pasek narzędzi */

.xft-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6em 1em;
	margin-bottom: 0.75em;
}

.xft-per-page {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin: 0;
	font-weight: normal;
}

.xft-search {
	margin: 0 0 0 auto;
	flex: 0 1 18em;
}

.xft-toolbar select,
.xft-toolbar input[type="search"] {
	font: inherit;
	color: inherit;
	background-color: transparent;
	border: 1px solid var(--xft-border);
	border-radius: var(--xft-radius);
	padding: 0.4em 0.6em;
	margin: 0;
	min-height: 2.3em;
	max-width: 100%;
}

.xft-toolbar select option {
	color: initial;
}

.xft-toolbar input[type="search"] {
	width: 100%;
}

.xft-toolbar select:focus-visible,
.xft-toolbar input[type="search"]:focus-visible,
.xft-button:focus-visible,
.xft-sort:focus-visible,
.xft-page:focus-visible,
.xft-scroll:focus-visible {
	outline: 2px solid var(--xft-accent);
	outline-offset: 2px;
}

.xft-export {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.4em;
}

.xft-button {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.4em 0.85em;
	min-height: 2.3em;
	border: 1px solid var(--xft-border);
	border-radius: var(--xft-radius);
	background: transparent;
	color: inherit;
	font-size: 0.95em;
	line-height: 1.2;
	text-decoration: none !important;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.xft-button::before {
	content: "";
	width: 1em;
	height: 1em;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5M5 19.5h14'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5M5 19.5h14'/%3E%3C/svg%3E") center / contain no-repeat;
}

.xft-button:hover {
	background-color: var(--xft-hover);
	border-color: currentColor;
	color: inherit;
}

/* Tabela */

.xft-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--xft-border);
	border-radius: var(--xft-radius);
}

.xft-table-wrap .xft-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	font-size: 1em;
	transition: opacity 0.15s ease;
}

.xft-layout-fixed .xft-table {
	table-layout: fixed;
}

.xft-layout-fixed .xft-table td {
	overflow-wrap: anywhere;
}

.xft-table-wrap .xft-table th,
.xft-table-wrap .xft-table td {
	padding: var(--xft-cell-padding);
	border: 0;
	border-bottom: 1px solid var(--xft-border);
	vertical-align: top;
	text-align: left;
	background: none;
}

.xft-table-wrap .xft-table thead th {
	background-color: var(--xft-header-bg);
	font-weight: 600;
	vertical-align: bottom;
	border-bottom-width: 2px;
}

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

.xft-striped .xft-table tbody tr:nth-child(even) td {
	background-color: var(--xft-stripe);
}

.xft-table-wrap .xft-table tbody tr:hover td {
	background-color: var(--xft-hover);
}

.xft-table-wrap .xft-table .xft-align-left { text-align: left; }
.xft-table-wrap .xft-table .xft-align-center { text-align: center; }
.xft-table-wrap .xft-table .xft-align-right { text-align: right; }

.xft-table td.xft-align-right {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.xft-table td.xft-empty {
	padding: 2em 1em;
	text-align: center;
	opacity: 0.75;
}

/* Sortowanie */

.xft-table-wrap .xft-sort {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	font-weight: inherit;
	letter-spacing: inherit;
	text-transform: none;
	text-align: inherit;
	line-height: inherit;
	cursor: pointer;
}

.xft-table-wrap .xft-sort:hover {
	background: none;
	color: inherit;
	text-decoration: underline;
}

.xft-align-right .xft-sort {
	flex-direction: row-reverse;
}

.xft-sort-icon {
	position: relative;
	flex: 0 0 auto;
	width: 0.6em;
	height: 0.85em;
}

.xft-sort-icon::before,
.xft-sort-icon::after {
	content: "";
	position: absolute;
	left: 0;
	border-left: 0.3em solid transparent;
	border-right: 0.3em solid transparent;
	opacity: 0.3;
}

.xft-sort-icon::before {
	top: 0;
	border-bottom: 0.33em solid currentColor;
}

.xft-sort-icon::after {
	bottom: 0;
	border-top: 0.33em solid currentColor;
}

.xft-sorted-asc .xft-sort-icon::before,
.xft-sorted-desc .xft-sort-icon::after {
	opacity: 1;
}

/* Pływający nagłówek (kopia wiersza nagłówków przypięta do góry okna) */

.xft-sticky {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	z-index: var(--xft-sticky-z, 20);
	overflow: hidden;
	background-color: var(--xft-sticky-bg, #fff);
	box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.35);
}

.xft-sticky.is-visible {
	display: block;
}

.xft-table-wrap .xft-sticky .xft-table {
	table-layout: fixed;
	max-width: none;
	transition: none;
}

/* Stopka i stronicowanie */

.xft-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.6em 1em;
	margin-top: 0.75em;
}

.xft-info {
	opacity: 0.8;
}

.xft-has-error .xft-info {
	opacity: 1;
	color: #d63638;
}

.xft-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3em;
}

.xft-table-wrap .xft-page {
	min-width: 2.3em;
	height: 2.3em;
	margin: 0;
	padding: 0 0.6em;
	border: 1px solid var(--xft-border);
	border-radius: var(--xft-radius);
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
}

.xft-table-wrap .xft-page:hover:not(:disabled) {
	background-color: var(--xft-hover);
	color: inherit;
}

.xft-table-wrap .xft-page.is-current {
	background-color: var(--xft-accent);
	border-color: var(--xft-accent);
	color: var(--xft-accent-text);
	font-weight: 600;
	cursor: default;
}

.xft-table-wrap .xft-page:disabled {
	opacity: 0.4;
	cursor: default;
}

.xft-page-gap {
	padding: 0 0.2em;
	opacity: 0.6;
}

.xft-updated {
	margin: 0.6em 0 0;
	font-size: 0.85em;
	opacity: 0.7;
}

/* Ładowanie */

.xft-is-loading .xft-table tbody {
	opacity: 0.45;
}

.xft-is-loading .xft-scroll {
	cursor: progress;
}

/* Komunikaty dla administratora */

.xft-admin-notice {
	padding: 0.75em 1em;
	border-left: 4px solid #d63638;
	background: rgba(214, 54, 56, 0.08);
}

/* Telefony: wiersze jako karty */

@media (max-width: 640px) {
	.xft-search {
		flex: 1 1 100%;
		margin-left: 0;
	}

	.xft-responsive-stack .xft-scroll {
		overflow: visible;
	}

	.xft-responsive-stack .xft-sticky.is-visible {
		display: none;
	}

	.xft-responsive-stack .xft-table,
	.xft-responsive-stack .xft-table tbody,
	.xft-responsive-stack .xft-table tr,
	.xft-responsive-stack .xft-table td,
	.xft-responsive-stack .xft-table thead {
		display: block;
		width: 100%;
	}

	.xft-responsive-stack .xft-table colgroup,
	.xft-responsive-stack .xft-table thead th.xft-not-sortable {
		display: none;
	}

	/* Nagłówki zamieniają się w przyciski sortowania. */
	.xft-responsive-stack .xft-table thead tr {
		display: flex;
		flex-wrap: wrap;
		gap: 0.35em;
		padding: 0.6em;
		background-color: var(--xft-header-bg);
		border-bottom: 2px solid var(--xft-border);
	}

	.xft-table-wrap.xft-responsive-stack .xft-table thead th {
		width: auto !important;
		min-width: 0 !important;
		padding: 0.2em 0.65em;
		border: 1px solid var(--xft-border);
		border-radius: 999px;
		background: transparent;
		font-size: 0.85em;
		font-weight: 500;
	}

	.xft-responsive-stack .xft-table tbody tr {
		padding: 0.45em 0;
		border-bottom: 1px solid var(--xft-border);
	}

	.xft-responsive-stack .xft-table tbody tr:last-child {
		border-bottom: 0;
	}

	.xft-table-wrap.xft-responsive-stack .xft-table td {
		display: flex;
		justify-content: space-between;
		gap: 1em;
		padding: 0.25em 0.8em;
		border: 0;
		text-align: right;
		white-space: normal;
		background: none;
	}

	.xft-responsive-stack .xft-table td::before {
		content: attr(data-label);
		flex: 0 0 40%;
		font-weight: 600;
		text-align: left;
	}

	.xft-responsive-stack .xft-table td.xft-empty::before {
		content: none;
	}

	/* Puste pola nie zajmują miejsca w karcie. */
	.xft-table-wrap.xft-responsive-stack .xft-table td:empty {
		display: none;
	}

	.xft-footer {
		flex-direction: column;
		align-items: flex-start;
	}
}

@media print {
	.xft-sticky.is-visible {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.xft-table-wrap * {
		transition: none !important;
	}
}
