:root {
  --selectify-text-align-start: left;
  --selectify-text-align-end: right;

  /* Search input padding: block-start, inline-end, block-end, inline-start (start = extra space for icon) */
  --selectify-search-padding-block-start: 6px;
  --selectify-search-padding-inline-end: 10px;
  --selectify-search-padding-block-end: 6px;
  --selectify-search-padding-inline-start: 34px;

  /* Border radius (logical corners): start-start, start-end, end-end, end-start */
  --selectify-radius-start-start: 8px;
  --selectify-radius-start-end: 8px;
  --selectify-radius-end-end: 8px;
  --selectify-radius-end-start: 8px;

  /* Soft defaults: a faint track, a light tint when checked. Themes and the
     accent palettes set their own colors on top of these. */
  --selectify-checkbox-bg: color-mix(in srgb, currentcolor 4%, transparent);
  --selectify-checkbox-checked-bg: color-mix(in srgb, currentcolor 12%, transparent);
  --selectify-checkbox-check-circle: color-mix(in srgb, currentcolor 55%, transparent);
  --selectify-checkbox-checked-circle: color-mix(in srgb, currentcolor 75%, transparent);
  --selectify-checkbox-disabled-bg: color-mix(in srgb, currentcolor 5%, transparent);
  --selectify-checkbox-disabled-circle: color-mix(in srgb, currentcolor 22%, transparent);
  --selectify-error-bg: #ffebee;
  --selectify-error-color: #d32f2f;
  --selectify-error-border-color: #d32f2f;
  --selectify-placeholder-color: #666;
  --selectify-skip-link-bg: #666;
  --selectify-skip-link-color: #fff;
}

.selectify,
.selectify * {
  box-sizing: border-box;
}

.s-hidden,
.s-search-hidden {
  display: none !important;
}

.selectify-hidden {
  position: absolute;
  visibility: hidden;
  overflow: hidden;
  inline-size: 0;
  block-size: 0;
  border: 0;
  outline: none;
}

.selectify-visually-hidden {
  position: absolute !important;
  overflow: hidden !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin-block: 0 !important;
  margin-inline: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}

.selectify-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.selectify-select {
  all: unset;
  box-shadow: none;
  font-size: var(--selectify-ui-font-size, 1em);
  line-height: 1.6;
  cursor: pointer;
  transition:
    background 0.2s ease-in-out,
    border 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
}

.selectify-radio,
.selectify-checkbox {
  padding: var(--selectify-radio-padding, inherit);
  border: none;
  border-radius: var(--selectify-radio-border-radius, inherit);
  box-shadow: none;
  background: var(--selectify-checkbox-bg, inherit);
}

