/* =============================================================================
   FUND DNA SCREENER  ·  css/fb-app/fund-dna-screener.css
   -----------------------------------------------------------------------------
   All class names prefixed `fbs-` (FundsBenchmark Screener).
   Depends entirely on fb-app/tokens.css — no hex outside this header comment.

   Layout
     1. Shell & local tokens
     2. Page hero
     3. Two-column grid (filters | DNA panel)
     4. Accordion sections
     5. Form primitives (tiles, chips, sliders, segmented controls)
     6. DNA panel (donut, legend, criteria, live count)
     7. Results strip + fund cards
     8. Compare bar
     9. Mobile sheet
    10. Responsive
    11. Reduced motion + print
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1 · Shell & local tokens
----------------------------------------------------------------------------- */

/* Three screener-specific semantic tokens not in the global token set:
     --fbs-accent-text : gold readable on both --bg and --surface
     --fbs-chip-ink    : always-dark ink for text on mid-tone palette chips
     --fbs-hover-tint  : subtle lift for clickable surfaces            */
.fbs-root {
  --fbs-accent-text: var(--gold);
  --fbs-chip-ink:    #0a0a0b;
  --fbs-hover-tint:  rgba(255, 255, 255, 0.025);
  background: var(--bg);
  color: var(--text);
  padding: var(--sp-6) 0 var(--sp-7);
  min-height: 100vh;
}
[data-theme="light"] .fbs-root,
[data-theme="light"].fbs-root {
  --fbs-accent-text: var(--gold-dark);
  --fbs-hover-tint:  rgba(16, 16, 20, 0.04);
}

.fbs-root,
.fbs-root *,
.fbs-root *::before,
.fbs-root *::after { box-sizing: border-box; }

/* Cloak: hide Alpine-managed nodes until component boots */
.fbs-root [x-cloak] { display: none !important; }

.fbs-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* -----------------------------------------------------------------------------
   2 · Page hero
----------------------------------------------------------------------------- */
.fbs-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-5);
  align-items: end;
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}

.fbs-hero__eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--fbs-accent-text);
  margin-bottom: var(--sp-2);
}
.fbs-hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  color: var(--text);
  margin: 0;
}
.fbs-hero__sub {
  font-size: var(--fs-body);
  color: var(--text-muted);
  margin-top: var(--sp-2);
  max-width: 56ch;
}

.fbs-hero__stats {
  display: flex;
  gap: var(--sp-5);
  align-items: stretch;
}
.fbs-hero__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: var(--sp-5);
  border-left: 1px solid var(--border);
  min-width: 0;
}
.fbs-hero__stat:first-child { padding-left: 0; border-left: 0; }
.fbs-hero__stat-l {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}
.fbs-hero__stat-v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-stat-md);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}
.fbs-hero__stat-v--match { color: var(--fbs-accent-text); }

/* -----------------------------------------------------------------------------
   3 · Two-column grid
----------------------------------------------------------------------------- */
.fbs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--sp-6);
  align-items: start;
}

.fbs-filters {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
}

/* DNA sidebar — sticky so the donut stays in view as user scrolls sections */
.fbs-dna {
  position: sticky;
  top: var(--sp-5);
  align-self: start;
}

/* On desktop, mobile bar is hidden; full panel is shown */
.fbs-dna__mobile-bar { display: none; }
.fbs-dna__full {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  box-shadow: var(--shadow-card);
}

/* -----------------------------------------------------------------------------
   4 · Accordion sections
----------------------------------------------------------------------------- */
.fbs-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.fbs-section[data-state="open"] {
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
}

.fbs-section__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: background var(--dur) var(--ease);
}
.fbs-section__head:hover       { background: var(--fbs-hover-tint); }
.fbs-section__head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Letter badge */
.fbs-section__letter {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  letter-spacing: 0;
  transition: all var(--dur) var(--ease);
}
.fbs-section[data-state="open"] .fbs-section__letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fbs-chip-ink);
}
.fbs-section[data-state="done"] .fbs-section__letter {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--fbs-accent-text);
}

