/* ============================================================================
   FUND COMPARISON — css/fb-app/compare.css (2026-05-xx redesign)
   Full-page wizard → fund list → compare view.

   ALL colours use semantic tokens from tokens.css.
   Light/dark is 100% automatic — [data-theme="light"] on <html> flips every
   token; no overrides needed here.

   Load order: tokens.css → primitives.css → compare.css
   ============================================================================ */

/* ── Local geometry tokens ──────────────────────────────────────────────── */
:root {
  --fc-header-h: 64px;   /* matches partials/fb-header.php height */
  --fc-bar-h:    56px;   /* wizard & compare sub-nav bar */
}
/* WP admin bar pushes our header down — bump the layer offset to match */
body.admin-bar              { --fc-header-h: 96px;  } /* 64 + 32 */
@media (max-width: 782px) {
  body.admin-bar            { --fc-header-h: 110px; } /* 64 + 46 */
}

/* ════════════════════════════════════════════════════════════════════════════
   LAYER BASE — all three views share this positioning
════════════════════════════════════════════════════════════════════════════ */
.fc-layer {
  position: fixed;
  top: var(--fc-header-h);
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  /* transitions handled per-class below */
}

/* Hidden state — fade + slight lift */
.fc-layer.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

/* Visible state */
.fc-layer:not(.is-hidden):not(.is-exit) {
  opacity: 1;
  transform: none;
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}

/* Wizard exit — slides upward off screen */
#fcView-wizard.is-exit {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 360ms var(--ease), opacity 360ms var(--ease);
}

/* ════════════════════════════════════════════════════════════════════════════
   SHARED — frosted sub-nav bar used by wizard + compare
════════════════════════════════════════════════════════════════════════════ */
.fc-subnav {
  flex-shrink: 0;
  height: var(--fc-bar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.fc-subnav-gap { flex: 1; min-width: 0; }

/* Back / ghost link used in sub-navs */
.fc-subnav-back {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--r-md);
  background: transparent; border: 1px solid var(--border-soft);
  color: var(--text-muted); font-family: var(--font-body); font-size: 12px;
  cursor: pointer; white-space: nowrap; text-decoration: none; flex-shrink: 0;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.fc-subnav-back:hover {
  background: var(--surface); border-color: var(--border); color: var(--text);
}
.fc-subnav-back svg {
  width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none;
}

/* Page title in sub-nav */
.fc-subnav-title {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  letter-spacing: var(--tracking-display); color: var(--text);
  white-space: nowrap; flex-shrink: 0;
}
.fc-subnav-title em { font-style: normal; color: var(--accent); }

.fc-subnav-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════════════════
   WIZARD
════════════════════════════════════════════════════════════════════════════ */
#fcView-wizard { z-index: 300; }

/* ── Progress dots ── */
.fw-progress { display: flex; gap: 5px; align-items: center; }
.fw-dot {
  height: 3px; width: 22px; border-radius: 2px; background: var(--surface-2);
  transition: background var(--dur) var(--ease), width var(--dur) var(--ease);
}
.fw-dot.fw-dot--done  { background: color-mix(in oklab, var(--accent) 38%, transparent); }
.fw-dot.fw-dot--active { background: var(--accent); width: 34px; }

.fw-counter {
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim);
  white-space: nowrap; flex-shrink: 0;
}
.fw-counter em { color: var(--accent); font-style: normal; }

/* Skip */
.fw-skip {
  appearance: none; background: none; border: none;
  font-family: var(--font-body); font-size: 12px; color: var(--text-dim);
  cursor: pointer; padding: 6px 8px; flex-shrink: 0;
  transition: color var(--dur) var(--ease);
}
.fw-skip:hover { color: var(--text-muted); }

/* ── Scrollable step body ── */
.fw-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent;
}
.fw-body::-webkit-scrollbar { width: 4px; }
.fw-body::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 2px; }

.fw-body-inner {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-8) var(--gutter);
}

/* ── Step panels ── */
.fw-step { width: 100%; max-width: 800px; display: none; }
.fw-step.fw-step--active {
  display: block;
  animation: fw-in 320ms var(--ease) forwards;
}
.fw-step.from-back.fw-step--active {
  animation: fw-back 320ms var(--ease) forwards;
}
@keyframes fw-in   { from { opacity:0; transform:translateX(24px); } to { opacity:1; transform:none; } }
@keyframes fw-back { from { opacity:0; transform:translateX(-24px); } to { opacity:1; transform:none; } }

.fw-eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--sp-3);
}
.fw-step-title {
  font-family: var(--font-display); font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 700; letter-spacing: var(--tracking-tight);
  color: var(--text); line-height: var(--lh-tight); margin-bottom: var(--sp-2);
}
.fw-step-sub {
  font-size: var(--fs-body); color: var(--text-muted); line-height: var(--lh-body);
  max-width: 540px; margin-bottom: var(--sp-6);
}

