/* Fursa UI v2 — home hero and the shared search partials (slice 3.1a).
   Loaded last; every selector is scoped to html[data-ui="v2"]. The partials
   (_search_filters, _saved_searches, _competitor_scope, _competitor_suggest)
   also render inside the v1 /search and /competitors pages under the v2
   shell until slice 3.1c, so every fx- class is self-contained: nothing here
   depends on .fx-page--home. */

/* ---------------------------------------------------------------------------
   1. Hero — one calm search stage centred in the content column
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-hero{
  display:grid; gap:var(--fx-space-4); justify-items:center;
  max-inline-size:880px; margin-inline:auto;
  padding-block:var(--fx-space-10) var(--fx-space-8);
  text-align:center;
}
html[data-ui="v2"] .fx-hero__panel{
  display:grid; gap:var(--fx-space-3); justify-items:center; inline-size:100%;
}
/* display:grid would beat the UA [hidden] rule, so reassert it. */
html[data-ui="v2"] .fx-hero__panel[hidden]{display:none}
html[data-ui="v2"] .fx-hero__title{margin:0}
html[data-ui="v2"] .fx-hero__lede{margin-inline:auto; max-inline-size:56ch}
html[data-ui="v2"] .fx-hero__form{
  inline-size:100%; display:grid; gap:var(--fx-space-3);
  margin-block-start:var(--fx-space-2); text-align:start;
}
html[data-ui="v2"] .fx-hero__help{
  margin:0; color:var(--fx-text-muted); font-size:var(--fx-text-xs);
}

/* ---------------------------------------------------------------------------
   2. Mode toggle — segmented control; the raised segment follows aria-selected
      (smooth-nav.js flips it and data-home-mode together, so both drivers stay
      in step; app.css's own thumb rule agrees on the same position).
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-mode{
  position:relative; display:inline-grid; grid-template-columns:1fr 1fr;
  padding:4px; gap:0; margin:0;
  border-radius:var(--fx-radius-pill);
  background:var(--fx-surface-sunken); border:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-mode::before{
  content:""; position:absolute; inset-block:4px; inset-inline-start:4px;
  inline-size:calc(50% - 4px); border-radius:var(--fx-radius-pill);
  background:var(--fx-surface-raised); box-shadow:var(--fx-shadow-sm);
}
html[data-ui="v2"] .fx-mode:has(#mode-competitors[aria-selected="true"])::before{
  transform:translateX(100%);
}
html[data-ui="v2"][dir="rtl"] .fx-mode:has(#mode-competitors[aria-selected="true"])::before{
  transform:translateX(-100%);
}
html[data-ui="v2"] .fx-mode button{
  position:relative; z-index:1; border:0; background:none; cursor:pointer;
  padding-block:8px; padding-inline:22px; border-radius:var(--fx-radius-pill);
  font:inherit; font-size:var(--fx-text-sm); font-weight:var(--fx-weight-medium);
  color:var(--fx-text-muted); white-space:nowrap;
  transition:color var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-mode button[aria-selected="true"]{
  color:var(--fx-text); font-weight:var(--fx-weight-semibold);
}
html[data-ui="v2"] .fx-mode button:focus-visible{outline:none; box-shadow:var(--fx-ring)}

/* ---------------------------------------------------------------------------
   3. Search bar — one bordered field: icon at inline-start, input, primary
      button inside at inline-end. Focus ring lands on the bar itself.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-searchbar{
  display:flex; align-items:center; gap:var(--fx-space-2);
  block-size:56px;
  padding-inline-start:var(--fx-space-4); padding-inline-end:6px;
  border:1px solid var(--fx-border-strong); border-radius:var(--fx-radius-lg);
  background:var(--fx-surface); box-shadow:var(--fx-shadow-sm);
  transition:border-color var(--fx-dur-fast) var(--fx-ease-out),
    box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-searchbar:focus-within{
  border-color:var(--fx-primary); box-shadow:var(--fx-ring);
}
html[data-ui="v2"] .fx-searchbar__icon{flex:none; color:var(--fx-text-subtle)}
/* .fx-searchbar qualifies the input so it beats app.css's v2 field chrome
   (html[data-ui="v2"] :is(input[type=search],…)) — inside the bar the input is
   chromeless: only the bar draws the border and the :focus-within ring. */
