/* Select2 — Bootstrap 4 theme, primary blue styling */

label.form-label:has(+ .select2-container),
label.form-label:has(+ * .select2-container) {
	color: var(--bs-primary);
	font-weight: 500;
}

label.form-label:has(+ .select2-container) .bx,
label.form-label:has(+ * .select2-container) .bx {
	margin-right: 0.15rem;
}

.select2-container--bootstrap4 .select2-selection {
	border-radius: 0.5rem;
	border-color: rgba(var(--bs-primary-rgb), 0.35);
	min-height: calc(1.5em + 0.75rem + 2px);
	padding: 0;
}

.select2-container--bootstrap4 .select2-selection--single {
	height: calc(1.5em + 0.75rem + 2px);
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
	padding-left: 0.85rem;
	padding-right: 2rem;
	color: var(--bs-body-color);
	line-height: calc(1.5em + 0.75rem);
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder {
	color: #adb5bd;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
	right: 0.65rem;
	height: 100%;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b {
	border-color: var(--bs-primary) transparent transparent transparent;
	border-width: 6px 5px 0 5px;
	margin-top: -3px;
}

.select2-container--bootstrap4.select2-container--open .select2-selection--single .select2-selection__arrow b {
	border-color: transparent transparent var(--bs-primary) transparent;
	border-width: 0 5px 6px 5px;
	margin-top: -4px;
}

.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
	border-color: var(--bs-primary);
	box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.select2-container--bootstrap4 .select2-dropdown {
	border-color: var(--bs-primary);
	border-radius: 0 0 0.5rem 0.5rem;
	box-shadow: 0 0.5rem 1rem rgba(var(--bs-primary-rgb), 0.12);
	overflow: hidden;
	padding: 0;
}

.select2-container--bootstrap4 .select2-dropdown.select2-dropdown--above {
	border-radius: 0.5rem 0.5rem 0 0;
}

.select2-container--bootstrap4 .select2-search--dropdown {
	padding: 0.65rem 0.75rem 0.5rem;
}

.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field {
	border: 1px solid rgba(var(--bs-primary-rgb), 0.45);
	border-radius: 0.5rem;
	padding: 0.45rem 0.75rem;
	color: var(--bs-body-color);
}

.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field:focus {
	border-color: var(--bs-primary);
	box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
	outline: 0;
}

.select2-container--bootstrap4 .select2-results > .select2-results__options {
	max-height: 16rem;
	padding: 0.25rem 0;
}

.select2-container--bootstrap4 .select2-results__option {
	padding: 0.55rem 0.85rem;
}

.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected="true"] {
	background-color: var(--bs-gray-200);
	color: var(--bs-body-color);
}

.select2-container--bootstrap4 .select2-results__option[aria-selected="true"] {
	background-color: rgba(var(--bs-primary-rgb), 0.1);
	color: var(--bs-primary);
}

.select2-container--bootstrap4 .select2-selection__clear {
	margin-top: 0.55rem;
	margin-right: 1.75rem;
}

html.dark-theme .select2-container--bootstrap4 .select2-selection {
	background-color: #2b3035;
	border-color: rgba(255, 255, 255, 0.15);
	color: #e4e5e6;
}

html.dark-theme .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
	color: #e4e5e6;
}

html.dark-theme .select2-container--bootstrap4 .select2-dropdown {
	background-color: #2b3035;
	border-color: rgba(var(--bs-primary-rgb), 0.55);
}

html.dark-theme .select2-container--bootstrap4 .select2-search--dropdown .select2-search__field {
	background-color: #212529;
	border-color: rgba(var(--bs-primary-rgb), 0.45);
	color: #e4e5e6;
}

html.dark-theme .select2-container--bootstrap4 .select2-results__option--highlighted,
html.dark-theme .select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected="true"] {
	background-color: #3a4047;
	color: #e4e5e6;
}

html.dark-theme .select2-container--bootstrap4 .select2-results__option[aria-selected="true"] {
	background-color: rgba(var(--bs-primary-rgb), 0.2);
	color: #9ec5fe;
}

html.dark-theme table.dataTable {
	color: #e4e5e6;
}

html.dark-theme table.dataTable thead th {
	border-bottom-color: rgba(255, 255, 255, 0.12);
}

html.dark-theme table.dataTable tbody td {
	border-color: rgba(255, 255, 255, 0.08);
}

