/* stock screener, the colors come from the --fund-* tokens set on .screener-page in style.css (light and dark) */
.screener-page {
	--screener-accent: #f7931a;
	--screener-accent-soft: #fff4e4;
	--screener-positive: #0c9e5a;
}
.dark .screener-page {
	--screener-accent-soft: #4a3a22;
	--screener-positive: #1fbf75;
}
.screener-panel {
	text-align: left;
}

/* popular screens */
.screener-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
	align-items: center;
	justify-content: center;
	margin: 4px 0 14px;
}
.screener-presets-label {
	color: var(--fund-text-muted);
	font-size: 13px;
	margin-right: 2px;
}
.screener-chip {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 4px 12px;
	border: 1px solid var(--fund-border);
	border-radius: 16px;
	background: var(--fund-surface);
	color: inherit;
	font-size: 14px;
	line-height: 20px;
	white-space: nowrap;
}
.screener-chip:hover, .screener-chip:focus-visible {
	border-color: var(--screener-accent);
	color: inherit;
	text-decoration: none;
}
.screener-chip.is-current {
	border-color: var(--screener-accent);
	background: var(--screener-accent-soft);
	font-weight: 600;
}

/* the filter card */
.screener-card {
	border: 1px solid var(--fund-border);
	border-radius: 10px;
	background: var(--fund-surface);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.screener-card-summary {
	display: none;
	padding: 12px 16px;
	font-weight: 600;
	cursor: pointer;
}
.screener-tabs {
	display: flex;
	gap: 2px;
	padding: 6px 8px 0;
	border-bottom: 1px solid var(--fund-border);
	overflow-x: auto;
	scrollbar-width: thin;
}
.screener-tab {
	flex: 0 0 auto;
	margin-bottom: -1px;
	padding: 8px 14px;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	color: var(--fund-text-muted);
	font-size: 15px;
	cursor: pointer;
}
.screener-tab:hover {
	color: inherit;
}
.screener-tab[aria-selected="true"] {
	border-bottom-color: var(--screener-accent);
	color: inherit;
	font-weight: 600;
}
.screener-tab:focus-visible, .screener-view:focus-visible, .screener-chip:focus-visible {
	outline: 2px solid var(--screener-accent);
	outline-offset: -2px;
}
.screener-badge {
	display: inline-block;
	min-width: 18px;
	margin-left: 6px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--screener-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 18px;
	text-align: center;
}
.screener-badge[hidden] {
	display: none;
}
.screener-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 12px 16px;
	padding: 16px;
}
.screener-grid[hidden] {
	display: none;
}
.screener-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	margin: 0;
}
.screener-field > label {
	margin: 0;
	color: var(--fund-text-muted);
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.screener-field.is-active > label {
	color: inherit;
	font-weight: 600;
}
.screener-page .screener-input {
	width: 100%;
	height: 34px;
	padding: 4px 8px;
	border: 1px solid var(--fund-border);
	border-radius: 6px;
	background-color: var(--fund-surface);
	color: inherit;
	font-size: 14px;
}
.screener-field.is-active .screener-input {
	border-color: var(--screener-accent);
}
.screener-page .screener-input:focus {
	border-color: var(--screener-accent);
	outline: none;
	box-shadow: 0 0 0 2px var(--screener-accent-soft);
}
.screener-page .screener-input.is-invalid {
	border-color: #e0524b;
}
.screener-range {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
}
.screener-range[hidden] {
	display: none;
}
.screener-invalid {
	margin: 0;
	color: #e0524b;
	font-size: 12px;
}
.screener-toggle {
	flex-direction: row;
	gap: 8px;
	align-items: center;
	align-self: end;
	min-height: 34px;
	font-size: 14px;
	cursor: pointer;
}
.screener-toggle input {
	accent-color: var(--screener-accent);
}
.screener-detailed .plus-lock {
	margin-left: 0;
}
/* a filter or column of the detailed figures without Plus: the whole control opens the upgrade popup */
.screener-field-locked, .screener-check[data-plus-locked], .screener-toggle[data-plus-locked] {
	cursor: pointer;
}
.screener-field-locked select, .screener-check[data-plus-locked] input, .screener-toggle[data-plus-locked] input {
	pointer-events: none;
}
.screener-page .screener-field-locked .screener-input {
	opacity: 0.55;
}
.screener-plus-note {
	margin: 12px 0 0;
	padding: 8px 12px;
	border-radius: 8px;
	background: var(--fund-surface-soft);
	font-size: 14px;
}
.screener-plus-note a {
	font-weight: 600;
	text-decoration: underline;
}
.screener-card-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 16px;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-top: 1px solid var(--fund-border);
}
.screener-hint {
	flex: 1 1 360px;
	margin: 0;
	color: var(--fund-text-muted);
	font-size: 13px;
}
.screener-page .screener-submit {
	display: flex;
	gap: 14px;
	align-items: center;
	margin: 0;
}
.screener-reset {
	color: var(--fund-text-muted);
	font-size: 14px;
}
.screener-page select.screener-input {
	padding-right: 26px;
}
.screener-page .screener-apply {
	min-width: 170px;
	padding: 6px 18px;
	font-size: 16px;
	transition: opacity 0.15s;
}
.screener-page .screener-apply.is-loading {
	opacity: 0.6;
}