html[data-ui="v2"] .fx-searchbar .fx-searchbar__input{
  flex:1; min-inline-size:0; inline-size:100%; max-inline-size:none; max-width:none;
  block-size:100%; min-block-size:0;
  border:0; border-radius:0; background:transparent; box-shadow:none; padding:0;
  font:inherit; font-size:var(--fx-text-base); color:var(--fx-text);
}
html[data-ui="v2"] .fx-searchbar .fx-searchbar__input::placeholder{
  color:var(--fx-text-subtle); opacity:1;
}
html[data-ui="v2"] .fx-searchbar .fx-searchbar__input:focus,
html[data-ui="v2"] .fx-searchbar .fx-searchbar__input:focus-visible{
  outline:none; box-shadow:none; background:transparent; border-color:transparent;
}
html[data-ui="v2"] .fx-searchbar .fx-searchbar__input::-webkit-search-cancel-button{
  opacity:.45;
}
html[data-ui="v2"] .fx-searchbar__go{flex:none; block-size:44px}
@media (max-width:640px){
  html[data-ui="v2"] .fx-searchbar{block-size:48px}
  html[data-ui="v2"] .fx-searchbar__go{block-size:38px}
}
/* Phones: stack — icon + input on the first row, the submit full width below,
   still inside the same bordered bar. */
@media (max-width:480px){
  html[data-ui="v2"] .fx-searchbar{
    display:grid; grid-template-columns:auto 1fr; align-items:center;
    block-size:auto; padding:6px; padding-inline-start:var(--fx-space-3);
  }
  html[data-ui="v2"] .fx-searchbar .fx-searchbar__input{
    grid-column:auto; block-size:40px;
  }
  html[data-ui="v2"] .fx-searchbar__go{
    grid-column:1 / -1; inline-size:100%; block-size:42px;
  }
}

/* ---------------------------------------------------------------------------
   4. Filters (_search_filters.html) — scope as a segmented control with a
      sliding thumb driven by :has(input:checked); the range input is visually
      hidden but stays focusable (arrows still move the choice) and its ring
      lands on the whole control. Dates + presets share a wrapping row; the
      «فلاتر إضافية» disclosure opens a 3/2/1-column grid.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-filters{
  display:grid; gap:var(--fx-space-3);
  margin-block-start:var(--fx-space-2); text-align:start;
}

/* Home and /search share the filters card: one card matching the search
   bar's width and edges (slice 3.1c extended this from home-only). */
html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters{
  inline-size:100%;
  margin-block-start:var(--fx-space-1);   /* + the form's 12px gap ≈ 16px under the bar */
  gap:var(--fx-space-4);                  /* one 16px rhythm between rows */
  padding:var(--fx-space-6);
  background:var(--fx-surface); border:1px solid var(--fx-border);
  border-radius:var(--fx-radius-lg); box-shadow:var(--fx-shadow-xs);
}
/* Everything inside starts at the card's start edge: the scope control sizes
   to its content, the date fields get a fixed comfortable width and the preset
   chips follow them in the same row with their bottoms on the inputs'. */
html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__row{align-items:end}
html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__dates{
  flex:none; max-inline-size:none;
  grid-template-columns:repeat(2,minmax(0,200px));
}
/* «فلاتر إضافية» is the card's footer row: no card of its own, just the
   hairline divider and the shared padding. */
html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__more{
  margin:0; padding:0;
  border:0; border-block-start:1px solid var(--fx-border);
  border-radius:0; background:none;
}
html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__more > summary{
  padding-inline:0; padding-block:10px;
}
html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__more .fx-disclosure__body{
  padding:0; margin-block-start:var(--fx-space-3);
}

