.fs-funding-search-form {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
	margin: 0 0 18px;
	align-items: end;
}

.fs-funding-search-form .fs-funding-field {
	margin: 0;
}

/* Row 1: keyword (three quarters) + search button (one quarter). */
.fs-funding-search-form .fs-funding-field-keyword {
	grid-column: 1 / 4;
}

.fs-funding-search-form .fs-funding-field-submit {
	grid-column: 4 / -1;
}

/* Row 2: research grant (half) + year awarded (half). */
.fs-funding-search-form .fs-funding-field:not(.fs-funding-field-keyword):not(.fs-funding-field-submit):not(.fs-funding-field-year) {
	grid-column: 1 / 3;
}

.fs-funding-search-form .fs-funding-field-year {
	grid-column: 3 / -1;
}

.fs-funding-search-form .fs-funding-field-submit .fs-funding-submit-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
}

/* Fill the submit column so the row reads as full width. */
.fs-funding-search-form .fs-funding-field-submit .fs-funding-submit-actions button[type="submit"] {
	width: 100%;
}

.fs-funding-search-form label {
	display: block;
	margin-bottom: 4px;
	font-size: 12px;
	font-weight: 600;
	color: #005371;
	font-family: "Asap", Helvetica, Arial, Lucida, sans-serif;
}

.fs-funding-search-form input[type="search"],
.fs-funding-search-form select {
	width: 100%;
	min-height: 40px;
	padding: 8px 36px 8px 10px;
	border: 1px solid #cdd5df;
	border-radius: 6px;
	background-color: #fff;
	color: #1d2327;
	font-size: 13px;
}

.fs-funding-search-form select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23566579' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: 16px 16px;
	background-position: right 14px center;
}

.fs-funding-search-form input:focus,
.fs-funding-search-form select:focus {
	outline: 2px solid #2f67f6;
	outline-offset: 1px;
	border-color: #2f67f6;
}

.fs-funding-search-form button[type="submit"],
.fs-funding-download-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 20px;
	border: 0;
	border-radius: 13px;
	background-color: #005371;
	color: #fff !important;
	font-size: 15px;
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none !important;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.fs-funding-search-form button[type="submit"]:hover,
.fs-funding-download-link:hover {
	background-color: #50c4d0;
}

.fs-funding-download-section {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 20px;
	padding: 20px;
	background: #f4f8fa;
	border: 1px solid #cbd9e0;
	border-radius: 15px;
}

.fs-funding-download-instructions {
	font-size: 14px;
	line-height: 1.6em;
	color: #1d2327;
}

.fs-funding-download-instructions p {
	margin: 0 0 8px;
}

.fs-funding-download-instructions p:last-child {
	margin-bottom: 0;
}

.fs-funding-download-fields {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.fs-funding-download-selectall {
	font-weight: 700 !important;
	color: #005371 !important;
	padding-bottom: 10px;
	border-bottom: 1px solid #dbe4e9;
}

.fs-funding-download-section-label {
	font-size: 13px;
	font-weight: 600;
	color: #005371;
	font-family: "Asap", Helvetica, Arial, Lucida, sans-serif;
}

.fs-funding-download-checkboxes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
}

.fs-funding-download-checkbox-label {
	display: inline-flex !important;
	align-items: center;
	gap: 5px;
	font-size: 13px !important;
	font-weight: 400 !important;
	color: #1d2327 !important;
	margin-bottom: 0 !important;
	cursor: pointer;
	white-space: nowrap;
}

.fs-funding-download-checkbox-label input[type="checkbox"] {
	width: 14px;
	height: 14px;
	margin: 0;
	cursor: pointer;
	accent-color: #005371;
	flex-shrink: 0;
}

.fs-funding-download-actions {
	display: flex;
}

/* Load more control */
.fs-funding-load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 28px;
}

.fs-funding-load-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 28px;
	border: 0;
	border-radius: 13px;
	background-color: #005371;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.fs-funding-load-more:hover:not(:disabled) {
	background-color: #50c4d0;
}

.fs-funding-load-more:disabled {
	opacity: 0.7;
	cursor: default;
}

.fs-funding-search-form button[type="submit"]:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.fs-funding-tag-select {
	position: relative;
}

.fs-funding-tag-control {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	width: 100%;
	min-height: 40px;
	padding: 8px 36px 8px 10px;
	border: 1px solid #cdd5df;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
}

.fs-funding-tag-control:focus-within {
	outline: 2px solid #2f67f6;
	outline-offset: 1px;
	border-color: #2f67f6;
}

.fs-funding-tag-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.fs-funding-tag-input {
	flex: 1 1 120px;
	min-width: 80px;
	border: 0;
	outline: 0;
	padding: 0;
	margin: 0;
	height: 24px;
	font-size: 13px;
	background: transparent;
	border: 0 !important;
}

.fs-funding-tag-arrow {
	position: absolute;
	right: 12px;
	top: 50%;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23566579' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: 16px 16px;
}

.fs-funding-pill {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px;
	border-radius: 12px;
	background: #e7eff5;
	color: #1f2937;
	font-size: 12px;
	line-height: 1.3;
}

