/* Styled dropdowns (js/fancy-select.js): the box, and the list that opens from it with a short fade and lift, or as a
   sheet from the bottom on a phone. Colours come from the theme's own tokens, so light and dark both work. */
.fs-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; opacity: 0 !important; pointer-events: none !important; border: 0 !important; }

/* the box */
.fs-trigger { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 10px 14px; box-sizing: border-box;
  font: 500 15px/1.3 var(--font-body); color: var(--text-primary); text-align: left; cursor: pointer;
  background: var(--bg-glass-input); border: 1px solid var(--border-card); border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, transform 0.12s ease; }
.fs-trigger:hover { border-color: var(--border-glow); background-color: var(--bg-card-hover, var(--bg-glass-input)); }
.fs-trigger:active { transform: scale(0.995); }
.fs-trigger:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 2px; }
.fs-trigger[aria-expanded="true"] { border-color: var(--accent-teal); box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.14); }
.fs-trigger.fs-set { border-color: var(--accent-teal); box-shadow: inset 0 0 0 1px var(--accent-teal); }
.fs-trigger.fs-set[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--accent-teal), 0 0 0 4px rgba(14, 116, 144, 0.14); }
.fs-value { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fs-set .fs-value { font-weight: 650; }
.fs-count { flex: none; padding: 2px 8px; font-size: 12px; font-weight: 700; line-height: 1.4; color: var(--text-secondary);
  background: rgba(100, 116, 139, 0.13); border-radius: 999px; font-variant-numeric: tabular-nums; }
.fs-count:empty { display: none; }
.fs-chev { flex: none; width: 12px; height: 8px; color: var(--text-muted); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.fs-trigger[aria-expanded="true"] .fs-chev { transform: rotate(180deg); color: var(--accent-teal); }

/* the list */
.fs-panel { position: absolute; z-index: 1250; display: flex; flex-direction: column; box-sizing: border-box; max-height: 380px; overflow: hidden;
  background: var(--bg-surface, #fff); border: 1px solid var(--border-card); border-radius: 16px;
  box-shadow: 0 24px 60px -18px rgba(15, 23, 42, 0.35), 0 6px 18px -8px rgba(15, 23, 42, 0.16);
  opacity: 0; transform: translateY(-6px) scale(0.985); transform-origin: top center;
  transition: opacity 0.16s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.fs-panel.fs-up { transform: translateY(6px) scale(0.985); transform-origin: bottom center; }
.fs-panel.on { opacity: 1; transform: none; }
.fs-find { position: relative; flex: none; padding: 10px 10px 6px; }
.fs-find svg { position: absolute; left: 22px; top: 50%; width: 16px; height: 16px; margin-top: 2px; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.fs-find input { width: 100%; height: 40px; padding: 0 12px 0 36px; box-sizing: border-box; font: 500 14.5px/1 var(--font-body); color: var(--text-primary);
  background: var(--bg-deep, #f3f5fa); border: 1px solid transparent; border-radius: 10px; }
.fs-find input:focus { outline: none; border-color: var(--accent-teal); background: var(--bg-surface, #fff); }
.fs-find input::placeholder { color: var(--text-muted); opacity: 1; }
/* position: relative so an item's offsetTop is measured from the list (the scroll into view was off by the search box) */
.fs-list { position: relative; flex: 1 1 auto; min-height: 0; margin: 0; padding: 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, 0.4) transparent; }
.fs-list:focus { outline: none; }
.fs-list::-webkit-scrollbar { width: 8px; }
.fs-list::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.35); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.fs-group { position: sticky; top: -6px; z-index: 1; margin: 4px 0 2px; padding: 8px 10px 5px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted); background: var(--bg-surface, #fff); }
.fs-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  font-size: 14.5px; line-height: 1.3; color: var(--text-primary); transition: background-color 0.12s ease; }
.fs-opt.fs-active { background: rgba(14, 116, 144, 0.09); }
.fs-opt[aria-selected="true"] { font-weight: 650; color: var(--accent-teal); }
.fs-opt[aria-disabled="true"] { opacity: 0.45; cursor: default; }
.fs-tick { display: inline-flex; flex: none; width: 16px; height: 16px; color: var(--accent-teal); opacity: 0; transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.fs-tick svg { width: 16px; height: 16px; }
.fs-opt[aria-selected="true"] .fs-tick { opacity: 1; transform: none; }
.fs-t { flex: 1 1 auto; min-width: 0; }
.fs-n { flex: none; margin-left: 8px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--text-muted);
  background: rgba(100, 116, 139, 0.1); border-radius: 999px; font-variant-numeric: tabular-nums; }
.fs-opt[aria-selected="true"] .fs-n { color: var(--accent-teal); background: rgba(14, 116, 144, 0.1); }
.fs-none { margin: 0; padding: 14px 16px 16px; font-size: 14px; color: var(--text-muted); }
/* the box to type in hides what does not match: hidden must win over display: flex (typing seemed to do nothing) */
.fs-opt[hidden], .fs-group[hidden], .fs-none[hidden] { display: none !important; }

/* on a phone: a sheet from the bottom over a dimmed page */
.fs-backdrop { position: fixed; inset: 0; z-index: 1400; background: rgba(15, 23, 42, 0.42); opacity: 0; transition: opacity 0.22s ease; }
.fs-backdrop.on { opacity: 1; }
.fs-panel.fs-sheet { position: fixed; z-index: 1401; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 78vh;
  border-radius: 22px 22px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); opacity: 1;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.fs-panel.fs-sheet.on { transform: none; }
.fs-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 8px; flex: none; }
.fs-head strong { font: 700 17px/1.3 var(--font-display); color: var(--text-primary); }
.fs-grip { position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(100, 116, 139, 0.35); }
.fs-close { padding: 6px 12px; font: 650 14px/1 var(--font-body); color: var(--accent-teal); background: none; border: 0; border-radius: 8px; cursor: pointer; }
.fs-sheet .fs-find { padding: 4px 14px 8px; }
.fs-sheet .fs-find svg { left: 26px; margin-top: -2px; }
.fs-sheet .fs-find input { height: 44px; font-size: 15.5px; }
.fs-sheet .fs-list { padding: 4px 10px 14px; }
.fs-sheet .fs-opt { min-height: 48px; padding: 11px 12px; font-size: 15.5px; }
html.fs-locked, html.fs-locked body { overflow: hidden; }

@media (max-width: 640px) {
  .fs-trigger { min-height: 44px; padding: 9px 11px; font-size: 14px; gap: 6px; }
  .fs-count { padding: 1px 6px; font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .fs-panel, .fs-panel.fs-sheet, .fs-backdrop, .fs-chev, .fs-tick, .fs-trigger { transition: none; }
}