html[data-ui="v2"] .fx-filters__scope{
  border:0; padding:0; margin:0; min-inline-size:0;
}
html[data-ui="v2"] .fx-filters__legend{
  padding:0; margin-block-end:8px;
  font-size:var(--fx-text-xs); font-weight:var(--fx-weight-semibold);
  color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-scope{position:relative; display:inline-block}
html[data-ui="v2"] .fx-scope .scope-slider-range{
  position:absolute; inline-size:1px; block-size:1px; width:1px; height:1px;
  margin:-1px; padding:0; border:0; overflow:hidden;
  clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap;
  appearance:none; -webkit-appearance:none; background:transparent;
}
html[data-ui="v2"] .fx-scope:has(.scope-slider-range:focus-visible) .fx-scope__track{
  border-color:var(--fx-primary); box-shadow:var(--fx-ring);
}
html[data-ui="v2"] .fx-scope__track{
  position:relative; display:inline-grid;
  grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:4px;
  border-radius:var(--fx-radius-pill);
  background:var(--fx-surface-sunken); border:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-scope__track::before{
  content:""; position:absolute; inset-block:4px; inset-inline-start:4px;
  inline-size:calc((100% - 16px) / 3);
  border-radius:var(--fx-radius-pill);
  background:var(--fx-surface-raised); box-shadow:var(--fx-shadow-sm);
}
html[data-ui="v2"] .fx-scope__track:has(input[value="closed"]:checked)::before{
  transform:translateX(calc(100% + 4px));
}
html[data-ui="v2"] .fx-scope__track:has(input[value="both"]:checked)::before{
  transform:translateX(calc(200% + 8px));
}
html[data-ui="v2"][dir="rtl"] .fx-scope__track:has(input[value="closed"]:checked)::before{
  transform:translateX(calc(-100% - 4px));
}
html[data-ui="v2"][dir="rtl"] .fx-scope__track:has(input[value="both"]:checked)::before{
  transform:translateX(calc(-200% - 8px));
}
html[data-ui="v2"] .fx-scope__track label{
  position:relative; z-index:1; text-align:center; cursor:pointer;
  padding-block:6px; padding-inline:12px; border-radius:var(--fx-radius-pill);
  font-size:var(--fx-text-sm); font-weight:var(--fx-weight-medium);
  color:var(--fx-text-muted);
  transition:color var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-scope__track label:has(input:checked){
  background:transparent; box-shadow:none;
  color:var(--fx-text); font-weight:var(--fx-weight-semibold);
}

html[data-ui="v2"] .fx-filters__row{
  display:flex; flex-wrap:wrap; gap:12px 16px; align-items:center;
}
html[data-ui="v2"] .fx-filters__dates{
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px;
  flex:1 1 320px; max-inline-size:560px;
  align-items:start;
}
/* components.css stacks sibling .fx-field blocks; inside this two-column grid
   that would sink «إلى» below «من» — both columns keep identical label/field tops. */
html[data-ui="v2"] .fx-filters__dates .fx-field{
  max-inline-size:none; margin-block-start:0;
}
html[data-ui="v2"] .fx-filters__dates .fx-field + .fx-field{margin-block-start:0}
html[data-ui="v2"] .fx-filters__presets{
  display:flex; flex-wrap:wrap; gap:8px; margin:0;
}
html[data-ui="v2"] .fx-filters__preset{
  border:1px solid var(--fx-border); border-radius:var(--fx-radius-pill);
  background:var(--fx-surface); color:var(--fx-text-muted);
  font:inherit; font-size:var(--fx-text-xs); font-weight:var(--fx-weight-medium);
  padding-block:7px; padding-inline:13px; cursor:pointer;
  transition:background-color var(--fx-dur-fast) var(--fx-ease-out),
    border-color var(--fx-dur-fast) var(--fx-ease-out),
    color var(--fx-dur-fast) var(--fx-ease-out),
    transform var(--fx-dur-instant) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-filters__preset:hover{
  border-color:var(--fx-primary); color:var(--fx-primary);
  background:var(--fx-primary-soft);
}
html[data-ui="v2"] .fx-filters__preset:focus-visible{
  outline:none; box-shadow:var(--fx-ring);
}
html[data-ui="v2"] .fx-filters__preset:active{transform:scale(var(--fx-press-scale))}
html[data-ui="v2"] .fx-filters__date-help{
  margin:0; color:var(--fx-text-subtle); font-size:var(--fx-text-xs);
}

html[data-ui="v2"] .fx-filters__more{margin-block-start:2px}
html[data-ui="v2"] .fx-filters__more > summary{
  color:var(--fx-text-muted); font-weight:var(--fx-weight-medium);
}
html[data-ui="v2"] .fx-filters__more > summary:hover{color:var(--fx-text)}
html[data-ui="v2"] .fx-filters__grid{
  display:grid; gap:14px 16px; align-items:start;
  grid-template-columns:repeat(3,minmax(0,1fr));
}
@media (max-width:1024px){
  html[data-ui="v2"] .fx-filters__grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:768px){
  html[data-ui="v2"] .fx-filters__grid{grid-template-columns:1fr}
}
html[data-ui="v2"] .fx-filters__grid .fx-field{max-inline-size:none}
/* The min/max pairs (contract months, offer count) share one row inside
   their grid cell. */
html[data-ui="v2"] .fx-filters .range-pair{display:flex; gap:8px}
html[data-ui="v2"] .fx-filters .range-pair .fx-input{flex:1; min-inline-size:0}
html[data-ui="v2"] .fx-filters__match{
  border:0; padding:0; margin:0; min-inline-size:0;
  display:flex; flex-wrap:wrap; gap:8px 16px; align-content:start;
}
html[data-ui="v2"] .fx-filters__match legend{
  padding:0; margin-block-end:8px;
  font-size:var(--fx-text-sm); font-weight:var(--fx-weight-semibold);
  color:var(--fx-text);
}
html[data-ui="v2"] .fx-filters__match-opt{
  display:inline-flex; align-items:center; gap:7px;
  font-size:var(--fx-text-sm); color:var(--fx-text); cursor:pointer;
}
html[data-ui="v2"] .fx-filters__more-help{grid-column:1/-1; margin:0}

/* ---------------------------------------------------------------------------
   5. Saved searches (_saved_searches.html) — a quiet chip row under the form:
      name link, accent «n جديدة» badge, bell and × icon buttons in the pill.
--------------------------------------------------------------------------- */

/* Stretch inside the centred hero grid so the heading, chips and help line
   share the filters' inline-start edge (no-op inside /search's block layout). */
html[data-ui="v2"] .fx-saved{
  justify-self:stretch; inline-size:100%;
  margin-block-start:var(--fx-space-4); text-align:start;
}
html[data-ui="v2"] .fx-saved__h{
  margin:0 0 10px;
  font-size:var(--fx-text-xs); font-weight:var(--fx-weight-semibold);
  color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-saved__list{
  display:flex; flex-wrap:wrap; gap:8px; list-style:none; margin:0; padding:0;
}
html[data-ui="v2"] .fx-saved__chip{
  display:inline-flex; align-items:center; gap:2px;
  padding-inline-start:12px; padding-inline-end:4px;
  border:1px solid var(--fx-border); border-radius:var(--fx-radius-pill);
  background:var(--fx-surface); font-size:var(--fx-text-sm);
}
html[data-ui="v2"] .fx-saved__chip.has-new{
  border-color:color-mix(in srgb, var(--fx-accent) 55%, var(--fx-border));
}
html[data-ui="v2"] .fx-saved__name{
  color:var(--fx-text); font-weight:var(--fx-weight-semibold);
  text-decoration:none; padding-block:6px;
  transition:color var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-saved__name:hover{color:var(--fx-primary)}
html[data-ui="v2"] .fx-saved__name:focus-visible{
  outline:none; box-shadow:var(--fx-ring); border-radius:var(--fx-radius-sm);
}
html[data-ui="v2"] .fx-saved__new{
  display:inline-block; margin-inline-start:6px;
  padding-block:1px; padding-inline:8px;
  border-radius:var(--fx-radius-pill);
  background:var(--fx-accent); color:var(--fx-gray-950);
  font-size:var(--fx-text-2xs); font-weight:var(--fx-weight-bold);
}
html[data-ui="v2"] .fx-saved__chip form{display:inline; margin:0}
html[data-ui="v2"] .fx-saved__bell,
html[data-ui="v2"] .fx-saved__x{
  display:inline-grid; place-items:center;
  inline-size:28px; block-size:28px;
  border:0; border-radius:50%; background:none;
  color:var(--fx-text-subtle); font:inherit; cursor:pointer;
  transition:background-color var(--fx-dur-fast) var(--fx-ease-out),
    color var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-saved__bell:hover,
html[data-ui="v2"] .fx-saved__x:hover{
  background:var(--fx-surface-hover); color:var(--fx-text);
}
html[data-ui="v2"] .fx-saved__bell:focus-visible,
html[data-ui="v2"] .fx-saved__x:focus-visible{
  outline:none; box-shadow:var(--fx-ring);
}
html[data-ui="v2"] .fx-saved__bell.is-on{
  color:var(--fx-primary); background:var(--fx-primary-soft);
}
html[data-ui="v2"] .fx-saved__x:hover{
  color:var(--fx-danger); background:var(--fx-danger-bg);
}
html[data-ui="v2"] .fx-saved__help{
  margin:10px 0 0; color:var(--fx-text-subtle); font-size:var(--fx-text-xs);
}

/* ---------------------------------------------------------------------------
   6. Competitor suggestions (_competitor_suggest.html) — card rows under the
      bar; muted meta line, hover/focus lift.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-suggest{max-inline-size:none; margin:0; text-align:start}
html[data-ui="v2"] .fx-suggest__count{
  margin:var(--fx-space-3) 0 8px;
  color:var(--fx-text-muted); font-size:var(--fx-text-xs);
}
html[data-ui="v2"] .fx-suggest__list{
  display:grid; gap:8px; list-style:none; margin:0; padding:0;
  border-top:0; max-height:none; overflow:visible;
}
html[data-ui="v2"] .fx-suggest__item{margin:0; padding:0; border-bottom:0}
html[data-ui="v2"] .fx-suggest__link{
  display:block; padding:12px 16px;
  border:1px solid var(--fx-border); border-radius:var(--fx-radius-lg);
  background:var(--fx-surface); color:var(--fx-text); text-decoration:none;
  transition:background-color var(--fx-dur-fast) var(--fx-ease-out),
    border-color var(--fx-dur-fast) var(--fx-ease-out),
    box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-suggest__link:hover{
  border-color:var(--fx-border-strong); background:var(--fx-surface-hover);
}
html[data-ui="v2"] .fx-suggest__link:focus-visible{
  outline:none; border-color:var(--fx-primary); box-shadow:var(--fx-ring);
}
html[data-ui="v2"] .fx-suggest__row{display:grid; gap:2px}
html[data-ui="v2"] .fx-suggest__name{
  font-size:var(--fx-text-base); font-weight:var(--fx-weight-semibold);
}
html[data-ui="v2"] .fx-suggest__meta{
  color:var(--fx-text-muted); font-size:var(--fx-text-xs);
}
html[data-ui="v2"] .fx-suggest__more{margin:10px 0 0}
html[data-ui="v2"] .fx-suggest__empty{
  margin:var(--fx-space-3) 0 0;
  color:var(--fx-text-muted); font-size:var(--fx-text-sm);
}

/* ---------------------------------------------------------------------------
   7. Dark + narrow refinements — raised segments must read lighter than their
      sunken track, pills stay compact, scope columns split evenly at ≤480px.
--------------------------------------------------------------------------- */

/* Dark: --fx-surface-raised (#15213A) barely lifts off the sunken track, so
   the selected segment looked inverted. gray-800 plus a hairline border reads
   clearly raised; light keeps the plain raised surface. */
html[data-ui="v2"].dark .fx-mode::before,
html[data-ui="v2"].dark .fx-scope__track::before{
  background:var(--fx-gray-800);
  box-shadow:var(--fx-shadow-sm), inset 0 0 0 1px var(--fx-border-strong);
}
html[data-ui="v2"].dark .fx-scope-pills input:checked + span,
html[data-ui="v2"].dark .scope-options label:has(input:checked){
  background:var(--fx-gray-800);
  box-shadow:var(--fx-shadow-sm), inset 0 0 0 1px var(--fx-border-strong);
}

/* Competitor scope pills hug their content and sit on the column's start
   edge — compact like the mode toggle, not a stretched bar. */
html[data-ui="v2"] .fx-scope-pills{
  inline-size:fit-content; justify-self:start;
}

@media (max-width:480px){
  /* Equal thirds across the full row so all three scope labels wrap evenly. */
  html[data-ui="v2"] .fx-scope{display:block}
  html[data-ui="v2"] .fx-scope__track{display:grid; inline-size:100%}
  html[data-ui="v2"] .fx-scope__track label{
    font-size:var(--fx-text-xs); padding-inline:8px;
  }
  /* Home filters card: tighter padding, dates share the row as 1fr, the
     preset chips drop to their own start-aligned row. */
  html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters{padding:var(--fx-space-4)}
  html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__dates{
    flex-basis:100%; grid-template-columns:repeat(2,minmax(0,1fr));
  }
  html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__presets{flex-basis:100%}
}

/* ---------------------------------------------------------------------------
   8. Motion — the panel fades/rises in when it loses [hidden] on a mode
      switch; both segmented thumbs slide. All off under reduced motion.
--------------------------------------------------------------------------- */

@media (prefers-reduced-motion:no-preference){
  html[data-ui="v2"] .fx-hero__panel:not([hidden]){
    animation:fx-hero-panel-in var(--fx-dur-base) var(--fx-ease-out) both;
  }
  html[data-ui="v2"] .fx-mode::before,
  html[data-ui="v2"] .fx-scope__track::before{
    transition:transform var(--fx-dur-base) var(--fx-ease-spring);
  }
}
@keyframes fx-hero-panel-in{from{opacity:0; transform:translateY(10px)}}

/* ---------------------------------------------------------------------------
   9. Agencies (_home_agencies.html, slice 3.1b) — the section joins the hero's
      centred column: a head row (h2 + count, quiet actions grouped beside
      them), a hairline toolbar card, then the two-column list card. The
      partial also renders on v2 /search-free pages, so every rule keys on
      .fx-agencies / #agency-list, not .fx-page--home.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-agencies{
  max-inline-size:880px; margin-inline:auto;
  margin-block-start:var(--fx-space-12);
  border-top:0; padding-top:0;
  text-align:start;
}
html[data-ui="v2"] .fx-agencies__head{
  display:flex; flex-wrap:wrap; align-items:end; gap:8px 20px;
}
html[data-ui="v2"] .fx-agencies__titles{flex:1 1 260px; min-inline-size:0}
html[data-ui="v2"] .fx-agencies__h{
  margin:0; font-size:var(--fx-text-xl); font-weight:var(--fx-weight-bold);
  line-height:var(--fx-leading-tight); color:var(--fx-text); text-align:start;
}
html[data-ui="v2"] .fx-agencies__count{
  margin:4px 0 0; font-size:var(--fx-text-xs); color:var(--fx-text-subtle);
}
/* Actions are quiet and grouped right after the titles — nothing floats to
   the far end of the row. */
html[data-ui="v2"] .fx-agencies__actions{
  display:flex; align-items:center; gap:var(--fx-space-3);
}
html[data-ui="v2"] .fx-agencies__export{margin:0}
html[data-ui="v2"] .fx-agencies__research{margin:0; font-size:var(--fx-text-sm)}

/* Toolbar — one hairline card in the 3.1a filters-card language. */
html[data-ui="v2"] .fx-agencies__toolbar{
  margin-block-start:var(--fx-space-4); margin-block-end:0;
  display:grid; gap:var(--fx-space-3); justify-items:start;
  padding:var(--fx-space-4) var(--fx-space-5);
  background:var(--fx-surface); border:1px solid var(--fx-border);
  border-radius:var(--fx-radius-lg); box-shadow:var(--fx-shadow-xs);
}
html[data-ui="v2"] .fx-agencies__label{
  font-size:var(--fx-text-xs); font-weight:var(--fx-weight-semibold);
  color:var(--fx-text-muted); letter-spacing:0;
}
html[data-ui="v2"] .fx-agencies__search{position:relative; inline-size:min(460px,100%)}
html[data-ui="v2"] .fx-agencies__search-icon{
  position:absolute; inset-inline-start:12px; inset-block-start:50%;
  transform:translateY(-50%); color:var(--fx-text-subtle); pointer-events:none;
}
html[data-ui="v2"] .fx-agencies__search .fx-input{padding-inline-start:38px}

/* The published-only toggle: a real checkbox drawn as the fx-switch track and
   thumb (36×20, 14px thumb travelling 16px toward the inline-end). */
html[data-ui="v2"] .fx-agencies__togglerow{
  display:flex; flex-wrap:wrap; align-items:center; gap:4px 14px;
}
html[data-ui="v2"] .fx-agencies__switch{
  display:inline-flex; align-items:center; gap:10px; cursor:pointer;
}
html[data-ui="v2"] .fx-agencies__switch-input{
  appearance:none; -webkit-appearance:none; position:relative; flex:none;
  margin:0; inline-size:36px; block-size:20px;
  border:1px solid var(--fx-border-strong); border-radius:var(--fx-radius-pill);
  background:var(--fx-surface-sunken); cursor:pointer;
  transition:background-color var(--fx-dur-base) var(--fx-ease-out),
    border-color var(--fx-dur-base) var(--fx-ease-out),
    box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-agencies__switch-input::before{
  content:""; position:absolute;
  inset-block-start:2px; inset-inline-start:2px;
  inline-size:14px; block-size:14px; border-radius:50%;
  background:var(--fx-surface); box-shadow:var(--fx-shadow-xs);
  transition:transform var(--fx-dur-base) var(--fx-ease-spring),
    background-color var(--fx-dur-base) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-agencies__switch:hover .fx-agencies__switch-input{
  border-color:var(--fx-primary);
}
html[data-ui="v2"] .fx-agencies__switch-input:checked{
  background:var(--fx-primary); border-color:var(--fx-primary);
}
html[data-ui="v2"] .fx-agencies__switch-input:checked::before{
  transform:translateX(calc(var(--fx-dir) * 16px));
}
html[data-ui="v2"] .fx-agencies__switch-input:focus-visible{
  outline:none; box-shadow:var(--fx-ring);
}
html[data-ui="v2"] .fx-agencies__switch-text{
  font-size:var(--fx-text-sm); font-weight:var(--fx-weight-medium); color:var(--fx-text);
}
html[data-ui="v2"] .fx-agencies__help{
  margin:0; font-size:var(--fx-text-xs); color:var(--fx-text-subtle);
}

/* List — one card, hairline-divided rows, 2 columns at >=1024px; an inner
   60vh scroller like v1's .index. [hidden] stays honoured. */
html[data-ui="v2"] #agency-list{
  display:grid; grid-template-columns:1fr;
  margin:var(--fx-space-4) 0 0; padding:0; list-style:none;
  background:var(--fx-surface); border:1px solid var(--fx-border);
  border-radius:var(--fx-radius-lg); box-shadow:var(--fx-shadow-xs);
  /* Inner scroller like v1's .index (max-height:60vh + overflow:auto): every
     row stays reachable; the box clips to the radius. */
  max-block-size:60vh; overflow-y:auto; overflow-x:hidden;
  overscroll-behavior:contain;
}
/* No content-visibility on the list: it costs ~4ms per filter keystroke
   (dirty-tracking while on-screen) and measured slower overall than simply
   letting the 60vh scroller clip the paint. Per-item c-v was worse still. */
html[data-ui="v2"] #agency-list li{margin:0}
html[data-ui="v2"] #agency-list li[hidden]{display:none}
html[data-ui="v2"] #agency-list li + li{border-block-start:1px solid var(--fx-border)}
@media (min-width:1024px){
  html[data-ui="v2"] #agency-list{
    grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:0; row-gap:0;
    /* One vertical hairline between the columns, painted on the list so it
       spans the scrolled content (a positioned pseudo-element only covers the
       first 60vh). Centred, so it is mirror-safe; immune to rows re-pairing
       under filtering. */
    background:
      linear-gradient(var(--fx-border),var(--fx-border)) 50% 0 / 1px 100% no-repeat local,
      var(--fx-surface);
  }
  html[data-ui="v2"] #agency-list li + li{border-block-start:0}
  html[data-ui="v2"] #agency-list li:nth-child(n+3){border-block-start:1px solid var(--fx-border)}
}
html[data-ui="v2"] #agency-list li a{
  display:flex; align-items:center; gap:12px;
  padding:11px 16px; min-block-size:56px; box-sizing:border-box;
  border-radius:0; color:var(--fx-text); text-decoration:none;
  transition:background-color var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] #agency-list li a:hover{background:var(--fx-surface-hover)}
html[data-ui="v2"] #agency-list li a:focus-visible{
  outline:none; box-shadow:inset 0 0 0 2px var(--fx-primary);
}
html[data-ui="v2"] #agency-list li a > span:first-child{
  flex:1; min-inline-size:0; display:grid; gap:1px;
}
html[data-ui="v2"] #agency-list .name{
  font-size:var(--fx-text-sm); font-weight:var(--fx-weight-medium);
  color:var(--fx-text); overflow-wrap:anywhere;
}
html[data-ui="v2"] #agency-list .en{
  display:block; font-size:var(--fx-text-xs); color:var(--fx-text-subtle);
}
html[data-ui="v2"] #agency-list .go{
  flex:none; font-size:var(--fx-text-lg); line-height:1;
  color:var(--fx-text-subtle);
}
/* ‹ already points forward in RTL; mirror it in LTR. */
html[data-ui="v2"][dir="ltr"] #agency-list .go{transform:scaleX(-1)}
html[data-ui="v2"] #agency-list li a:hover .go{color:var(--fx-primary)}

html[data-ui="v2"] #agency-empty{margin:var(--fx-space-4) 0 0}
/* .fx-empty's display:grid would beat the UA [hidden] rule — reassert it. */
html[data-ui="v2"] #agency-empty[hidden]{display:none}
html[data-ui="v2"] .fx-agencies__empty-state{margin-block-start:var(--fx-space-4)}
html[data-ui="v2"] .fx-agencies__refresh{display:flex; justify-content:flex-start}
html[data-ui="v2"] .fx-agencies__refresh .fx-btn{
  max-inline-size:100%; min-inline-size:0;
  white-space:normal; text-align:center; block-size:auto;
}
html[data-ui="v2"] .fx-agencies__refresh .htmx-indicator{display:none}
html[data-ui="v2"] .fx-agencies__refresh.htmx-request .htmx-indicator,
html[data-ui="v2"] .fx-agencies__refresh .htmx-request .htmx-indicator{display:inline}

/* Deferred placeholder — the same head and card shapes, drawn as quiet
   skeleton bars so the outerHTML swap lands without a visible shift. */
html[data-ui="v2"] .fx-skel-line{
  display:inline-block; vertical-align:middle;
  inline-size:120px; block-size:12px; border-radius:var(--fx-radius-pill);
  background:var(--fx-surface-sunken);
}
html[data-ui="v2"] .fx-skel-line--count{inline-size:96px}
html[data-ui="v2"] .fx-skel-line--label{inline-size:150px}
html[data-ui="v2"] .fx-skel-line--field{
  inline-size:min(460px,100%); block-size:44px; border-radius:var(--fx-radius-md);
}
@media (prefers-reduced-motion:no-preference){
  html[data-ui="v2"] .fx-skel-line{
    background:linear-gradient(90deg,
      var(--fx-surface-sunken) 25%, var(--fx-border) 50%, var(--fx-surface-sunken) 75%);
    background-size:200% 100%;
    animation:skeleton-sheen 1.4s ease-in-out infinite;
  }
}

@media (max-width:480px){
  html[data-ui="v2"] .fx-agencies{margin-block-start:var(--fx-space-10)}
  html[data-ui="v2"] .fx-agencies__toolbar{padding:var(--fx-space-4)}
}

/* Visible filters (agency, primary activity, sub-activity, region) and the agency directory narrowing. */
html[data-ui="v2"] .fx-filters__visible{margin-block-start:var(--fx-space-3, 12px)}
html[data-ui="v2"] .fx-filters__visible .help,
html[data-ui="v2"] .fx-agencies__narrow .help{margin:4px 0 0; color:var(--fx-text-subtle); font-size:var(--fx-text-xs)}
html[data-ui="v2"] .fx-filters__reset{margin:0; font-size:var(--fx-text-sm)}
html[data-ui="v2"] .fx-results__note{color:var(--fx-text-subtle); font-size:var(--fx-text-xs); margin-block:8px}
html[data-ui="v2"] .fx-agencies__narrow{
  border:1px solid var(--fx-border); border-radius:var(--fx-radius-md, 12px);
  padding:14px 16px; margin-block:var(--fx-space-3, 12px);
}
html[data-ui="v2"] .fx-agencies__narrow-h{margin:0 0 10px; font-size:var(--fx-text-sm); font-weight:var(--fx-weight-semibold)}
html[data-ui="v2"] .fx-agencies__narrow .agency-narrow-actions{display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-block-start:10px}

html[data-ui="v2"] .fx-saved__owner{font-size:.75rem;color:var(--fx-muted,#667);padding-inline:.4rem}

/* Phones under ~420px: two date inputs (each ~172px, Chromium does not shrink
   a date input below its fields) overflowed the card; they stack instead. */
@media (max-width: 420px){
  html[data-ui="v2"] :is(.fx-page--home, .fx-page--search) .fx-filters__dates{grid-template-columns:minmax(0,1fr)}
}