/* ── Chip grid (asset class + sector) ── */
.fw-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--sp-5); }

/* Shared chip style — reuses .btn primitives variant */
.fw-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border-soft);
  color: var(--text-2); font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform 100ms var(--ease);
}
.fw-chip:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.fw-chip:active { transform: scale(.96); }
.fw-chip.is-active {
  background: color-mix(in oklab, var(--accent) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 36%, transparent);
  color: var(--accent);
}
.fw-chip-ico { font-size: 12px; opacity: .8; flex-shrink: 0; }
.fw-chip-ct {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted);
}
.fw-chip.is-active .fw-chip-ct {
  color: color-mix(in oklab, var(--accent) 58%, transparent);
}

/* ── Per-item threshold block ── */
.fw-threshold-block {
  border: 1px solid var(--border-soft); border-radius: var(--r-card);
  overflow: hidden; margin-bottom: var(--sp-7);
}
.fw-threshold-block:empty { display: none; }

.fw-threshold-hdr {
  padding: 8px 18px;
  background: var(--surface-2); border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim);
}

.fw-ti {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  background: var(--surface); border-bottom: 1px solid var(--border-soft);
}
.fw-ti:last-child { border-bottom: none; }

.fw-ti-name {
  display: flex; align-items: center; gap: 7px;
  min-width: 150px; flex-shrink: 0;
}
.fw-ti-ico { font-size: 12px; color: var(--accent); opacity: .85; flex-shrink: 0; }
.fw-ti-flag { font-size: 16px; line-height: 1; flex-shrink: 0; }
.fw-ti-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px;
}
.fw-ti-wrap { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }

/* Slider — shared between threshold rows */
input[type="range"].fw-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; outline: none; cursor: pointer; min-width: 0;
  background: linear-gradient(
    to right,
    var(--accent) var(--pct, 0%),
    var(--surface-2) var(--pct, 0%)
  );
}
input[type="range"].fw-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
  cursor: pointer;
}
input[type="range"].fw-slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); cursor: pointer;
}
.fw-slider-val {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--accent); min-width: 34px; text-align: right; flex-shrink: 0;
}

/* ── Country chip grid ── */
.fw-country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 7px; margin-bottom: var(--sp-5);
}
.fw-cchip {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--border-soft); color: var(--text-2);
  font-size: 12px; font-weight: 500; cursor: pointer; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.fw-cchip:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.fw-cchip.is-active {
  background: color-mix(in oklab, var(--accent) 10%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 34%, transparent);
  color: var(--accent);
}
.fw-cchip-flag { font-size: 16px; line-height: 1; flex-shrink: 0; }
.fw-cchip-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-cchip-ct { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.fw-cchip.is-active .fw-cchip-ct { color: color-mix(in oklab, var(--accent) 54%, transparent); }

/* Country search */
.fw-csearch { position: relative; margin-bottom: var(--sp-4); }
.fw-csearch svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; stroke: var(--text-muted); stroke-width: 2; fill: none;
  pointer-events: none;
}
.fw-csearch-input {
  width: 100%; padding: 9px 12px 9px 34px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); color: var(--text);
  font-family: var(--font-body); font-size: 13px; outline: none;
  transition: border-color var(--dur) var(--ease);
}
.fw-csearch-input:focus { border-color: var(--border); }
.fw-csearch-input::placeholder { color: var(--text-dim); }

/* ── SRRI risk row ── */
.fw-srri-row { display: flex; gap: 7px; margin-bottom: var(--sp-6); }
.fw-srri-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; height: 64px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border-soft);
  color: var(--text-2); cursor: pointer; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.fw-srri-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.fw-srri-btn.is-active {
  background: color-mix(in oklab, var(--accent) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 38%, transparent);
  color: var(--accent);
}
.fw-srri-num { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1; }
.fw-srri-lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: .03em; text-transform: uppercase; opacity: .6; }