.fbs-section__titles { flex: 1; min-width: 0; }
.fbs-section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h2);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--lh-tight);
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}
.fbs-section__optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}
.fbs-section__sub {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: 2px;
  line-height: var(--lh-snug);
  display: block;
}

.fbs-section__summary {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-right: var(--sp-3);
  white-space: nowrap;
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fbs-section[data-state="done"] .fbs-section__summary { color: var(--fbs-accent-text); }

.fbs-section__hint-link {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--fbs-accent-text);
  margin-right: var(--sp-2);
  white-space: nowrap;
}

.fbs-section__chev {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.fbs-section[data-state="open"] .fbs-section__chev {
  transform: rotate(180deg);
  color: var(--fbs-accent-text);
}

/* Section body — hidden until [data-state="open"] */
.fbs-section__body {
  display: none;
  padding: 0 var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--border-soft);
  padding-top: var(--sp-5);
  animation: fbs-fade-in var(--dur-slow) var(--ease);
}
.fbs-section[data-state="open"] .fbs-section__body { display: block; }

@keyframes fbs-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fbs-fieldgroup {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.fbs-fieldgroup + .fbs-fieldgroup {
  padding-top: var(--sp-4);
  margin-top: var(--sp-4);
  border-top: 1px solid var(--border-soft);
}
.fbs-field-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
  display: block;
}
.fbs-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  align-items: flex-start;
}
.fbs-field-row > * { min-width: 0; }

/* -----------------------------------------------------------------------------
   5 · Form primitives
----------------------------------------------------------------------------- */

/* ── Tiles (Asset Class large radio cards) ── */
.fbs-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-2);
}
.fbs-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all var(--dur) var(--ease);
  text-align: left;
  font: inherit;
  color: inherit;
}
.fbs-tile:hover { border-color: var(--accent); }
.fbs-tile[aria-pressed="true"] {
  background: color-mix(in oklab, var(--tile-accent, var(--accent)) 15%, transparent);
  border-color: var(--tile-accent, var(--accent));
}
.fbs-tile__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--text);
}
.fbs-tile__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.fbs-tile[aria-pressed="true"] .fbs-tile__count { color: var(--fbs-accent-text); }

/* ── Chips / pills ── */
.fbs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.fbs-chip-picker {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-soft);
}
.fbs-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-small);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  min-height: 32px; /* WCAG 2.5.5 min hit area */
}
.fbs-chip:hover { border-color: var(--accent); color: var(--text); }
.fbs-chip[aria-pressed="true"] {
  background: var(--chip-accent, var(--accent));
  border-color: var(--chip-accent, var(--accent));
  color: var(--fbs-chip-ink);
}
.fbs-chip--ghost {
  background: transparent;
  border-style: dashed;
  color: var(--text-muted);
}
.fbs-chip__weight {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0,0,0,0.22);
  color: inherit;
  opacity: 0.85;
}
.fbs-chip__x {
  display: inline-flex;
  width: 14px; height: 14px;
  border-radius: 50%;
  align-items: center; justify-content: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0.6;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
}
.fbs-chip__x:hover { opacity: 1; }

/* ── Segmented controls ── */
.fbs-segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 3px;
  gap: 2px;
}
.fbs-segmented__opt {
  padding: 7px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  min-height: 32px;
}
.fbs-segmented__opt:hover { color: var(--text); }
.fbs-segmented__opt[aria-pressed="true"] {
  background: var(--accent);
  color: var(--fbs-chip-ink);
}

/* ── Sliders ──
   --slider-color on .fbs-weight-row (ancestor) sets the accent per row.
   Never redeclare --slider-color on .fbs-slider itself (shadows ancestor).  */