html.dark-theme .dataTables_wrapper .dataTables_filter input,
html.dark-theme .dataTables_wrapper .dataTables_length select {
	background-color: #2b3035;
	border-color: rgba(255, 255, 255, 0.15);
	color: #e4e5e6;
}

html.dark-theme .flatpickr-calendar {
	background: #2b3035;
	border-color: rgba(255, 255, 255, 0.15);
	box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.35);
}

html.dark-theme .flatpickr-months .flatpickr-month,
html.dark-theme .flatpickr-weekdays,
html.dark-theme span.flatpickr-weekday {
	background: #2b3035;
	color: #e4e5e6;
}

html.dark-theme .flatpickr-day {
	color: #e4e5e6;
}

html.dark-theme .flatpickr-day:hover,
html.dark-theme .flatpickr-day:focus {
	background: #3a4047;
	border-color: #3a4047;
}

html.dark-theme .flatpickr-day.selected {
	background: #5e72e4;
	border-color: #5e72e4;
}

html.dark-theme .flatpickr-time input,
html.dark-theme .flatpickr-time .flatpickr-am-pm {
	color: #e4e5e6;
}

/* Login watermark only — rest uses Bootstrap */
body.login-page {
	background-color: #eef1f6;
}

body.login-page .login-page__backdrop::before {
	content: "";
	position: absolute;
	inset: -20px;
	background-image: var(--login-watermark);
	background-size: 80px auto;
	background-repeat: repeat;
	opacity: 0.055;
}

body.login-page .login-page__backdrop {
	position: fixed;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}

body.login-page .login-card {
	border: 0;
}

body.login-page .login-input-wrap:focus-within {
	border-color: var(--bs-primary) !important;
	box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.drag-handle {
	cursor: grab;
}

.drag-handle:active {
	cursor: grabbing;
}

/* SweetAlert2 — match app light/dark themes (override global dark-theme h2 on popup) */

html.dark-theme .swal2-popup,
.swal2-popup.swal2-theme-dark {
	--swal2-background: #2b3035;
	--swal2-color: #e4e5e6;
	--swal2-title-color: #ffffff;
	--swal2-html-container-color: #dee2e6;
	--swal2-input-background: #343a40;
	--swal2-input-color: #e9ecef;
	--swal2-input-border: 1px solid #495057;
	--swal2-validation-message-background: #343a40;
	--swal2-validation-message-color: #f8d7da;
	--swal2-footer-border-color: #495057;
	background: var(--swal2-background);
	color: var(--swal2-color);
}

html.dark-theme .swal2-popup .swal2-title,
.swal2-popup.swal2-theme-dark .swal2-title {
	color: var(--swal2-title-color) !important;
}

html.dark-theme .swal2-popup .swal2-html-container,
.swal2-popup.swal2-theme-dark .swal2-html-container {
	color: var(--swal2-html-container-color);
}

html.dark-theme .swal2-popup .swal2-close,
.swal2-popup.swal2-theme-dark .swal2-close {
	color: #adb5bd;
}

html.light-theme .swal2-popup .swal2-title,
html.minimal-theme .swal2-popup .swal2-title,
html.semi-dark .swal2-popup .swal2-title,
.swal2-popup.swal2-theme-light .swal2-title {
	color: #595959 !important;
}

html.light-theme .swal2-popup .swal2-html-container,
html.minimal-theme .swal2-popup .swal2-html-container,
html.semi-dark .swal2-popup .swal2-html-container,
.swal2-popup.swal2-theme-light .swal2-html-container {
	color: #545454;
}

.item-summary-compact {
	font-family: monospace;
	font-size: 13px;
	line-height: 1.6;
	background: var(--bs-body-bg);
	border: 1px dashed var(--bs-border-color);
	padding: 1rem;
	border-radius: 0.5rem;
	white-space: pre-wrap;
}

@media print {
	body > *:not(#printArea) {
		display: none !important;
	}

	#printArea {
		display: block !important;
		visibility: visible !important;
		padding: 1rem;
	}

	#printArea .item-summary-doc {
		border: none !important;
		background: #fff !important;
		color: #000 !important;
	}

	#printArea .item-summary-doc .text-secondary,
	#printArea .item-summary-doc .text-success {
		color: #000 !important;
	}

	#printArea table,
	#printArea th,
	#printArea td {
		color: #000 !important;
		border-color: #000 !important;
	}
}