/* ── Market cap style row ── */
.fw-mcap-row { display: flex; gap: 7px; margin-bottom: var(--sp-6); }
.fw-mcap-chip {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 13px 10px;
  border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--border-soft); color: var(--text-2);
  cursor: pointer; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.fw-mcap-chip:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.fw-mcap-chip.is-active {
  background: color-mix(in oklab, var(--accent) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 38%, transparent);
  color: var(--accent);
}
.fw-mcap-name { font-size: 13px; font-weight: 500; }
.fw-mcap-desc { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.fw-mcap-chip.is-active .fw-mcap-desc { color: color-mix(in oklab, var(--accent) 54%, transparent); }

/* Section divider label */
.fw-section-lbl {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: var(--sp-3); margin-top: var(--sp-5);
}

/* ── Wizard bottom foot ── */
.fw-foot {
  flex-shrink: 0; height: 72px;             /* taller than sub-nav — CTA needs breathing room */
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--gutter);
  border-top: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.fw-foot-spacer { flex: 1; }

/* Wizard primary CTA — big gold pill */
.fw-cta.btn {
  height: 46px;
  padding: 0 28px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  border: 1.5px solid var(--accent);
  gap: var(--sp-2);
  display: inline-flex; align-items: center;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.fw-cta.btn:hover {
  background: color-mix(in oklab, var(--accent) 85%, white);
  border-color: color-mix(in oklab, var(--accent) 85%, white);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent);
}
.fw-cta.btn svg { pointer-events: none; }

/* ════════════════════════════════════════════════════════════════════════════
   FUND LIST VIEW  — full-width data grid, not a content page
════════════════════════════════════════════════════════════════════════════ */
#fcView-list { z-index: 200; }

/* List top bar */
.fl-nav {
  flex-shrink: 0; height: 48px;
  display: flex; align-items: center; flex-wrap: nowrap;
  gap: var(--sp-3); padding: 0 var(--gutter);
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}

.fl-count {
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  color: var(--text); white-space: nowrap; flex-shrink: 0;
}
.fl-count em { color: var(--accent); font-style: normal; }

/* Active filter tags — truncate row rather than wrap */
.fl-filter-tags {
  display: flex; flex-wrap: nowrap; gap: 5px; flex: 1; min-width: 0;
  overflow: hidden;
}
.fl-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .04em; color: var(--accent); white-space: nowrap;
  flex-shrink: 0;
}
.fl-tag-key { color: color-mix(in oklab, var(--accent) 52%, transparent); margin-right: 2px; }

/* Scrollable table body — fills everything below the nav */
.fl-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent;
}
.fl-body::-webkit-scrollbar { width: 4px; }
.fl-body::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 2px; }

/* Fund table — true full-width grid with 20px edge insets */
.fl-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.fl-table colgroup col.col-fund    { width: 38%; }
.fl-table colgroup col.col-ac      { width: 12%; }
.fl-table colgroup col.col-ret     { width: 9%;  }
.fl-table colgroup col.col-srri    { width: 6%;  }
.fl-table colgroup col.col-aum     { width: 11%; }
.fl-table colgroup col.col-ter     { width: 7%;  }
.fl-table colgroup col.col-sel     { width: 8%;  }

.fl-table thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 8px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim);
  white-space: nowrap; text-align: left;
}
.fl-table thead th:first-child { padding-left: var(--gutter); }
.fl-table thead th:last-child  { padding-right: var(--gutter); text-align: right; }

.fl-row {
  border-bottom: 1px solid var(--border-soft); cursor: pointer;
  transition: background 80ms var(--ease);
}
.fl-row:hover { background: var(--surface); }
.fl-row.is-selected { background: color-mix(in oklab, var(--accent) 5%, var(--bg)); }

.fl-row td { padding: 11px 12px; vertical-align: middle; }
.fl-row td:first-child { padding-left: var(--gutter); }
.fl-row td:last-child  { padding-right: var(--gutter); text-align: right; }