.fbs-slider {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.fbs-slider__track {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 4px;
  margin-top: -2px;
  background: var(--surface-2);
  border-radius: 2px;
}
.fbs-slider__fill {
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  background: var(--slider-color, var(--accent));
  border-radius: 2px;
  left: 0;      /* single-knob default; double-knob overrides via inline style */
}
.fbs-slider__knob {
  position: absolute;
  top: 50%;
  width: 18px; height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--slider-color, var(--accent));
  cursor: grab;
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}
.fbs-slider__knob:hover,
.fbs-slider__knob:focus-visible {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--slider-color, var(--accent)) 28%, transparent);
  outline: none;
}
.fbs-slider__knob:active { cursor: grabbing; }

.fbs-slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-2) 0;
}
.fbs-slider-row__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--text-2);
}
.fbs-slider-row__value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fbs-accent-text);
  font-weight: 600;
  white-space: nowrap;
}
.fbs-slider-row__slider { grid-column: 1 / -1; }

.fbs-srri-axis {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-1);
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.fbs-srri-axis__mark { width: 22px; text-align: center; }
.fbs-srri-axis__mark--active {
  color: var(--fbs-accent-text);
  font-weight: 700;
}

/* ── Weight rows (country/sector floor sliders) ── */
.fbs-weight-rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.fbs-weight-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 60px 24px;
  gap: var(--sp-3);
  align-items: center;
}
.fbs-weight-row__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* Colour dot matching the slider accent */
.fbs-weight-row__name::before {
  content: '';
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--slider-color, var(--accent));
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--slider-color, var(--accent)) 20%, transparent);
}
.fbs-weight-row__value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--slider-color, var(--fbs-accent-text));
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.fbs-weight-row__rm {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: all var(--dur) var(--ease);
}
.fbs-weight-row__rm:hover { color: var(--neg); border-color: var(--neg); }

/* -----------------------------------------------------------------------------
   6 · DNA panel
----------------------------------------------------------------------------- */
.fbs-dna__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.fbs-dna__live {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--pos);
}
.fbs-dna__live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pos);
  animation: fbs-pulse 1.6s ease-in-out infinite;
}
@keyframes fbs-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Active section badge */
.fbs-dna__context {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
}
.fbs-dna__context-letter {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--fbs-chip-ink);
  display: flex;
  align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-small);
  flex-shrink: 0;
}
.fbs-dna__context-t {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--text);
  line-height: 1.1;
}
.fbs-dna__context-s {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}

/* Donut */
.fbs-donut {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 240px;
  margin: 0 auto;
}
.fbs-donut svg { display: block; width: 100%; height: 100%; }
.fbs-donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.fbs-donut__center-v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-stat-md);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}
.fbs-donut__center-l {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
  max-width: 12ch;
  text-align: center;
  line-height: 1.2;
}

/* Legend */
.fbs-legend {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 6px 10px;
  align-items: center;
  font-size: 11px;
}
.fbs-legend__sw {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.fbs-legend__sw--round { border-radius: 50%; }
.fbs-legend__l { color: var(--text-2); }
.fbs-legend__v {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 10px;
  text-align: right;
}

/* Caption */
.fbs-dna__caption {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-soft);
  font-size: var(--fs-small);
  color: var(--text-2);
  line-height: var(--lh-snug);
}
.fbs-dna__caption strong { color: var(--text); font-weight: 600; }

/* Live count */
.fbs-dna__count {
  text-align: center;
  padding: var(--sp-3) 0 var(--sp-2);
}
.fbs-dna__count-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 48px;
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  color: var(--fbs-accent-text);
  font-variant-numeric: tabular-nums;
}
.fbs-dna__count-of {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: var(--sp-2);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}
.fbs-dna__bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: var(--sp-2);
}
.fbs-dna__bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--dur-slow) var(--ease);
}

/* Criteria chips inside DNA panel */
.fbs-criteria {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-soft);
}
.fbs-criteria__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.fbs-criteria__list { display: flex; flex-wrap: wrap; gap: 6px; }
.fbs-criteria__empty {
  font-size: var(--fs-small);
  color: var(--text-muted);
  font-style: italic;
}

/* CTA button */
.fbs-dna__cta { /* no extra style needed — fbs-btn handles it */ }