.fs-funding-pill-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #445063;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.fs-funding-tag-menu {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	display: none;
	max-height: 220px;
	overflow: auto;
	padding: 8px;
	border: 1px solid #cdd5df;
	border-radius: 6px;
	background: #fff;
	z-index: 50;
}

.fs-funding-tag-select.is-open .fs-funding-tag-menu {
	display: block;
}

.fs-funding-tag-option {
	padding: 6px 8px;
	font-size: 13px;
	cursor: pointer;
}

.fs-funding-tag-option:hover {
	background: #eef4f8;
}

.fs-funding-tag-empty {
	padding: 6px 8px;
	font-size: 13px;
	color: #6b7280;
}

.fs-funding-tag-select [data-fs-hidden-multi-select="1"] {
	display: none !important;
}

.fs-funding-year-range {
	display: grid;
	gap: 0;
	padding: 5px 14px;
	border: 1px solid #cdd5df;
	border-radius: 6px;
	background: #fff;
	--fs-year-min-percent: 0%;
	--fs-year-max-percent: 100%;
}

.fs-funding-field-year > label {
	display: block;
}

.fs-funding-year-range-values {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	color: #005371;
	font-size: 13px;
	font-weight: 700;
}

.fs-funding-year-range-controls {
	position: relative;
	height: 28px;
	margin-top: 2px;
}

.fs-funding-year-range input[type="range"] {
	position: absolute;
	left: 0;
	top: 50%;
	width: 100%;
	height: 28px;
	margin: 0;
	padding: 0;
	transform: translateY(-50%);
	border: 0;
	background: transparent;
	box-shadow: none;
	accent-color: #005371;
	appearance: none;
	pointer-events: none;
}

.fs-funding-year-range-track {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 4px;
	transform: translateY(-50%);
	border-radius: 999px;
	background:
		linear-gradient(
			to right,
			#d8e1e6 0%,
			#d8e1e6 var(--fs-year-min-percent),
			#005371 var(--fs-year-min-percent),
			#005371 var(--fs-year-max-percent),
			#d8e1e6 var(--fs-year-max-percent),
			#d8e1e6 100%
		);
}

.fs-funding-year-range input[type="range"]::-webkit-slider-runnable-track {
	height: 4px;
	background: transparent;
	border: 0;
}

.fs-funding-year-range input[type="range"]::-moz-range-track {
	height: 4px;
	background: transparent;
	border: 0;
}

.fs-funding-year-range input[type="range"]::-webkit-slider-thumb {
	width: 16px;
	height: 16px;
	margin-top: -6px;
	border: 2px solid #005371;
	border-radius: 50%;
	background: #005371;
	cursor: pointer;
	appearance: none;
	pointer-events: auto;
}

.fs-funding-year-range input[type="range"]::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 2px solid #005371;
	border-radius: 50%;
	background: #005371;
	cursor: pointer;
	pointer-events: auto;
}

.fs-funding-results-container {
	position: relative;
}

.fs-funding-loader {
	display: none;
	justify-content: center;
	align-items: center;
	gap: 8px;
	max-width: 165px;
	margin: 0 auto 14px;
	padding: 6px 10px;
	border: 1px solid #d8dee8;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.98);
	font-size: 12px;
	color: #1d2327;
}

.fs-funding-results-container.is-loading .fs-funding-loader {
	display: flex;
}

.fs-funding-results-content {
	transition: opacity 0.15s ease;
}

.fs-funding-results-container.is-loading .fs-funding-results-content {
	opacity: 0.55;
}

.fs-funding-loader-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid #d9d9e3;
	border-top-color: #2f67f6;
	border-radius: 50%;
	animation: fs-funding-spin 0.8s linear infinite;
}

@keyframes fs-funding-spin {
	to {
		transform: rotate(360deg);
	}
}

.fs-funding-results-count {
	margin: 0;
	font-size: 16px;
	color: #005371;
}

.fs-funding-results {
	display: grid;
	grid-template-columns: 1fr;
	gap: 22px;
}

.fs-funding-result {
	padding: 25px;
	border: 1px solid #d8e1e6;
	border-radius: 0;
	box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
	background: #fff;
}

.fs-funding-results .fs-funding-result + .fs-funding-result {
	border-top: 0 !important;
}

.fs-funding-result-title {
	margin: 0 0 14px;
	padding: 0;
	border: 0;
	text-align: left;
	font-size: 22px !important;
	line-height: 1.3em !important;
}

.fs-funding-result-title a {
	color: #005371 !important;
	font-size: 22px !important;
	font-weight: 500 !important;
	line-height: 1.3em !important;
	text-decoration: none;
}

.fs-funding-result-grid,
.fs-funding-single-grid {
	display: grid;
	gap: 20px;
}

.fs-funding-result-grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fs-funding-single-grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fs-funding-meta-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.fs-funding-meta-label {
	display: block;
	padding: 0;
	border: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.7em;
	text-align: left;
	color: #005371;
}

