/* jrl-select: branded searchable dropdowns (assets/js/jrl-select.js; README "Dropdowns (jrl-select)").
   Same look as the text inputs (white, hairline border, radius, 44px). No system blue, no red (R1):
   active row = light neutral, selected row = ink check mark. Loaded with the script, only on pages
   with filter forms. */
.jrl-select { position: relative; width: 100%; min-width: 0; }
/* The native select stays in the DOM as the source of truth: visually hidden, never display:none. */
.jrl-select__native { position: absolute !important; left: 0; bottom: 0; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: 0; border: 0 !important; opacity: 0; pointer-events: none; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
.jrl-select__button {
	display: flex; align-items: center; gap: 8px; width: 100%; min-height: var(--tap); padding: 10px 12px; margin: 0;
	border: 1px solid var(--c-field-border); border-radius: var(--radius); background: #fff; color: var(--c-text);
	font: inherit; font-size: 1rem; line-height: 1.3; text-align: left; cursor: pointer; -webkit-appearance: none; appearance: none;
	-webkit-tap-highlight-color: transparent;
}
.jrl-select__button:hover { border-color: var(--c-ink); }
.jrl-select__button:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; border-color: var(--c-ink); }
.jrl-select.is-open .jrl-select__button { border-color: var(--c-ink); }
.jrl-select__button:disabled { background: var(--c-bg-soft); color: var(--c-muted); cursor: not-allowed; }
.jrl-select__value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jrl-select__chev { flex: none; width: 16px; height: 16px; color: var(--c-ink); transition: transform .15s; }
.jrl-select.is-open .jrl-select__chev { transform: rotate(180deg); }

.jrl-select__panel {
	position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(420px, calc(100vw - 2 * var(--gutter)));
	display: flex; flex-direction: column; max-height: 360px; overflow: hidden;
	background: #fff; color: var(--c-text); border: 1px solid var(--c-line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.jrl-select__panel[hidden] { display: none; }
.jrl-select.is-above .jrl-select__panel { top: auto; bottom: calc(100% + 4px); }
.jrl-select__head { display: none; }
.jrl-select__search { flex: none; padding: 8px; border-bottom: 1px solid var(--c-line); background: #fff; }
.jrl-select .jrl-select__input { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--c-field-border); border-radius: var(--radius-sm); background: #fff; color: var(--c-text); font-size: 1rem; }
.jrl-select__list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 0; outline: 0; }
.jrl-select__opt { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; line-height: 1.3; cursor: pointer; user-select: none; -webkit-user-select: none; }
.jrl-select__opt[hidden], .jrl-select__group[hidden], .jrl-select__none[hidden] { display: none; }
.jrl-select__opt span { flex: 1 1 auto; min-width: 0; }
.jrl-select__check { flex: none; width: 16px; height: 16px; color: var(--c-ink); visibility: hidden; }
.jrl-select__opt[aria-selected="true"] { font-weight: 600; color: var(--c-ink); }
.jrl-select__opt[aria-selected="true"] .jrl-select__check { visibility: visible; }
.jrl-select__opt.is-active { background: var(--c-bg-muted); }
.jrl-select__opt[aria-disabled="true"] { color: var(--c-subtle); cursor: default; }
.jrl-select__opt.is-active[aria-disabled="true"] { background: transparent; }
/* "Any" / "All …" (empty value): kept apart from the real choices. */
.jrl-select__opt.is-any { margin-bottom: 4px; border-bottom: 1px solid var(--c-line); }
.jrl-select__group-label { padding: 10px 12px 4px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.jrl-select__group .jrl-select__opt { padding-left: 20px; }
.jrl-select__none { padding: 10px 12px; color: var(--c-muted); font-style: italic; }
.jrl-select__backdrop { display: none; }

/* Inside filter rows that cap the select width (calendar state filter). */
.cal-filters__state .jrl-select { max-width: 360px; }

/* Phones / coarse pointers: full-width bottom sheet, 44px rows, sticky search. */
.jrl-select.is-sheet .jrl-select__backdrop { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1000; background: rgba(0,0,0,.45); }
.jrl-select.is-sheet .jrl-select__panel {
	position: fixed; z-index: 1001; top: auto; bottom: 0; left: 0; right: 0; width: auto; min-width: 0; max-width: none; max-height: 75vh;
	border: 0; border-top: 1px solid var(--c-line-strong); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-lg);
	padding-bottom: env(safe-area-inset-bottom, 0px);
}
.jrl-select.is-sheet .jrl-select__head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--c-line); font-weight: 700; color: var(--c-ink); }
.jrl-select__close { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--c-ink); }
.jrl-select__close svg { width: 18px; height: 18px; }
.jrl-select.is-sheet .jrl-select__search { position: sticky; top: 0; padding: 8px 12px; }
.jrl-select.is-sheet .jrl-select__input { min-height: var(--tap); }
.jrl-select.is-sheet .jrl-select__opt { min-height: var(--tap); padding: 10px 16px; }
.jrl-select.is-sheet .jrl-select__group .jrl-select__opt { padding-left: 24px; }
html.jrl-select-sheet-open, html.jrl-select-sheet-open body { overflow: hidden; }

@media (forced-colors: active) {
	.jrl-select__button, .jrl-select__panel { border: 1px solid CanvasText; }
	.jrl-select__opt.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
	.jrl-select__check { forced-color-adjust: auto; }
}
@media (prefers-reduced-motion: reduce) { .jrl-select__chev { transition: none; } }