/* Button system (local to screener — complement, not override, to .btn primitives) */
.fbs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 16px;
  border-radius: var(--r-lg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.fbs-btn--primary {
  background: var(--accent);
  color: var(--fbs-chip-ink);
  border-color: var(--accent);
}
.fbs-btn--primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
}
.fbs-btn--secondary {
  border-color: var(--accent);
  color: var(--fbs-accent-text);
}
.fbs-btn--secondary:hover { background: var(--accent-soft); }
.fbs-btn--ghost {
  color: var(--text-muted);
  border-color: var(--border);
}
.fbs-btn--ghost:hover { color: var(--text); border-color: var(--accent); }
.fbs-btn--block { width: 100%; }

/* -----------------------------------------------------------------------------
   7 · Results strip
----------------------------------------------------------------------------- */
.fbs-results {
  margin-top: var(--sp-6);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
}
.fbs-results__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.fbs-results__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h1);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin: 0;
}
.fbs-results__title-n {
  color: var(--fbs-accent-text);
  font-weight: 700;
}
.fbs-results__sort {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  color: var(--text-muted);
}
.fbs-results__sort select {
  font: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 24px 6px 10px;
  margin-left: 6px;
  cursor: pointer;
  font-weight: 600;
  -webkit-appearance: auto;
}

.fbs-fundgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3);
}

/* Fund card */
.fbs-fund {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  position: relative;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
}
.fbs-fund:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.fbs-fund[data-selected="true"] {
  border: 2px solid var(--accent);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 60%);
}
.fbs-fund__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.fbs-fund__logo {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: var(--fbs-accent-text);
  flex-shrink: 0;
}
.fbs-fund__brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fbs-fund__check {
  width: 22px; height: 22px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: transparent;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: transparent;
  padding: 0;
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
  font-size: 12px;
  pointer-events: none; /* card is the click target now */
}
.fbs-fund[data-selected="true"] .fbs-fund__check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fbs-chip-ink);
}
.fbs-fund__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  color: var(--text);
  line-height: 1.3;
}
.fbs-fund__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.fbs-fund__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}
.fbs-fund__stat {
  background: var(--surface-2);
  border-radius: var(--r-xs);
  padding: 6px 10px;
}
.fbs-fund__stat-l {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}
.fbs-fund__stat-v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-stat-sm);
  color: var(--text);
}
.fbs-fund__stat-v.pos { color: var(--pos); }
.fbs-fund__stat-v.neg { color: var(--neg); }

/* Loading / empty states */
.fbs-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  color: var(--text-muted);
}
.fbs-state__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h2);
  color: var(--text);
  margin-bottom: var(--sp-2);
}

/* Spinner */
.fbs-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: fbs-spin 0.8s linear infinite;
}
@keyframes fbs-spin { to { transform: rotate(360deg); } }

/* -----------------------------------------------------------------------------
   8 · Compare bar (sticky bottom)
----------------------------------------------------------------------------- */
.fbs-compare {
  position: sticky;
  bottom: var(--sp-4);
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-elevated);
  z-index: 5;
}
.fbs-compare__n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  color: var(--fbs-accent-text);
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
}
.fbs-compare__t {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  color: var(--text-muted);
  flex: 1;
}
.fbs-compare__actions { display: flex; gap: var(--sp-2); }

/* -----------------------------------------------------------------------------
   9 · Mobile DNA sheet
----------------------------------------------------------------------------- */
/* Sheet node is hidden on desktop by default — display:none unless inside
   a max-width:900px media query or [data-open="true"] */
.fbs-sheet { display: none; }

/* Overlay */
.fbs-sheet[data-open="true"] {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10,10,11,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  animation: fbs-fade-in var(--dur) var(--ease);
}

/* Slide-up panel */
.fbs-sheet__panel {
  width: 100%;
  max-height: 90vh;
  background: var(--surface);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border-top: 1px solid var(--border);
  padding: var(--sp-3) var(--gutter-mobile) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  overflow-y: auto;
  animation: fbs-sheet-up var(--dur-slow) var(--ease);
}
@keyframes fbs-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.fbs-sheet__grabber {
  width: 36px; height: 4px;
  background: var(--text-dim);
  border-radius: 2px;
  margin: 0 auto var(--sp-3);
  opacity: 0.6;
  cursor: pointer;
  flex-shrink: 0;
}

