/* Searchable dropdowns (js/searchable-select.js). The text field itself
   takes the form's normal input styles (.form-row input). */
.ss {
	position: relative;
	display: block;
	width: 100%;
	align-self: stretch;
}

.ss .ss-input {
	padding-right: 40px;
	cursor: pointer;
	text-overflow: ellipsis;
}

.ss .ss-input:focus {
	cursor: text;
}

/* Chevron, flips while open. */
.ss::after {
	content: "";
	position: absolute;
	top: 22px;
	right: 18px;
	width: 8px;
	height: 8px;
	border: solid #64748b;
	border-width: 0 2px 2px 0;
	transform: translateY(-50%) rotate(45deg);
	transition: transform 0.2s ease;
	pointer-events: none;
}

.ss.is-open::after {
	transform: translateY(-10%) rotate(-135deg);
}

/* The real <select> stays in the form for submit and validation. */
.ss .ss-native {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	border: 0 !important;
	opacity: 0;
	pointer-events: none;
}

.ss-list {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 30;
	max-height: 264px;
	margin: 0;
	padding: 6px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
	border-radius: 14px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	box-shadow: 0 22px 48px rgba(15, 23, 42, 0.16);
}

.ss-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 9px;
	font-size: 14px;
	color: #1f2937;
	cursor: pointer;
}

.ss-option.is-active {
	background: #eff4ff;
	color: #1d4ed8;
}

.ss-option[aria-selected="true"] {
	font-weight: 700;
}

.ss-option[aria-selected="true"]::after {
	content: "✓";
	color: #2563eb;
	font-weight: 700;
}

.ss-meta {
	margin-left: auto;
	font-size: 12.5px;
	color: #94a3b8;
	font-variant-numeric: tabular-nums;
}

.ss-empty {
	padding: 12px;
	font-size: 14px;
	color: #64748b;
}

.ss-option[hidden],
.ss-empty[hidden] {
	display: none;
}

html[data-theme="dark"] .ss-list {
	background: var(--dk-surface-2, #16213b);
	border-color: var(--dk-border, rgba(148, 163, 184, 0.14));
	box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .ss-option {
	color: var(--dk-text, #e5e7eb);
}

html[data-theme="dark"] .ss-option.is-active {
	background: rgba(96, 165, 250, 0.16);
	color: #bfdbfe;
}

html[data-theme="dark"] .ss-option[aria-selected="true"]::after {
	color: #60a5fa;
}

html[data-theme="dark"] .ss::after {
	border-color: #94a3b8;
}

html[data-theme="dark"] .ss-empty,
html[data-theme="dark"] .ss-meta {
	color: var(--dk-muted, #a3adbf);
}

@media (prefers-reduced-motion: reduce) {
	.ss::after {
		transition: none;
	}
}