.fs-funding-meta-value {
	display: block;
	min-height: 20px;
	font-size: 16px;
	line-height: 1.7em;
	color: #000;
	text-align: left;
}

.fs-funding-read-more {
	margin: 14px 0 0;
}

.fs-funding-read-more a {
	font-size: 14px !important;
	font-weight: 700 !important;
	color: #005371 !important;
	text-decoration: underline;
}

.fs-funding-single-details {
	display: grid;
    gap: 20px;
    width: 100%;
    max-width: none;
    padding: 18px 25px 25px;
    border: 1px solid #d8e1e6;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
    background: #fff;
}

.fs-funding-single-title {
	margin: 0 0 4px;
	padding: 0;
	border: 0;
	font-size: 40px !important;
	line-height: 1.2;
	text-align: left;
}

.fs-funding-single-excerpt {
	font-size: 18px;
	line-height: 1.5;
	color: #3c434d;
}

.fs-funding-single-abstract {
	text-align: left !important;
}

.fs-funding-single-abstract h3 {
	margin: 0 0 10px;
	padding: 0;
	display: block;
	border: 0;
	font-size: 16px !important;
	font-weight: 700;
	text-align: left;
	color: #005371;
}

.fs-funding-single-abstract-body {
	font-size: 16px;
	line-height: 1.7em;
	color: #000;
	text-align: left;
}

/* Move the back link above the Divi theme builder title on single pages */
.header-content:has(.fs-funding-back-link) {
	display: flex;
	flex-direction: column;
}

.header-content:has(.fs-funding-back-link) .et_pb_header_content_wrapper {
	order: -1;
	margin-bottom: 8px;
}

/*
 * Tighten the Divi theme-builder header on single funding entries so the
 * details box sits directly under the title instead of below the fold.
 *
 * The `body #page-container` prefix is required to outrank the theme's
 * `body #page-container .cmn_section { padding: 80px 0 !important; }` rule,
 * which fires between 981px and 1366px — i.e. on a typical laptop.
 * Both selectors are scoped to funding singles via :has(), so no other
 * Divi page is affected.
 */
body #page-container .et_pb_fullwidth_header:has(.fs-funding-back-link) {
	padding-top: 24px !important;
	padding-bottom: 0 !important;
}

body #page-container .et_pb_fullwidth_header:has(.fs-funding-back-link) .et_pb_module_header {
	font-size: 30px !important;
	line-height: 1.25em !important;
}

body #page-container .et_pb_fullwidth_header:has(.fs-funding-back-link) .et_pb_header_content_wrapper {
	margin-top: 10px !important;
}

body #page-container .et_pb_section:has(.fs-funding-single-details) {
	padding-top: 24px !important;
}

.fs-funding-back-link {
	display: inline-flex;
	align-items: center;
	color: #005371;
	font-family: "Asap", Helvetica, Arial, Lucida, sans-serif;
	font-size: 14px;
	text-decoration: none;
	background: #50C4D0;
	padding: 15px !important;
	line-height: 1em;
	height: unset;
	border-radius: 15px;
	font-weight: 600;
	margin-bottom: 16px;
}

.fs-funding-back-link:hover {
	background-color: #408ba6;
	text-decoration: none;
}

@media (max-width: 980px) {
	.fs-funding-search-form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.fs-funding-search-form .fs-funding-field-keyword {
		grid-column: 1 / -1;
	}

	.fs-funding-search-form .fs-funding-field-submit {
		grid-column: 1 / -1;
	}

	.fs-funding-search-form .fs-funding-field:not(.fs-funding-field-keyword):not(.fs-funding-field-submit):not(.fs-funding-field-year) {
		grid-column: 1 / 2;
	}

	.fs-funding-search-form .fs-funding-field-year {
		grid-column: 2 / -1;
	}

	.fs-funding-result-grid,
	.fs-funding-single-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.fs-funding-search-form {
		grid-template-columns: 1fr;
	}

	.fs-funding-search-form > .fs-funding-field {
		grid-column: 1 / -1;
	}

	.fs-funding-result-grid,
	.fs-funding-single-grid {
		grid-template-columns: 1fr;
	}

	.fs-funding-search-form .fs-funding-field-submit .fs-funding-submit-actions {
		flex-direction: column;
		align-items: flex-start;
	}

	.fs-funding-single-title {
		font-size: 36px !important;
	}

	.fs-funding-read-more a {
		font-size: 14px !important;
	}
}

.fs-funding-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 28px;
}

.fs-funding-page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid #cdd5df;
	border-radius: 6px;
	background: #fff;
	color: #005371;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.fs-funding-page-btn:hover:not(:disabled):not(.is-current) {
	background: #e7eff5;
	border-color: #b0bec8;
}

.fs-funding-page-btn.is-current {
	background: #005371;
	color: #fff;
	border-color: #005371;
	cursor: default;
}

.fs-funding-page-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.fs-funding-page-prev,
.fs-funding-page-next {
	font-size: 18px;
}

.fs-funding-page-ellipsis {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 36px;
	color: #566579;
	font-size: 14px;
	user-select: none;
}