/* Inside the sheet, replicate the .fbs-dna__full card feel */
.fbs-sheet .fbs-dna__count { text-align: center; padding: var(--sp-3) 0 var(--sp-2); }
.fbs-sheet .fbs-dna__count-value { font-size: 48px; }
.fbs-sheet .fbs-dna__count-of { display: block; }
.fbs-sheet .fbs-legend { display: grid; }

/* -----------------------------------------------------------------------------
   10 · Responsive
----------------------------------------------------------------------------- */

/* Tablet — narrower DNA */
@media (max-width: 1100px) {
  .fbs-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-5); }
  .fbs-hero__title { font-size: 30px; }
}

/* ≤900px — DNA collapses to slim sticky bar; full panel becomes a sheet */
@media (max-width: 900px) {
  .fbs-root { padding: var(--sp-5) 0; }
  .fbs-wrap { padding: 0 var(--gutter-mobile); }

  .fbs-hero { grid-template-columns: 1fr; }
  .fbs-hero__stats {
    border-top: 1px solid var(--border);
    padding-top: var(--sp-4);
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .fbs-hero__stats::-webkit-scrollbar { display: none; }

  .fbs-layout { grid-template-columns: 1fr; gap: 0; }

  /* Collapse DNA to sticky summary bar */
  .fbs-dna {
    position: sticky;
    top: 0;
    z-index: 6;
    margin: 0 calc(-1 * var(--gutter-mobile)) var(--sp-4);
  }
  .fbs-dna__full { display: none; }
  .fbs-dna__mobile-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--sp-3) var(--gutter-mobile);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  }
  .fbs-dna__mobile-count {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--fbs-accent-text);
    line-height: 1;
    flex-shrink: 0;
  }
  .fbs-dna__mobile-label {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: var(--fs-small);
    color: var(--text-2);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .fbs-dna__mobile-cta {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 11px;
  }

  /* Sheet becomes visible on mobile */
  .fbs-sheet { display: block; }
  .fbs-sheet[data-open="false"] { display: none; }
  .fbs-sheet[data-open="true"] { display: flex; }

  .fbs-section__summary { max-width: none; }
  .fbs-results__head { flex-direction: column; align-items: flex-start; }
  .fbs-weight-row {
    grid-template-columns: minmax(80px, 1fr) minmax(0, 2fr) 50px 24px;
  }
}

/* Narrow phones (≈375px) */
@media (max-width: 480px) {
  .fbs-hero__title { font-size: 26px; }
  .fbs-section__head { padding: var(--sp-3) var(--sp-4); gap: var(--sp-2); }
  .fbs-section__body { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .fbs-section__summary { display: none; }
  .fbs-fundgrid { grid-template-columns: 1fr; }
  .fbs-compare { flex-wrap: wrap; gap: var(--sp-2); }
  .fbs-compare__actions { width: 100%; }
  .fbs-compare__actions .fbs-btn { flex: 1; }
  .fbs-tiles { grid-template-columns: repeat(2, 1fr); }
  .fbs-segmented { display: flex; flex-wrap: wrap; }
  .fbs-weight-row {
    grid-template-columns: 1fr auto auto;
    row-gap: 4px;
  }
  .fbs-weight-row .fbs-slider { grid-column: 1 / -1; }
}

/* -----------------------------------------------------------------------------
   11 · Reduced motion + print
----------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fbs-root *,
  .fbs-root *::before,
  .fbs-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .fbs-root { background: #fff; color: #000; padding: 0; }
  .fbs-dna, .fbs-section { box-shadow: none; }
  .fbs-compare, .fbs-section__chev, .fbs-dna__mobile-bar, .fbs-sheet { display: none !important; }
  .fbs-dna__full { display: flex; }
  .fbs-section { break-inside: avoid; }
  .fbs-fund { break-inside: avoid; }
}