/* the filters in use, a click removes one */
.screener-active {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
	align-items: center;
	margin-top: 12px;
}
.screener-chip.is-active {
	border-color: var(--screener-accent);
	background: var(--screener-accent-soft);
}
.screener-chip-label {
	color: var(--fund-text-muted);
}
.screener-chip-x {
	margin-left: 2px;
	font-size: 16px;
	line-height: 1;
}
.screener-clear {
	color: var(--fund-text-muted);
	font-size: 14px;
}

/* the result count and the column views above the table */
.screener-results-bar {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
	justify-content: space-between;
	margin-top: 16px;
}
.screener-results {
	margin: 0;
	font-size: 15px;
}
.screener-page-info {
	color: var(--fund-text-muted);
}
.screener-views {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	padding: 3px;
	border-radius: 20px;
	background: var(--fund-surface-soft);
}
.screener-view {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	padding: 5px 13px;
	border: 0;
	border-radius: 17px;
	background: transparent;
	color: inherit;
	font-size: 14px;
	line-height: 20px;
	white-space: nowrap;
	cursor: pointer;
}
.screener-view:hover {
	color: inherit;
	text-decoration: none;
	background: var(--fund-surface);
}
.screener-view.is-current {
	background: var(--fund-surface);
	font-weight: 600;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.screener-view svg {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
}
.screener-view .screener-pill-count {
	margin-left: 0;
}
.screener-results-bar .screener-column-menu {
	top: 100%;
	right: 0;
	left: auto;
	width: min(960px, 100%);
	margin-top: 6px;
	transform: none;
	text-align: left;
}
.screener-page .screener-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	justify-content: flex-end;
	margin-top: 8px;
}

/* pagination */
.screener-pages {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	align-items: center;
	justify-content: center;
	margin-top: 18px;
}
.screener-page-link {
	min-width: 36px;
	padding: 6px 10px;
	border: 1px solid var(--fund-border);
	border-radius: 6px;
	background: var(--fund-surface);
	color: inherit;
	text-align: center;
}
.screener-page-link:hover {
	border-color: var(--screener-accent);
	color: inherit;
	text-decoration: none;
}
.screener-page-link.is-current {
	border-color: var(--screener-accent);
	background: var(--screener-accent);
	color: #fff;
	font-weight: 600;
}
.screener-page-gap {
	padding: 0 4px;
	color: var(--fund-text-muted);
}
.screener-table .percentage-green {
	color: var(--screener-positive);
}

@media (max-width: 600px) {
	.screener-presets {
		flex-wrap: nowrap;
		justify-content: flex-start;
		margin-right: -10px;
		margin-left: -10px;
		padding: 0 10px 4px;
		overflow-x: auto;
	}
	.screener-card-summary {
		display: list-item;
	}
	.screener-card:not([open]) {
		border-radius: 10px;
	}
	.screener-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
		padding: 12px;
	}
	.screener-toggle {
		grid-column: 1 / -1;
	}
	.screener-card-footer {
		padding: 12px;
	}
	.screener-page .screener-submit {
		width: 100%;
		justify-content: space-between;
	}
	.screener-page .screener-apply {
		flex: 1;
	}
	.screener-results-bar {
		flex-direction: column;
		align-items: stretch;
	}
	.screener-results-bar > * {
		min-width: 0;
		max-width: 100%;
	}
	.screener-views {
		flex-wrap: nowrap;
		overflow-x: auto;
		border-radius: 12px;
	}
	.screener-results-bar .screener-column-menu {
		position: fixed;
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		max-height: 80vh;
		margin: 0;
		overflow-y: auto;
		border-radius: 12px 12px 0 0;
	}
}