/* Fund name cell */
.fl-fund-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fl-fund-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.fl-row.is-selected .fl-fund-dot {
  border-color: color-mix(in oklab, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 18%, transparent);
}
.fl-fund-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-fund-meta {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Data cells */
.fl-val { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.fl-pos { color: var(--pos) !important; }
.fl-neg { color: var(--neg) !important; }

/* SRRI badge */
.fl-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
}

/* Loading skeleton row */
.fl-skel td { padding: 14px 12px; }
.fl-skel td:first-child { padding-left: 20px; }
.fl-skel-line {
  height: 12px; border-radius: 4px; background: var(--surface-2);
  animation: fl-pulse 1.4s ease-in-out infinite;
}
@keyframes fl-pulse { 0%,100%{opacity:.5} 50%{opacity:1} }

/* Inline name search — right of the nav bar */
.fl-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.fl-search-icon {
  position: absolute;
  left: 10px;
  width: 14px; height: 14px;
  stroke: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.fl-search-input {
  height: 32px;
  padding: 0 10px 0 30px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  width: 200px;
  outline: none;
  transition: border-color var(--dur) var(--ease), width var(--dur) var(--ease);
  /* reset browser search-input chrome */
  -webkit-appearance: none;
  appearance: none;
}
.fl-search-input::placeholder { color: var(--text-muted); }
.fl-search-input:focus {
  border-color: var(--accent);
  width: 260px;
  background: var(--surface);
}
/* hide browser clear ×  */
.fl-search-input::-webkit-search-cancel-button { display: none; }

/* Select button — pill style, right-aligned */
.fl-sel-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 4px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.fl-sel-btn:hover {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 32%, transparent);
  color: var(--accent);
}
.fl-row.is-selected .fl-sel-btn {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  border-color: color-mix(in oklab, var(--accent) 40%, transparent);
  color: var(--accent); font-weight: 700;
}

/* ════════════════════════════════════════════════════════════════════════════
   COMPARE VIEW
════════════════════════════════════════════════════════════════════════════ */
#fcView-compare { z-index: 100; }

/* Fund pills strip */
.fc-fund-strip {
  display: flex; gap: 7px; align-items: center; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none; padding: 2px 0;
}
.fc-fund-strip::-webkit-scrollbar { display: none; }

.fc-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 9px 4px 7px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-pill); white-space: nowrap; flex-shrink: 0;
}
.fc-pill-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fc-pill-name {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.fc-pill-x {
  width: 14px; height: 14px; display: flex; align-items: center;
  justify-content: center; background: var(--surface-2);
  border: none; border-radius: 50%; color: var(--text-dim);
  cursor: pointer; font-size: 10px; line-height: 1;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.fc-pill-x:hover { background: var(--neg); color: #fff; }

/* AI / refine buttons in compare nav */
.fc-btn-ai {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--r-pill);
  background: color-mix(in oklab, #a78bfa 10%, var(--surface));
  border: 1px solid color-mix(in oklab, #a78bfa 20%, transparent);
  color: #c4b5fd; font-family: var(--font-body); font-size: 12px;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease);
}
.fc-btn-ai:hover { background: color-mix(in oklab, #a78bfa 18%, var(--surface)); }
.fc-btn-ai svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }

.fc-refine-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-family: var(--font-body); font-size: 12px; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.fc-refine-btn:hover { background: var(--surface-2); color: var(--text); }
.fc-refine-btn svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ── 2026-06-02 — Export / Share / Email action group ──────────────────── */
.fc-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.fc-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-family: var(--font-body); font-size: 12px;
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.fc-action-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.fc-action-btn:hover {
  background: var(--surface-2); color: var(--text);
  border-color: var(--text-muted);
}
.fc-action-btn:active { transform: translateY(1px); }
/* Export is the primary action — give it the gold accent. */
#fcExportBtn {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 600;
}
#fcExportBtn:hover {
  background: color-mix(in srgb, var(--accent) 88%, #fff);
  color: var(--accent-ink);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 32%, transparent);
}

/* Compare scrollable body — fills full height below the subnav.
   NOTE: #fcView-compare overrides to static positioning below so the PAGE
   scrolls rather than this inner container (more reliable cross-browser). */
.fc-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent;
}
.fc-body::-webkit-scrollbar { width: 4px; }
.fc-body::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 2px; }

/* ── Compare view: page-level scroll ─────────────────────────────────────────
   Wizard + list stay as position:fixed inner-scroll layers (their content
   fits the viewport). The compare view has unbounded content (chart + stats
   table + AI card), so we let the normal page scroll handle it.
   The subnav becomes position:sticky so it locks just below the app header.
   Hidden layers (#fcView-wizard, #fcView-list) remain fixed and invisible
   (opacity:0, pointer-events:none) so they don't interfere.
────────────────────────────────────────────────────────────────────────────── */
#fcView-compare {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  /* Push content below the fixed app header */
  padding-top: var(--fc-header-h);
  min-height: calc(100vh - var(--fc-header-h));
}
/* Subnav sticks just below the app header while the page scrolls */
#fcView-compare .fc-subnav {
  position: sticky;
  top: var(--fc-header-h);
  z-index: 200;
}
/* Body no longer needs overflow — the page itself scrolls */
#fcView-compare .fc-body {
  overflow-y: visible;
  overflow-x: visible;
  flex: none;
  min-height: 0;
  height: auto;
}
/* Admin-bar offsets */
body.admin-bar #fcView-compare            { padding-top: var(--fc-header-h); }
body.admin-bar #fcView-compare .fc-subnav { top: var(--fc-header-h); }

/* Content area — 2026-06-02 redesign: inset column with proper floating
   cards (design-contract §2.5/§2.7), replacing the old full-bleed flush
   sections. Comparison max width is 1320 here — the data reads better in a
   contained column than stretched edge-to-edge at 1920; the chart still has
   ample width. Gutter padding gives every card breathing room. */
.fc-content {
  width: 100%; max-width: 1320px; margin: 0 auto;
  padding: var(--sp-6) var(--gutter) 96px;
}

/* ── Performance chart — proper bordered/rounded card ── */
.fc-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--sp-5);
  overflow: hidden;
}
.fc-chart-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  padding: 14px var(--sp-5); border-bottom: 1px solid var(--border-soft);
}
.fc-chart-title {
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  letter-spacing: var(--tracking-display); color: var(--text);
}
.fc-period-btns { display: flex; gap: 4px; }
.fc-period-btn {
  padding: 4px 10px; border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border-soft); cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.fc-period-btn:hover { color: var(--text-2); border-color: var(--border); }
.fc-period-btn.is-active {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
/* Taller chart — more data visible without scrolling */
.fc-chart-body { padding: var(--sp-4) var(--sp-5) 18px; height: 340px; }
.fc-chart-legend {
  display: flex; flex-wrap: wrap; gap: 14px; padding: 11px var(--sp-5);
  border-top: 1px solid var(--border-soft);
}
.fc-legend-item { display: flex; align-items: center; gap: 7px; }
.fc-legend-line { width: 18px; height: 2px; border-radius: 2px; flex-shrink: 0; }
.fc-legend-name { font-size: 12px; color: var(--text-2); }
.fc-legend-val { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-2); }