.dual-available,
.dual-selected,
.selectify-available-display,
.selectify-selected-display {
  border: 2px solid var(--r-br, #999);
  border-radius: 8px;
  background: var(--r-bg, #f1f1f1);
  color: var(--r-tx, currentColor);
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    box-shadow 160ms ease;
}

.dual-list-option button,
.dual-list-option .option-label,
.selectify-available-one-option button,
.selectify-available-one-option .option-label,
.selectify-available-one-option label,
.selectify-selected-one-option .option-label {
  pointer-events: none;
}

.wrapper-selectify {
  inline-size: auto;
}

.wrapper-selectify > label {
  border: 0;
  background: transparent;
  background-image: none !important;
  cursor: default;
}

.wrapper-selectify {
  display: inline-block;
  background: inherit;
}

.views-exposed-form .wrapper-selectify {
  display: flex;
  inline-size: 100%;
}

.views-exposed-form label+.wrapper-selectify {
  margin-block-start: 0;
}

.selectify-select-footer {
  display: none;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  align-items: center;
  justify-content: center;
}

.selectify-select .selectify-select-footer button.selectify-clear-all {
  display: flex;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--r-br, var(--r-br-b), #999);
  border-radius: 999px;
  background-color: var(--r-bg-bt, var(--r-bg), #f8f8f8);
  color: var(--r-tx-bt, var(--r-tx), currentColor);
  font-size: .75rem;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.selectify-select.has-selections .selectify-select-footer {
  display: flex;
}

/* 1–3 options: hide Clear; 4+ options: show Clear */
.selectify-select.selectify-few-options .selectify-select-footer {
  display: none !important;
}

.selectify-select-dropdowns.selectify-few-options .options-inner {
  overflow: hidden;
}

.options-inner,
.selectify-selected-options.dual-inner {
  display: flex;
  inline-size: 100%;
  flex-direction: column;
  align-items: stretch;
}

.options-inner > *,
.selectify-selected-options.dual-inner > * {
  inline-size: 100%;
}

.selectify-clear-all span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.selectify-clear-all svg {
  inline-size: 20px;
  block-size: 20px;
  line-height: 0.9;
  vertical-align: middle;
}

.selectify-max-selection-message {
  position: absolute;
  inset-block-start: -40px;
  inset-inline-start: 50%;
  z-index: 10;
  display: flex;
  visibility: hidden;
  padding: 8px 14px;
  border: 2px solid var(--selectify-error-border-color) !important;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
  background: var(--selectify-error-bg) !important;
  color: var(--selectify-error-color) !important;
  font-size: 14px !important;
  font-weight: 600;
  line-height: 1.2 !important;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s;
  align-items: center;
  justify-content: center;
}

/* Show animation */
.selectify-max-selection-message.show {
  z-index: 7000;
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hide animation */
.selectify-max-selection-message.hide {
  visibility: hidden;
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}

.selectify select:disabled {
  cursor: not-allowed;
}

.remove-tag svg {
  inline-size: 18px;
  block-size: 18px;
}

body .selectify-clear-all span.icon svg {
  inline-size: 20px;
  block-size: 20px;
}

body .remove-tag,
body .selectify-dorpdown-arrow,
body .selectify-clear-all span.icon {
  line-height: 0.8;
}

/* Search icon: fixed px, no translateY (avoids theme conflicts). */
.selectify-select-dropdowns .search-input .manage-search {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-start: 16px;
  inline-size: 24px;
  block-size: 24px;
  opacity: 0.7;
  pointer-events: none;
}

.dual-search-input .manage-search {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 12px;
  inline-size: 22px;
  block-size: 22px;
  opacity: 0.7;
  pointer-events: none;
}

.selectify-selected-one-option label,
.selectify-selected-one-option .option-label,
.selectify-available-one-option label,
.selectify-available-one-option .option-label {
  padding: 0 !important;
  line-height: 1.2;
  pointer-events: none;
}

@media (width >= 36rem) {
  .selectify-selected-one-option label,
  .selectify-selected-one-option .option-label,
  .selectify-available-one-option label,
  .selectify-available-one-option .option-label {
    white-space: nowrap;
  }
}

/* Skip link for dual list accessibility */
.skip-to-selected.visually-hidden-focusable {
  position: absolute;
  inset-block-start: auto;
  inset-inline-start: -9999px;
  overflow: hidden;
  inline-size: 1px;
  block-size: 1px;
}

.skip-to-selected.visually-hidden-focusable:focus {
  position: static;
  inset-inline-start: auto;
  z-index: 1000;
  display: inline-block;
  overflow: visible;
  inline-size: auto;
  block-size: auto;
  margin-block-end: 0.5rem;
  padding-block: 0.5rem;
  padding-inline: 1rem;
  border-radius: 4px;
  background: var(--selectify-skip-link-bg);
  color: var(--selectify-skip-link-color);
  text-decoration: none;
}

.selectify-no-results {
  padding: 12px 16px;
  color: var(--selectify-placeholder-color, #666);
  font-size: 14px;
  font-style: italic;
  text-align: center;
}

.selectify-placeholder-option {
  cursor: default;
  opacity: 0.7;
  pointer-events: none;
}

.selectify-placeholder-option .selectify-placeholder-label {
  display: block;
  padding-block: 4px;
  padding-inline: 8px;
  color: var(--selectify-placeholder-color);
  font-style: italic;
}

.selectify-placeholder-option input[type="checkbox"] {
  display: none;
}

.selectify-placeholder-option .dual-available-arrow,
.selectify-placeholder-option .dual-selected-arrow {
  display: none;
}

body .selectify-select.selectify-select-dropdowns .search-input input {
  margin: 0;
  inline-size: 100%;
  padding-inline-start: 36px;
}

/* ============================================
   Rail & Halo look (shared controls, forced colors, reduced motion).
   Colors are derived only from --selectify-* variables,
   currentColor and transparent; no literal color.
   Field line = border color mixed 45% toward the text color.
   Ring = focus color mixed 65% toward the text color.
   Halo = ring at 22%. Rail (selection bar) = ring.
   ============================================ */

/* Clear All: a 32px ghost pill. */
body .selectify-select .selectify-select-footer button.selectify-clear-all {
  min-block-size: 32px;
  padding-block: 0;
  padding-inline: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--selectify-select-color, currentColor);
  font-size: 0.875rem;
  font-weight: 500;
  gap: 6px;
}

body .selectify-select .selectify-select-footer button.selectify-clear-all:hover {
  border-color: color-mix(in srgb, var(--selectify-select-border-color, var(--r-br, transparent)) 45%, var(--selectify-select-color, currentColor));
  background: var(--selectify-select-hover-bg, var(--r-bg));
}

body .selectify-select .selectify-select-footer button.selectify-clear-all:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  outline-offset: 2px;
}

body .selectify-select .selectify-clear-all svg,
body .selectify-select .selectify-clear-all span.icon svg {
  inline-size: 16px;
  block-size: 16px;
}

/* No results: centered, muted, with a search_off glyph. */
body .selectify-select .selectify-no-results {
  display: flex;
  min-block-size: 40px;
  padding-block: 0;
  color: color-mix(in srgb, var(--selectify-select-color, currentColor) 70%, transparent);
  font-size: 0.875rem;
  font-style: normal;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

body .selectify-select .selectify-no-results::before {
  background: currentcolor;
  flex: none;
  content: "";
  inline-size: 20px;
  block-size: 20px;
  mask: url("../icons/search_off.svg") center / contain no-repeat;
}

/* Max-selection notice: same radius family as the fields, an info glyph;
   its colors stay the --selectify-error-* variables. */
body .selectify-max-selection-message {
  border-width: 1px !important;
  border-radius: calc(var(--selectify-select-border-radius, 0.25rem) * 1.5);
  box-shadow: var(--selectify-dropdown-shadow, 0 0 transparent);
  font-size: 0.8125rem !important;
  gap: 8px;
}

body .selectify-max-selection-message::before {
  background: currentcolor;
  flex: none;
  content: "";
  inline-size: 16px;
  block-size: 16px;
  mask: url("../icons/info.svg") center / contain no-repeat;
}

/* Skip link (dual list): a pill with the ring. */
body .skip-to-selected.visually-hidden-focusable:focus {
  border-radius: 999px;
  outline: 2px solid color-mix(in srgb, var(--selectify-select-focus-border-color, var(--selectify-select-focus-border, currentColor)) 65%, var(--selectify-select-color, currentColor));
  outline-offset: 2px;
}

@media (forced-colors: active) {
  body .selectify-select .selectify-selected-display,
  body .selectify-select .selectify-available-display,
  body .selectify-select .dual-available,
  body .selectify-select .dual-selected,
  body .selectify-select .selectify-clear-all,
  body .selectify-select.selectify-select-dropdowns[data-multiple="true"] .selectify-selected-options .selectify-selected-one-option {
    border: 1px solid CanvasText;
  }

  /* Box shadows are dropped in forced colors, so the rail becomes a border. */
  body .selectify-select.selectify-select-dropdowns .selectify-available-one-option {
    border-inline-start: 3px solid Canvas;
  }

  body .selectify-select.selectify-select-dropdowns .selectify-available-one-option.s-selected {
    border-inline-start-color: Highlight;
    background: Highlight;
    color: HighlightText;
  }

  body .selectify-select.selectify-select-dual-list .dual-selected {
    border-inline-start: 3px solid Highlight;
  }

  body .selectify-select.selectify-select-dropdowns:focus-visible .selectify-selected-display,
  body .selectify-select:focus-visible,
  body .selectify-select .selectify-available-one-option:focus-visible,
  body .selectify-select .dual-item:focus-visible,
  body .selectify-select .search-input input:focus,
  body .selectify-select .remove-tag:focus-visible,
  body .selectify-select .selectify-clear-all:focus-visible,
  body .skip-to-selected.visually-hidden-focusable:focus {
    outline: 2px solid Highlight;
  }

  body .selectify svg {
    fill: CanvasText;
  }

  body .selectify-select .selectify-available-one-option.s-selected::after {
    background: HighlightText;
    forced-color-adjust: none;
  }

  body .selectify-select .selectify-selected-display::before,
  body .selectify-select .selectify-no-results::before,
  body .selectify-max-selection-message::before {
    background: CanvasText;
    forced-color-adjust: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .selectify,
  .selectify *,
  .selectify *::before,
  .selectify *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