/* 2026-06-02 redesign — legend container (markup uses .fc-legend; the
   original rule was named .fc-chart-legend). Alias so both work. */
.fc-legend {
  display: flex; flex-wrap: wrap; gap: 14px; padding: 11px var(--sp-5);
  border-top: 1px solid var(--border-soft);
}
.fc-legend:empty { display: none; }

/* ════════════════════════════════════════════════════════════════════════════
   2026-06-02 redesign — FUND IDENTITY CARDS
   Row of cards above the chart: manager eyebrow, name, headline 1Y return,
   key meta, remove ×, + an "Add fund" tile. Replaces the old subnav pills.
════════════════════════════════════════════════════════════════════════════ */
.fc-funds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.fc-fund-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  min-width: 0;
}
/* Top accent bar in the fund's chart colour — ties card ↔ line ↔ stats col. */
.fc-fund-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--fund-color, var(--accent));
}
.fc-fund-card-x {
  position: absolute; top: 10px; right: 10px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 50%;
  color: var(--text-dim); cursor: pointer; padding: 0;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.fc-fund-card-x:hover { background: var(--neg); color: #fff; border-color: transparent; }
.fc-fund-card-eyebrow {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 6px; padding-right: 26px; /* clear the × */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fc-fund-card-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--fund-color, var(--accent));
}
.fc-fund-card-name {
  font-family: var(--font-body); font-size: 14px; font-weight: 600; line-height: 1.3;
  color: var(--text); margin-bottom: var(--sp-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.6em;
}
.fc-fund-card-hero {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  letter-spacing: -.02em; line-height: 1; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.fc-fund-card-hero.fc-val-pos { color: var(--pos); }
.fc-fund-card-hero.fc-val-neg { color: var(--neg); }
.fc-fund-card-herolbl {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted);
  margin-top: 3px;
}
.fc-fund-card-meta {
  display: flex; flex-wrap: wrap; gap: 4px var(--sp-3);
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.fc-fund-card-meta .fc-meta-k {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .04em; color: var(--text-dim); margin-right: 2px;
}
/* "Add fund" tile */
.fc-fund-card--add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); min-height: 100%;
  background: transparent; border: 1px dashed var(--border);
  color: var(--text-muted); cursor: pointer; font-family: var(--font-body);
  font-size: 12px; font-weight: 500;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.fc-fund-card--add::before { display: none; }
.fc-fund-card--add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ════════════════════════════════════════════════════════════════════════════
   2026-06-02 redesign — AI COMPARISON SUMMARY CARD (Claude)
════════════════════════════════════════════════════════════════════════════ */
.fc-ai-card {
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, #a78bfa 8%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid color-mix(in srgb, #a78bfa 22%, var(--border));
  border-radius: var(--r-card);
  margin-bottom: var(--sp-5);
  overflow: hidden;
}
.fc-ai-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 14px var(--sp-5); border-bottom: 1px solid var(--border-soft);
}
.fc-ai-head-l { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.fc-ai-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .08em; color: #c4b5fd;
}
.fc-ai-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #a78bfa; flex-shrink: 0; }
.fc-ai-claude {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted);
}
.fc-ai-claude strong { color: var(--text-2); font-weight: 600; }
.fc-ai-claude svg { color: #a78bfa; }
.fc-ai-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-pill);
  background: color-mix(in srgb, #a78bfa 14%, var(--surface));
  border: 1px solid color-mix(in srgb, #a78bfa 30%, transparent);
  color: #c4b5fd; font-family: var(--font-body); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.fc-ai-btn:hover { background: color-mix(in srgb, #a78bfa 22%, var(--surface)); }
.fc-ai-btn:active { transform: translateY(1px); }
.fc-ai-btn:disabled { opacity: .6; cursor: default; }
.fc-ai-btn.is-loading { opacity: .7; cursor: wait; }
.fc-ai-body { padding: var(--sp-4) var(--sp-5); }
.fc-ai-placeholder { font-size: 13px; line-height: 1.55; color: var(--text-muted); margin: 0; }
.fc-ai-placeholder strong { color: var(--text-2); }
.fc-ai-loading { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.fc-ai-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, #a78bfa 30%, transparent);
  border-top-color: #a78bfa; flex-shrink: 0;
  animation: fc-ai-spin 0.8s linear infinite;
}
@keyframes fc-ai-spin { to { transform: rotate(360deg); } }
.fc-ai-error { font-size: 13px; color: var(--neg); margin: 0; }
.fc-ai-verdict {
  font-family: var(--font-body); font-size: 15px; line-height: 1.5; font-weight: 500;
  color: var(--text); margin: 0 0 var(--sp-3);
}
.fc-ai-points { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-2); }
.fc-ai-points li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.fc-ai-point-k {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: #c4b5fd;
  min-width: 84px; flex-shrink: 0;
}
.fc-ai-point-d { font-size: 13px; line-height: 1.5; color: var(--text-2); flex: 1; min-width: 0; }
.fc-ai-disclaimer { font-size: 10.5px; color: var(--text-dim); margin: 0; font-style: italic; }

/* ── Stats table — 2026-06-02 redesign: bordered/rounded card to match ── */
.fc-stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--sp-5);
  overflow: hidden;
}
.fc-stats-table { width: 100%; border-collapse: collapse; }
.fc-stats-table th,
.fc-stats-table td {
  padding: 10px var(--sp-5); text-align: left; border-bottom: 1px solid var(--border-soft);
}
.fc-stats-table tbody tr:last-child td { border-bottom: none; }
.fc-stats-table th {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  background: var(--surface-2);
}
.fc-stats-table td:first-child {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted);
  width: 180px; white-space: nowrap;
}
.fc-stats-table td {
  font-family: var(--font-body); font-size: 13px; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* 2026-06-02 — Column sizing so 2 funds don't sprawl across 1920px.
   Fund columns get a tidy fixed width; the trailing filler column eats
   ALL the remaining width, keeping metric + fund columns left-grouped
   and readable for any fund count (2–5). */
.fc-stats-th-metric { width: 180px; }
.fc-stats-th-fund,
.fc-stats-val {
  width: 280px;
  min-width: 200px;
}
.fc-stats-filler {
  width: 100%;                 /* in table-layout:auto this absorbs ALL leftover width */
  padding: 0 !important;
  border-bottom-color: transparent !important;
  background: transparent !important;
}
.fc-stats-table thead .fc-stats-filler { background: var(--surface-2) !important; }
.fc-section-sep td {
  padding: 7px var(--sp-5) 4px !important;
  background: var(--surface-2);
  font-family: var(--font-mono) !important; font-size: 9px !important;
  letter-spacing: .08em !important; text-transform: uppercase !important;
  color: var(--text-dim) !important;
  border-top: 1px solid var(--border-soft);
}

/* Value states */
.fc-val-pos  { color: var(--pos) !important; font-weight: 600; }
.fc-val-neg  { color: var(--neg) !important; font-weight: 600; }
.fc-val-best { color: var(--accent) !important; font-weight: 700; }

.fc-col-head { display: flex; align-items: center; gap: 7px; }
.fc-col-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.fc-col-name {
  font-family: var(--font-body); font-size: 11px; font-weight: 600; color: var(--text);
  max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ════════════════════════════════════════════════════════════════════════════
   STICKY SELECTION / COMPARE BAR
════════════════════════════════════════════════════════════════════════════ */
#fc-sel-bar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 500; pointer-events: auto;
  transition: bottom var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease);
}
/* JS toggles is-hidden (count===0). Non-layer elements with is-hidden get display:none
   but for the bar we prefer the slide-down animation, so override below. */
#fc-sel-bar.is-hidden {
  bottom: -90px; opacity: 0; pointer-events: none;
}

.fc-sel-inner {
  display: flex; align-items: center; gap: 14px; padding: 11px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-elevated), 0 1px 0 rgba(255,255,255,.04) inset;
  white-space: nowrap;
}
.fc-sel-count {
  font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--accent);
}
.fc-sel-lbl {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--text-muted);
}
.fc-sel-actions { display: flex; gap: 8px; }

/* ════════════════════════════════════════════════════════════════════════════
   UTILITY — is-hidden on non-layer elements (wizard buttons, clear btn, etc.)
   The .fc-layer.is-hidden rule uses opacity/transform (animated).
   Everything else just needs display:none.
════════════════════════════════════════════════════════════════════════════ */
.is-hidden:not(.fc-layer):not(#fc-sel-bar) { display: none !important; }

/* ════════════════════════════════════════════════════════════════════════════
   FUND TABLE CELLS — classes injected by fb-compare.js renderFundRow()
════════════════════════════════════════════════════════════════════════════ */
.fl-name { max-width: 300px; }
.fl-name-primary {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fl-name-meta {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 2px;
}
.fl-ac, .fl-ter, .fl-aum {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2);
  white-space: nowrap;
}
.fl-ret {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.fl-srri { text-align: center; }
.fl-action { text-align: center; }

/* ── N/A placeholder ── */
.fc-val-na { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; }

/* ── SRRI badge (injected by renderFundRow) ── */
.fc-srri-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
}
.fc-srri-1 { background: color-mix(in oklab,#4ade80 14%,var(--surface)); color:#4ade80; }
.fc-srri-2 { background: color-mix(in oklab,#86efac 12%,var(--surface)); color:#86efac; }
.fc-srri-3 { background: color-mix(in oklab,#fde047 12%,var(--surface)); color:#ca8a04; }
.fc-srri-4 { background: color-mix(in oklab,#fb923c 12%,var(--surface)); color:#fb923c; }
.fc-srri-5 { background: color-mix(in oklab,#f97316 14%,var(--surface)); color:#f97316; }
.fc-srri-6 { background: color-mix(in oklab,#ef4444 12%,var(--surface)); color:#ef4444; }
.fc-srri-7 { background: color-mix(in oklab,#dc2626 16%,var(--surface)); color:#fca5a5; }

/* ── Select button inside fund rows ── */
.fc-sel-btn { cursor: pointer; }
.fl-row.is-selected .fc-sel-btn.btn-primary {
  background: color-mix(in oklab, var(--accent) 14%, var(--surface));
  border-color: color-mix(in oklab, var(--accent) 40%, transparent);
  color: var(--accent);
}

/* ── Active filter tags (injected by buildFilterTagsHtml) ── */
.fc-filter-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .04em; color: var(--accent); white-space: nowrap;
}

/* ── Fund pill × button (injected by buildFundStrip) ── */
/* JS uses class fc-pill-remove; CSS named it fc-pill-x — support both */
.fc-pill-remove,
.fc-pill-x {
  width: 14px; height: 14px; display: flex; align-items: center;
  justify-content: center; background: var(--surface-2);
  border: none; border-radius: 50%; color: var(--text-dim);
  cursor: pointer; font-size: 10px; line-height: 1;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.fc-pill-remove:hover,
.fc-pill-x:hover { background: var(--neg); color: #fff; }

/* ── Stats table rows (injected by buildStatsTable) ── */
.fc-stats-sec td,
.fc-section-sep td {          /* support both names */
  padding: 7px 20px 4px !important;
  background: var(--surface-2) !important;
  font-family: var(--font-mono) !important; font-size: 9px !important;
  letter-spacing: .08em !important; text-transform: uppercase !important;
  color: var(--text-dim) !important;
  border-top: 1px solid var(--border-soft);
}
.fc-stats-row td { border-bottom: 1px solid var(--border-soft); }
.fc-stats-label {
  font-family: var(--font-mono) !important; font-size: 10px !important;
  font-weight: 600 !important; letter-spacing: .04em !important;
  text-transform: uppercase !important; color: var(--text-muted) !important;
  width: 150px; white-space: nowrap;
}
.fc-th-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0; margin-right: 5px; vertical-align: middle;
}

/* ── Chart states ── */
.fc-chart-skel {
  height: 100%; width: 100%; min-height: 220px; border-radius: var(--r-md);
  background: var(--surface-2);
  animation: fl-pulse 1.4s ease-in-out infinite;
}
.fc-chart-empty,
.fc-error-msg {
  display: flex; align-items: center; justify-content: center;
  height: 220px; font-size: 13px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.fc-loading-text { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); }

/* 2026-06-02 — Non-blocking notice when some (not all) selected funds
   failed to load. Sits under the fund-pill strip; amber, not red, since
   the working funds still render fine. */
.fc-partial-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--accent-ink, #1a1a1a);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
}
[data-theme="light"] .fc-partial-note { color: var(--text); }

/* ── Empty / error states in fund list ── */
.fc-fl-empty,
.fc-fl-error {
  text-align: center; padding: 48px 24px;
  font-size: 14px; color: var(--text-muted);
  font-family: var(--font-body);
}
.fc-fl-error { color: var(--neg); }

/* ── Toast notification ── */
.fc-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(10px);
  z-index: 9999;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 10px 18px;
  font-size: 13px; color: var(--text);
  box-shadow: var(--shadow-elevated);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.fc-toast.is-visible {
  opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto;
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════════════════ */
/* 2026-06-02 — Mid breakpoint: collapse action-button labels to icon-only
   so the subnav (back + pills + Export/Share/Email + Filter Funds) stops
   overflowing on tablet widths. The tooltips (title attr) still convey the
   action. Export keeps its label a little longer since it's the primary CTA. */
@media (max-width: 1024px) {
  .fc-action-btn span,
  .fc-refine-btn span { display: none; }
  .fc-action-btn,
  .fc-refine-btn { padding: 7px 9px; }
  .fc-actions { gap: var(--sp-1); }
}
@media (min-width: 1025px) {
  /* Make sure labels show again above the breakpoint (defensive against
     any inherited display:none). */
  .fc-action-btn span,
  .fc-refine-btn span { display: inline; }
}

@media (max-width: 768px) {
  .fw-body-inner { padding: var(--sp-5) var(--gutter-mobile); }
  .fw-step-title { font-size: 22px; }
  .fw-country-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .fw-srri-row { flex-wrap: wrap; }
  .fw-srri-btn { min-width: 44%; }
  /* On mobile: hide middle columns so FUND + SELECT always fit */
  .fl-table thead th:nth-child(n+3):nth-child(-n+6) { display: none; }
  .fl-row td:nth-child(n+3):nth-child(-n+6) { display: none; }
  .fl-nav  { padding: 0 12px; }
  .fl-table thead th:first-child { padding-left: 12px; }
  .fl-table thead th:last-child  { padding-right: 12px; }
  .fl-row td:first-child { padding-left: 12px; }
  .fl-row td:last-child  { padding-right: 12px; }
  .fc-subnav { padding: 0 12px; gap: var(--sp-2); }
  /* 2026-06-02 redesign — inset content column with a tight mobile gutter
     so the now-bordered cards don't touch the screen edges. */
  .fc-content { padding: var(--sp-4) var(--sp-4) 64px; }
  .fc-chart-head { padding: 12px 16px; }
  .fc-chart-body { padding: var(--sp-3) 16px 14px; height: 240px; }
  .fc-chart-legend, .fc-legend { padding: 10px 16px; }
  /* 2026-06-02 — Was a brittle max-width: calc(100vw - 180px) that didn't
     account for the new action group. flex:1 + min-width:0 lets the strip
     take whatever space remains after the back btn + actions, and scroll
     its pills horizontally inside that. */
  .fc-fund-strip { max-width: none; }
  .fc-pill-name { max-width: 92px; }   /* shorter ellipsis on mobile */
  .fc-stats-table th,
  .fc-stats-table td { padding: 8px 16px; }
  /* First column (metric label) narrower on mobile so 2 fund columns fit */
  .fc-stats-table td:first-child,
  .fc-stats-th-metric { width: 96px; font-size: 9px; }
  /* Drop the desktop filler + fixed fund widths on mobile so the two
     fund columns expand to fill the available width instead of being
     pinned narrow with a big empty gutter. */
  .fc-stats-filler { display: none; }
  .fc-stats-th-fund,
  .fc-stats-val { width: auto; min-width: 0; }
  /* Redesign elements — tighter gutters; cards inset via .fc-content padding */
  .fc-funds { gap: var(--sp-2); }
  .fc-ai-head { padding: 12px 16px; }
  .fc-ai-body { padding: var(--sp-3) 16px; }
  .fc-fund-card-hero { font-size: 22px; }
}

@media (max-width: 420px) {
  .fc-funds { grid-template-columns: 1fr 1fr; }   /* 2-up on phones */
  .fc-period-btns { gap: 2px; }
  .fc-period-btn { padding: 4px 7px; }
}

/* Very narrow: the back button collapses to its arrow only, and we let the
   stats table scroll horizontally rather than crush the columns. */
@media (max-width: 520px) {
  .fc-subnav-back { padding: 5px 8px; font-size: 0; gap: 0; }
  .fc-subnav-back svg { width: 14px; height: 14px; }
  .fc-stats-card { overflow-x: auto; }
  .fc-stats-table { min-width: 440px; }   /* horizontal scroll instead of crush */
}

/* ════════════════════════════════════════════════════════════════════════════
   PRINT — PDF export (window.print from the Export button).
   Body gets .fc-printing while the dialog is open. We strip the app chrome
   and the interactive UI, then print just the compare view's chart + table.
════════════════════════════════════════════════════════════════════════════ */
@media print {
  /* Hide everything that isn't the comparison itself */
  .fb-app-header, .fb-app-footer, #wpadminbar,
  .fc-subnav, #fc-sel-bar, .fc-actions, .fc-refine-btn,
  .fc-pill-remove, .fc-pill-x, .fc-fund-card-x, .fc-fund-card--add,
  .fc-period-btns, .fc-ai-btn,
  #fcView-wizard, #fcView-list { display: none !important; }

  /* Un-fix the compare layer so it flows in the print document */
  .fc-layer {
    position: static !important;
    height: auto !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .fc-body { overflow: visible !important; height: auto !important; }
  .fc-content { max-width: 100% !important; padding: 0 !important; }

  /* Force light-on-white for ink economy + legibility, regardless of theme */
  html, body, .fc-content,
  .fc-chart-card, .fc-stats-card, .fc-ai-card, .fc-fund-card {
    background: #fff !important; color: #111 !important;
    box-shadow: none !important; border-color: #ddd !important;
  }
  .fc-stats-table td, .fc-stats-table th,
  .fc-chart-title, .fc-fund-card-name, .fc-fund-card-hero,
  .fc-ai-verdict, .fc-ai-point-d { color: #111 !important; }
  .fc-stats-table th { background: #f2f2f2 !important; }
  .fc-ai-placeholder { display: none !important; }   /* don't print the empty CTA */

  /* Avoid awkward page breaks mid-section */
  .fc-funds, .fc-chart-card, .fc-stats-card, .fc-ai-card { break-inside: avoid; page-break-inside: avoid; }

  /* Add a print-only header so the PDF identifies itself */
  .fc-content::before {
    content: "FundBenchmark — Fund Comparison";
    display: block;
    font-family: var(--font-display, sans-serif);
    font-size: 18px; font-weight: 700; color: #111;
    padding: 0 0 12px;
  }
}
