/* Fursa UI v2 — admin pages. Loaded last in v2/base.html; every rule is
   scoped to html[data-ui="v2"]. First page: «إدارة المستخدمين» (/sales/users);
   the shared bits below are for the later admin slices too. */

/* ---------------------------------------------------------------------------
   1. Shared admin bits — .fx-avatar (initial circle, the .fx-account-id__avatar
      look at row size), .fx-secret (mono credential), .fx-btn--danger (ghost
      that turns danger), .fx-toggle (switch-styled checkbox label).
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-avatar{
  flex:none;display:inline-grid;place-items:center;
  inline-size:40px;block-size:40px;border-radius:50%;
  background:var(--fx-primary-soft);color:var(--fx-primary);
  font-size:var(--fx-text-lg);font-weight:var(--fx-weight-semibold);
  text-transform:uppercase;
}

html[data-ui="v2"] .fx-secret{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-variant-numeric:tabular-nums;font-weight:var(--fx-weight-semibold);
  padding:0 7px;border-radius:var(--fx-radius-sm);
  background:var(--fx-surface);border:1px solid var(--fx-border-strong);
  overflow-wrap:anywhere;
}

/* Danger-ghost: quiet until hovered, then danger. For the destructive row
   actions (reset password, unlink Microsoft). */
html[data-ui="v2"] .fx-btn--danger{color:var(--fx-danger)}
html[data-ui="v2"] .fx-btn--danger:not([disabled]):not([aria-disabled="true"]):hover{
  background:var(--fx-danger-bg);color:var(--fx-danger);
}
html[data-ui="v2"] .fx-btn--danger:focus-visible{outline:none;box-shadow:var(--fx-ring-danger)}

/* .fx-toggle — a switch look on a real checkbox: the input sits invisible over
   its track (the .fx-chip-radio mechanism), the span draws it. */
html[data-ui="v2"] .fx-toggle{
  position:relative;display:inline-flex;align-items:center;gap:var(--fx-space-2);
  color:var(--fx-text-muted);font-size:var(--fx-text-sm);
  font-weight:var(--fx-weight-medium);cursor:pointer;
}
html[data-ui="v2"] .fx-toggle input{
  position:absolute;inset-inline-start:0;inset-block-start:50%;
  transform:translateY(-50%);
  inline-size:36px;block-size:20px;margin:0;opacity:0;cursor:pointer;
}
html[data-ui="v2"] .fx-toggle__track{
  position:relative;flex:none;inline-size:36px;block-size:20px;
  border-radius:var(--fx-radius-pill);
  border:1px solid var(--fx-border-strong);background:var(--fx-surface-sunken);
  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-toggle__thumb{
  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);
}
html[data-ui="v2"] .fx-toggle:hover .fx-toggle__track{border-color:var(--fx-primary)}
html[data-ui="v2"] .fx-toggle input:checked + .fx-toggle__track{
  background:var(--fx-primary);border-color:var(--fx-primary);
}
html[data-ui="v2"] .fx-toggle input:checked + .fx-toggle__track .fx-toggle__thumb{
  transform:translateX(calc(var(--fx-dir) * 16px));
}
html[data-ui="v2"] .fx-toggle input:checked ~ .fx-toggle__text{color:var(--fx-text)}
html[data-ui="v2"] .fx-toggle input:focus-visible + .fx-toggle__track{box-shadow:var(--fx-ring)}
@media (prefers-reduced-motion:reduce){
  html[data-ui="v2"] .fx-toggle__track,
  html[data-ui="v2"] .fx-toggle__thumb{transition:none}
}

/* ---------------------------------------------------------------------------
   1b. The «+ إضافة» create card, page-level callouts and the one-time
   credentials callout — shared by the admin pages. A <details> carries only
   the summary button; its card is the next sibling, shown by the [open]
   sibling selector so it can span the head's full width (a panel inside the
   details would stay trapped in the summary's grid track).
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-create__toggle{list-style:none}
html[data-ui="v2"] .fx-create__toggle::-webkit-details-marker{display:none}
html[data-ui="v2"] .fx-create__toggle::marker{content:""}
html[data-ui="v2"] .fx-create__panel{display:none;grid-column:1/-1}
html[data-ui="v2"] .fx-create[open] + .fx-create__panel{
  display:block;
  animation:fx-rise var(--fx-dur-base) var(--fx-ease-out) both;
}
html[data-ui="v2"] .fx-create__lede{
  margin:0;font-size:var(--fx-text-sm);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-create__form{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:var(--fx-space-4);margin-block-start:var(--fx-space-4);
}
html[data-ui="v2"] .fx-create__form .fx-field{margin:0}
html[data-ui="v2"] .fx-create__form .fx-field--wide{grid-column:1/-1}
html[data-ui="v2"] .fx-create__actions{
  grid-column:1/-1;display:flex;justify-content:flex-end;
}

/* Error/result callouts sit between the head and the body. The one-time
   credentials callout (.fx-created) puts «نسخ» beside the bidi-safe line. */
html[data-ui="v2"] :is(.fx-page--users,.fx-page--companies) > .fx-callout{
  margin-block-end:var(--fx-space-4);
}
html[data-ui="v2"] .fx-created{flex-wrap:wrap}
html[data-ui="v2"] .fx-created__body{
  flex:1;min-inline-size:0;display:grid;gap:4px;
}
html[data-ui="v2"] .fx-created__note{font-size:var(--fx-text-xs);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-created .fx-copy{flex:none;align-self:center}

@media (max-width:640px){
  /* The open create card stacks its fields on one column. */
  html[data-ui="v2"] .fx-create__form{grid-template-columns:1fr}
  /* «نسخ» drops under the one-time credentials line, start-aligned. */
  html[data-ui="v2"] .fx-created{
    display:grid;grid-template-columns:auto minmax(0,1fr);
  }
  html[data-ui="v2"] .fx-created .fx-copy{
    grid-column:2;justify-self:start;align-self:start;
  }
}

/* Narrow phones: the create submit spans the card's full width. */
@media (max-width:480px){
  html[data-ui="v2"] .fx-create__actions .fx-btn{inline-size:100%}
}

/* ---------------------------------------------------------------------------
   2. «إدارة المستخدمين» (.fx-page--users) — one 880px column: head crumbs,
      title + inline create card, callouts, then one card of user rows.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-page--users{max-inline-size:880px}

/* The head is a grid: crumbs, the lead, and .fx-create holding only the
   summary button in the end column; its card is the next sibling and opens
   onto a full-width row under the whole head (the shared §1b mechanism). */
html[data-ui="v2"] .fx-page--users .fx-users-head{
  display:grid;grid-template-columns:minmax(0,1fr) auto;
  column-gap:var(--fx-space-4);row-gap:var(--fx-space-4);align-items:end;
  margin-block-end:var(--fx-space-5);
}
html[data-ui="v2"] .fx-page--users .fx-users-head__crumbs{
  grid-column:1/-1;margin-block-end:0;
}
html[data-ui="v2"] .fx-page--users .fx-users-head__lead{display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--users .fx-users-head__lead :is(.fx-title,.fx-lede){margin:0}

html[data-ui="v2"] .fx-page--users .fx-create{
  grid-column:2;justify-self:end;align-self:end;
}
html[data-ui="v2"] .fx-page--users .fx-create__roles{
  grid-column:1/-1;margin:0;padding:0;border:0;min-inline-size:0;
}
html[data-ui="v2"] .fx-page--users .fx-create__radios{display:flex;flex-wrap:wrap;gap:var(--fx-space-2)}

/* The directory card: hairline-separated rows, no column headers. A row is a
   wrapping flex line — the identity block grows but never squeezes under
   12rem, chips and «تعديل» keep their width; anything extra wraps below. */
html[data-ui="v2"] .fx-page--users .fx-users{
  margin:0;padding:0;list-style:none;overflow:hidden;
}
html[data-ui="v2"] .fx-page--users .fx-user{
  display:flex;flex-wrap:wrap;align-items:center;
  gap:var(--fx-space-3) var(--fx-space-4);
  padding:var(--fx-space-4) var(--fx-space-5);
}
html[data-ui="v2"] .fx-page--users .fx-user + .fx-user{
  border-block-start:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-page--users .fx-user.is-disabled :is(.fx-user__name,.fx-user__email){
  opacity:.55;
}
html[data-ui="v2"] .fx-page--users .fx-user__who{
  display:flex;align-items:center;gap:var(--fx-space-3);
  flex:1 1 auto;min-inline-size:12rem;
}
html[data-ui="v2"] .fx-page--users .fx-user__id{
  display:grid;gap:2px;min-inline-size:0;flex:1 1 auto;
}
html[data-ui="v2"] .fx-page--users .fx-user__name{
  font-size:var(--fx-text-base);font-weight:var(--fx-weight-semibold);
  overflow-wrap:anywhere;
}
html[data-ui="v2"] .fx-page--users .fx-user__mail{
  display:inline-flex;align-items:center;gap:var(--fx-space-2);flex-wrap:wrap;
}
html[data-ui="v2"] .fx-page--users .fx-user__email{
  font-size:var(--fx-text-sm);color:var(--fx-text-muted);overflow-wrap:anywhere;
}
html[data-ui="v2"] .fx-page--users .fx-user__chips{
  flex:none;display:flex;flex-wrap:wrap;gap:var(--fx-space-2);
  justify-content:flex-end;
}
html[data-ui="v2"] .fx-page--users .fx-user__seed{color:var(--fx-text-muted)}

/* «تعديل»: the details is a plain end-side item holding only the summary. The
   panel is its sibling — hidden until the details opens, then forced onto a
   full-width line of its own so it can never steal the first line's width. */
html[data-ui="v2"] .fx-page--users .fx-user__edit{flex:none}
html[data-ui="v2"] .fx-page--users .fx-user__panel{display:none}
html[data-ui="v2"] .fx-page--users .fx-user__edit[open] + .fx-user__panel{
  display:flex;flex-wrap:wrap;align-items:end;flex:1 1 100%;
  gap:var(--fx-space-3) var(--fx-space-4);
  margin-block-start:var(--fx-space-1);padding-block-start:var(--fx-space-4);
  border-block-start:1px solid var(--fx-border);
  animation:fx-rise var(--fx-dur-base) var(--fx-ease-out) both;
}
html[data-ui="v2"] .fx-page--users .fx-user__role-form{
  display:flex;flex-wrap:wrap;align-items:end;gap:var(--fx-space-3);
}
html[data-ui="v2"] .fx-page--users .fx-user__role-field{min-inline-size:160px}
html[data-ui="v2"] .fx-page--users .fx-user__email-edit{flex:1;min-inline-size:260px}
html[data-ui="v2"] .fx-page--users .fx-user__email-form{
  display:flex;flex-wrap:wrap;align-items:end;gap:var(--fx-space-3);
}
html[data-ui="v2"] .fx-page--users .fx-user__email-form .fx-field{
  flex:1;min-inline-size:200px;
}

/* Phones: the identity block (avatar + name/email) takes the whole row; chips
   and «تعديل» share the next line as a wrapping flex row so they never overlap;
   the edit panel still spans full width when open. */
@media (max-width:640px){
  html[data-ui="v2"] .fx-page--users .fx-user{
    gap:6px var(--fx-space-2);
  }
  html[data-ui="v2"] .fx-page--users .fx-user__who{
    flex:1 1 100%;min-inline-size:0;
  }
  html[data-ui="v2"] .fx-page--users .fx-user__chips{
    flex:0 1 auto;flex-wrap:wrap;gap:6px var(--fx-space-2);
    justify-content:flex-start;min-inline-size:0;
  }
  /* A long role label («مستخدم — مساحة الفرص فقط») wraps inside its chip
     instead of squeezing or overlapping a sibling. */
  html[data-ui="v2"] .fx-page--users .fx-user__chips .fx-chip{
    white-space:normal;min-inline-size:0;
  }
  html[data-ui="v2"] .fx-page--users .fx-user__panel{flex:1 1 100%}
}

/* ---------------------------------------------------------------------------
   3. «الشركات» (.fx-page--companies) — the same 880px column and «+ إضافة»
      create card as «إدارة المستخدمين»; rows are company lines: a square-ish
      initials avatar, name + website, chips, and a status chip with the
      pause/resume action.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-page--companies{max-inline-size:880px}

/* The head is a grid: the lead takes the start column; the usage link and the
   create toggle share the end columns; the open card spans all three. */
html[data-ui="v2"] .fx-page--companies .fx-companies-head{
  display:flex;flex-wrap:wrap;align-items:center;
  gap:var(--fx-space-3);margin-block-end:var(--fx-space-5);
}
html[data-ui="v2"] .fx-page--companies .fx-companies-head{justify-content:center;text-align:center}
html[data-ui="v2"] .fx-page--companies .fx-companies-head__lead{display:grid;gap:var(--fx-space-2);flex:1 1 100%;justify-items:center;text-align:center}
html[data-ui="v2"] .fx-page--companies .fx-companies-head__lead .fx-lede{max-inline-size:60ch}
html[data-ui="v2"] .fx-page--companies .fx-companies-head__lead :is(.fx-title,.fx-lede){margin:0}
html[data-ui="v2"] .fx-page--companies .fx-create__panel{flex:1 1 100%}

/* The directory card: hairline-separated rows, no column headers — the same
   row anatomy as .fx-user (the identity block grows, chips and the action
   keep their width, anything extra wraps below). The avatar reads as an org
   monogram (two initials, square-ish), not a person's circle. */
html[data-ui="v2"] .fx-page--companies .fx-avatar{
  border-radius:var(--fx-radius-md);font-size:var(--fx-text-base);
}
html[data-ui="v2"] .fx-page--companies .fx-companies{
  margin:0;padding:0;list-style:none;overflow:hidden;
}
html[data-ui="v2"] .fx-page--companies .fx-company{
  display:flex;flex-wrap:wrap;align-items:center;
  gap:var(--fx-space-3) var(--fx-space-4);
  padding:var(--fx-space-4) var(--fx-space-5);
}
html[data-ui="v2"] .fx-page--companies .fx-company + .fx-company{
  border-block-start:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-page--companies .fx-company.is-disabled :is(.fx-company__name,.fx-company__sub){
  opacity:.55;
}
html[data-ui="v2"] .fx-page--companies .fx-company__who{
  display:flex;align-items:center;gap:var(--fx-space-3);
  flex:1 1 auto;min-inline-size:12rem;
}
html[data-ui="v2"] .fx-page--companies .fx-company__id{
  display:grid;gap:2px;min-inline-size:0;flex:1 1 auto;
}
html[data-ui="v2"] .fx-page--companies .fx-company__name{
  font-size:var(--fx-text-base);font-weight:var(--fx-weight-semibold);
  overflow-wrap:anywhere;
}
html[data-ui="v2"] .fx-page--companies .fx-company__sub{
  display:inline-flex;align-items:center;gap:var(--fx-space-2);flex-wrap:wrap;
  min-inline-size:0;font-size:var(--fx-text-sm);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--companies .fx-company__site{
  color:var(--fx-text-subtle);overflow-wrap:anywhere;
}
html[data-ui="v2"] .fx-page--companies .fx-company__chips{
  flex:none;display:flex;flex-wrap:wrap;gap:var(--fx-space-2);
  justify-content:flex-end;
}
html[data-ui="v2"] .fx-page--companies .fx-company__accounts{gap:6px}
html[data-ui="v2"] .fx-page--companies .fx-company__accounts-word{
  color:var(--fx-text-muted);font-weight:var(--fx-weight-regular);
}
html[data-ui="v2"] .fx-page--companies .fx-company__manage{flex:none}
html[data-ui="v2"] .fx-page--companies .fx-company__manage summary{list-style:none;cursor:pointer}
html[data-ui="v2"] .fx-page--companies .fx-company__manage summary::-webkit-details-marker{display:none}
html[data-ui="v2"] .fx-page--companies .fx-company__manage summary::marker{content:""}
html[data-ui="v2"] .fx-page--companies .fx-company__panel{
  display:none;flex:1 1 100%;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));
  gap:var(--fx-space-4);padding:var(--fx-space-4);
  background:var(--fx-surface-sunken,var(--fx-bg-subtle,transparent));
  border:1px solid var(--fx-border);border-radius:var(--fx-radius-md);
}
html[data-ui="v2"] .fx-page--companies .fx-company__manage[open] + .fx-company__panel{display:grid}
html[data-ui="v2"] .fx-page--companies .fx-company__block{display:grid;gap:var(--fx-space-2);align-content:start;margin:0}
html[data-ui="v2"] .fx-page--companies .fx-company__block .fx-hint{margin:0}
html[data-ui="v2"] .fx-page--companies .fx-company__block--danger{
  grid-column:1/-1;padding-block-start:var(--fx-space-4);border-block-start:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-page--companies .fx-company__block--danger .fx-label{color:var(--fx-danger,#c0392b)}
html[data-ui="v2"] .fx-page--companies .fx-company__row{display:flex;gap:var(--fx-space-2);align-items:center;flex-wrap:wrap}
html[data-ui="v2"] .fx-page--companies .fx-company__row :is(.fx-input){flex:1 1 10rem;min-inline-size:0;inline-size:auto}

/* Phones: the lead takes its own line and the two head actions share the
   next; identity takes the whole row, chips and the status wrap below it. */
@media (max-width:640px){
  html[data-ui="v2"] .fx-page--companies .fx-company{gap:6px var(--fx-space-2)}
  html[data-ui="v2"] .fx-page--companies .fx-company__who{
    flex:1 1 100%;min-inline-size:0;
  }
  html[data-ui="v2"] .fx-page--companies .fx-company__chips{
    flex:0 1 auto;flex-wrap:wrap;gap:6px var(--fx-space-2);
    justify-content:flex-start;min-inline-size:0;
  }
  /* Long chips («الشركة المشغّلة», the plan names) wrap inside their chip
     instead of squeezing or overlapping a sibling. */
  html[data-ui="v2"] .fx-page--companies .fx-company__chips .fx-chip{
    white-space:normal;min-inline-size:0;
  }
}

/* ---------------------------------------------------------------------------
   4. «استخدام الذكاء الاصطناعي» (.fx-page--usage) — crumbs + head, the plans
      table folded into a quiet disclosure, one card per company: a read-only
      meter table and, for non-home companies, a «تعديل» disclosure with the
      limits form. The shared-work totals close the page as a small card.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-page--usage{
  max-inline-size:880px;display:grid;gap:var(--fx-space-5);align-content:start;
}

html[data-ui="v2"] .fx-page--usage .fx-usage-head{display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--usage .fx-usage-head__crumbs{margin-block-end:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--usage .fx-usage-head__lead{display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--usage .fx-usage-head__lead :is(.fx-title,.fx-lede){margin:0}

/* The plans disclosure keeps the summary line quiet; the help text breathes
   before the table. */
html[data-ui="v2"] .fx-page--usage .fx-plans .fx-disclosure__body > .fx-hint{
  margin-block-end:var(--fx-space-3);
}

/* A company card: head (name + chips), optional home note, the meter table,
   then the «تعديل» disclosure. */
html[data-ui="v2"] .fx-page--usage .fx-usage{display:grid;gap:var(--fx-space-4)}
html[data-ui="v2"] .fx-page--usage .fx-usage__head{
  display:flex;flex-wrap:wrap;align-items:center;
  gap:var(--fx-space-2) var(--fx-space-4);
}
html[data-ui="v2"] .fx-page--usage .fx-usage__name{
  margin:0;flex:1 1 auto;min-inline-size:0;overflow-wrap:anywhere;
  font-size:var(--fx-text-xl);font-weight:var(--fx-weight-semibold);
}
html[data-ui="v2"] .fx-page--usage .fx-usage__full{
  font-size:var(--fx-text-sm);font-weight:var(--fx-weight-regular);
  color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--usage .fx-usage__chips{
  flex:none;display:flex;flex-wrap:wrap;gap:var(--fx-space-2);
  justify-content:flex-end;
}
html[data-ui="v2"] .fx-page--usage .fx-usage__pair{
  font-variant-numeric:tabular-nums;white-space:nowrap;
}

/* The meter under today's pair: --fx-border track; the fill is success below
   70%, warning from 70%, danger from 90% — v1's is-high/is-full thresholds. */
html[data-ui="v2"] .fx-page--usage .fx-usage-meter{
  display:block;inline-size:120px;max-inline-size:100%;block-size:6px;
  margin-block-start:6px;border-radius:var(--fx-radius-pill);
  background:var(--fx-border);overflow:hidden;
}
html[data-ui="v2"] .fx-page--usage .fx-usage-meter > span{
  display:block;block-size:100%;inline-size:calc(var(--fx-pct,0) * 1%);
  border-radius:inherit;background:var(--fx-success);
}
html[data-ui="v2"] .fx-page--usage .fx-usage-meter--high > span{background:var(--fx-warning)}
html[data-ui="v2"] .fx-page--usage .fx-usage-meter--full > span{background:var(--fx-danger)}

/* Inside the «تعديل» disclosure: the plan select, then one compact row per
   feature — label, input, the «مخصص» chip — then the help line and save. */
html[data-ui="v2"] .fx-page--usage .fx-usage__form{display:grid;gap:var(--fx-space-4)}
html[data-ui="v2"] .fx-page--usage .fx-usage__plan{max-inline-size:16rem}
html[data-ui="v2"] .fx-page--usage .fx-usage-edit{
  margin:0;padding:0;list-style:none;display:grid;gap:var(--fx-space-3);
}
/* One compact grid row per feature: the label takes the slack, the input is
   always 8rem, and the chip slot keeps its ≥3.5rem track even when the row
   has no «خاص» chip — every input lines up at the same end position. */
html[data-ui="v2"] .fx-page--usage .fx-usage-edit__row{
  display:grid;grid-template-columns:minmax(0,1fr) 8rem minmax(3.5rem,auto);
  align-items:center;gap:var(--fx-space-3);
}
html[data-ui="v2"] .fx-page--usage .fx-usage-edit__label{
  min-inline-size:0;
  font-size:var(--fx-text-sm);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--usage .fx-usage-edit .usage-input{
  inline-size:8rem;text-align:end;font-variant-numeric:tabular-nums;
}
html[data-ui="v2"] .fx-page--usage .fx-usage-edit__row .fx-chip{justify-self:start}
html[data-ui="v2"] .fx-page--usage .fx-usage__actions{display:flex;justify-content:flex-end}

/* Narrow phones: the label takes its own line; the input and the chip share
   the next one. */
@media (max-width:480px){
  html[data-ui="v2"] .fx-page--usage .fx-usage-edit__row{
    grid-template-columns:8rem minmax(3.5rem,auto);justify-content:start;
  }
  html[data-ui="v2"] .fx-page--usage .fx-usage-edit__label{grid-column:1/-1}
}

/* The shared-work totals: a small card of term/number rows. */
html[data-ui="v2"] .fx-page--usage .fx-platform-totals{display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--usage .fx-platform-totals__title{
  margin:0;font-size:var(--fx-text-lg);font-weight:var(--fx-weight-semibold);
}
html[data-ui="v2"] .fx-page--usage .fx-platform-totals__list{
  margin:var(--fx-space-2) 0 0;padding:0;display:grid;gap:var(--fx-space-2);
}
html[data-ui="v2"] .fx-page--usage .fx-platform-totals__row{
  display:flex;align-items:baseline;justify-content:space-between;
  gap:var(--fx-space-4);
}
html[data-ui="v2"] .fx-page--usage .fx-platform-totals__row dt{
  color:var(--fx-text-muted);font-size:var(--fx-text-sm);
}
html[data-ui="v2"] .fx-page--usage .fx-platform-totals__row dd{
  margin:0;font-variant-numeric:tabular-nums;
}

/* ---------------------------------------------------------------------------
   6. «إعداد الشركة» (.fx-page--setup) — the same 880px column: head, a
      one-row five-step stepper (28px markers, labels beside them; under
      768px markers only plus the current step's label), then one card per
      step and a footer actions row. The keyword-tag editors take the profile
      page's look (profile.css's scoped :is() lists name .fx-page--setup);
      the suggested «+ kw» chips are dashed.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-page--setup{
  max-inline-size:880px;display:grid;gap:var(--fx-space-5);align-content:start;
}
html[data-ui="v2"] .fx-page--setup > *{min-inline-size:0}

/* Visually hidden but still read (the clip pattern, never display:none). */
html[data-ui="v2"] .fx-page--setup .fx-setup-sr{
  position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;border:0;
  overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}

/* 6.1 Head */
html[data-ui="v2"] .fx-page--setup .fx-setup-head{display:grid;gap:var(--fx-space-2);justify-items:start}
html[data-ui="v2"] .fx-page--setup .fx-setup-head :is(.fx-title,.fx-lede){margin:0}

/* 6.2 Stepper. The <ol> keeps v1's .setup-steps class; every property
   app.css's pill rules set (wrap, gap, padding, border, background, colour)
   is restated here at higher specificity. Each step is a flex item sized
   to its content: its link (marker + one-line label) then a hairline
   ::after that grows to the next marker and absorbs the slack, so the
   five steps span the card; the last step has no line. */
html[data-ui="v2"] .fx-page--setup .fx-wizard{
  display:flex;flex-wrap:nowrap;align-items:center;gap:0;
  margin:0;padding:var(--fx-space-3) var(--fx-space-4);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);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard > li{
  display:flex;align-items:center;flex:0 1 auto;min-inline-size:0;margin:0;padding:0;
}
html[data-ui="v2"] .fx-page--setup .fx-wizard > li:not(:last-child){flex:1 1 auto}
html[data-ui="v2"] .fx-page--setup .fx-wizard > li:not(:last-child)::after{
  content:"";flex:1 1 auto;min-inline-size:var(--fx-space-3);
  block-size:1px;margin-inline:var(--fx-space-2);background:var(--fx-border-strong);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard > li.is-done:not(:last-child)::after{
  background:var(--fx-success-border);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard__link{
  display:inline-flex;align-items:center;gap:var(--fx-space-2);
  flex:0 1 auto;min-inline-size:0;
  padding:var(--fx-space-1) 6px;
  border:0;border-radius:var(--fx-radius-md);background:transparent;
  color:var(--fx-text-muted);text-decoration:none;
  font-size:var(--fx-text-sm);font-weight:var(--fx-weight-medium);line-height:var(--fx-leading-ui);
  transition:background-color var(--fx-dur-fast) var(--fx-ease-out),
    color var(--fx-dur-fast) var(--fx-ease-out),
    box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard__link:hover{
  background:var(--fx-surface-sunken);color:var(--fx-text);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard__link:focus-visible{outline:none;box-shadow:var(--fx-ring)}
html[data-ui="v2"] .fx-page--setup .fx-wizard > li.is-current .fx-wizard__link{
  color:var(--fx-text);font-weight:var(--fx-weight-semibold);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard__marker{
  position:relative;flex:none;display:inline-grid;place-items:center;
  inline-size:28px;block-size:28px;border-radius:50%;
  border:1px solid var(--fx-border-strong);background:var(--fx-surface);color:var(--fx-text-muted);
  font-size:var(--fx-text-xs);font-weight:var(--fx-weight-semibold);line-height:1;
  font-variant-numeric:tabular-nums lining-nums;
}
html[data-ui="v2"] .fx-page--setup .fx-wizard__marker svg{display:block}
html[data-ui="v2"] .fx-page--setup .fx-wizard > li.is-done .fx-wizard__marker{
  background:var(--fx-success-bg);border-color:var(--fx-success-border);color:var(--fx-success);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard > li.is-current .fx-wizard__marker{
  background:var(--fx-primary);border-color:var(--fx-primary);color:var(--fx-on-primary);
}
html[data-ui="v2"] .fx-page--setup .fx-wizard__label{min-inline-size:0;white-space:nowrap}

/* Phones and tablets: markers only, plus the current step's label (one
   line, ellipsis); the others stay readable to screen readers. The current
   step takes its content width, the rest share what is left (basis 0, so
   only the current label shrinks when space runs out). */
@media (max-width:1023px){
  html[data-ui="v2"] .fx-page--setup .fx-wizard{padding:var(--fx-space-2) var(--fx-space-3)}
  html[data-ui="v2"] .fx-page--setup .fx-wizard > li:not(.is-current):not(:last-child){flex:1 1 0}
  html[data-ui="v2"] .fx-page--setup .fx-wizard > li.is-current{flex:1 1 auto}
  html[data-ui="v2"] .fx-page--setup .fx-wizard > li:not(:last-child)::after{
    min-inline-size:var(--fx-space-2);margin-inline:var(--fx-space-1);
  }
  html[data-ui="v2"] .fx-page--setup .fx-wizard__link{padding:2px}
  html[data-ui="v2"] .fx-page--setup .fx-wizard > li:not(.is-current) .fx-wizard__label{
    position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;border:0;
    overflow:hidden;clip-path:inset(50%);white-space:nowrap;
  }
  html[data-ui="v2"] .fx-page--setup .fx-wizard > li.is-current .fx-wizard__label{
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  }
}

/* 6.3 Step cards: title + muted help, then the body; the page-level actions
   under a card are a footer row — secondary/ghost first, primary last, at
   the reading end; buttons may wrap on phones. */
html[data-ui="v2"] .fx-page--setup .fx-setup-card{
  display:grid;gap:var(--fx-space-4);align-content:start;min-inline-size:0;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-card > *{min-inline-size:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-card__head{display:grid;gap:var(--fx-space-1)}
html[data-ui="v2"] .fx-page--setup .fx-setup-card__title{
  margin:0;font-size:var(--fx-text-lg);font-weight:var(--fx-weight-semibold);
  line-height:var(--fx-leading-tight);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-card__help{
  margin:0;max-inline-size:75ch;
  font-size:var(--fx-text-sm);line-height:var(--fx-leading-body);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-sub{
  margin:0;font-size:var(--fx-text-sm);font-weight:var(--fx-weight-semibold);color:var(--fx-text);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-muted{
  margin:0;font-size:var(--fx-text-sm);line-height:var(--fx-leading-body);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-quiet{
  margin:0;padding:var(--fx-space-4);text-align:center;
  border:1px dashed var(--fx-border-strong);border-radius:var(--fx-radius-md);
  font-size:var(--fx-text-sm);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-callout-body{display:grid;gap:2px;min-inline-size:0}
html[data-ui="v2"] .fx-page--setup .fx-setup__actions{
  display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;
  gap:var(--fx-space-2) var(--fx-space-3);margin:0;
}

/* 6.4 Forms (company + profile): one column, two from 768px; a plain
   .fx-field takes one column, --wide fields, the preview and the actions
   span the row. Textareas size to their content above their rows minimum. */
html[data-ui="v2"] .fx-page--setup .fx-setup-form{display:grid;gap:var(--fx-space-4);align-items:start;margin:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-form > *{grid-column:1/-1;min-inline-size:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-card .fx-field{margin:0;align-content:start}
html[data-ui="v2"] .fx-page--setup .fx-setup-card .fx-field .fx-hint{margin:0}
@media (min-width:768px){
  html[data-ui="v2"] .fx-page--setup .fx-setup-form{grid-template-columns:repeat(2,minmax(0,1fr))}
  html[data-ui="v2"] .fx-page--setup .fx-setup-form > .fx-field:not(.fx-field--wide){grid-column:auto}
}
html[data-ui="v2"] .fx-page--setup textarea.fx-input{
  field-sizing:content;resize:vertical;
  min-block-size:calc(3 * 1.5em + 20px);max-block-size:18em;
}
html[data-ui="v2"] .fx-page--setup textarea.fx-input[rows="2"]{min-block-size:calc(2 * 1.5em + 20px)}
html[data-ui="v2"] .fx-page--setup textarea.fx-input[rows="4"]{min-block-size:calc(4 * 1.5em + 20px)}
html[data-ui="v2"] .fx-page--setup textarea.fx-input[rows="6"]{min-block-size:calc(6 * 1.5em + 20px)}

/* 6.5 «أسماؤها في اعتماد»: the chosen names as removable chips (each its
   own form), then the search and its hairline result rows. */
html[data-ui="v2"] .fx-page--setup .fx-setup-chosen{display:flex;flex-wrap:wrap;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--setup .fx-setup-chosen__form{display:inline-flex;max-inline-size:100%;margin:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-chosen__chip{
  display:inline-flex;align-items:center;gap:2px;max-inline-size:100%;
  min-block-size:28px;padding-block:1px;padding-inline-start:10px;padding-inline-end:4px;
  border:1px solid var(--fx-info-border);border-radius:var(--fx-radius-pill);
  background:var(--fx-primary-soft);color:var(--fx-primary);
  font-size:var(--fx-text-xs);font-weight:var(--fx-weight-medium);line-height:1.5;
  overflow-wrap:anywhere;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-chosen__remove{
  flex:none;display:inline-grid;place-items:center;
  inline-size:24px;block-size:24px;margin:0;padding:0;border:0;
  border-radius:50%;background:transparent;
  color:inherit;font:inherit;font-size:15px;line-height:1;cursor:pointer;opacity:.65;
  transition:color var(--fx-dur-fast) var(--fx-ease-out),
    background-color var(--fx-dur-fast) var(--fx-ease-out),
    opacity var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-chosen__remove:hover{
  color:var(--fx-danger);background:var(--fx-danger-bg);opacity:1;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-chosen__remove:focus-visible{
  outline:none;opacity:1;box-shadow:var(--fx-ring);
}

html[data-ui="v2"] .fx-page--setup .fx-setup-candidates{
  margin:var(--fx-space-2) 0 0;padding:0;list-style:none;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-candidate{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:var(--fx-space-3) var(--fx-space-4);padding-block:var(--fx-space-3);
  border-block-start:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-candidate__main{
  flex:1 1 auto;min-inline-size:0;display:grid;gap:2px;justify-items:start;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-candidate__name{
  font-size:var(--fx-text-base);font-weight:var(--fx-weight-semibold);color:var(--fx-text);
  overflow-wrap:anywhere;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-candidate__line{
  margin:0;font-size:var(--fx-text-xs);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-candidate__pick{flex:none;margin:0}

/* «عرض منافساتها»: a quiet disclosure; its loaded body sits on a sunken panel. */
html[data-ui="v2"] .fx-page--setup .fx-setup-sample{margin-block-start:var(--fx-space-1);inline-size:100%}
html[data-ui="v2"] .fx-page--setup .fx-setup-sample > summary{
  padding-block:2px;border-radius:var(--fx-radius-sm);
  color:var(--fx-text-muted);font-size:var(--fx-text-xs);font-weight:var(--fx-weight-medium);
  transition:color var(--fx-dur-fast) var(--fx-ease-out),
    box-shadow var(--fx-dur-fast) var(--fx-ease-out),
    transform var(--fx-dur-instant) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-sample > summary:hover,
html[data-ui="v2"] .fx-page--setup .fx-setup-sample[open] > summary{color:var(--fx-primary)}
html[data-ui="v2"] .fx-page--setup details.fx-setup-sample > summary::after{
  inline-size:10px;block-size:10px;margin-inline-start:0;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-sample > div{
  margin-block-start:var(--fx-space-2);padding:var(--fx-space-3);
  border-radius:var(--fx-radius-md);background:var(--fx-surface-sunken);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-sample-body{display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--setup .fx-setup-sample-body__spellings{
  display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0;
  font-size:var(--fx-text-xs);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-sample-body__spellings .fx-chip{
  max-inline-size:100%;white-space:normal;overflow-wrap:anywhere;color:var(--fx-text);
}

@media (max-width:640px){
  /* «هذه شركتنا» drops under the name, full width. */
  html[data-ui="v2"] .fx-page--setup .fx-setup-candidate{flex-direction:column;align-items:stretch}
  html[data-ui="v2"] .fx-page--setup .fx-setup-candidate__pick .fx-btn{inline-size:100%}
}

/* Shared hairline rows: the record lists and the sample's latest tenders. */
html[data-ui="v2"] .fx-page--setup .fx-setup-rows{margin:0;padding:0;list-style:none}
html[data-ui="v2"] .fx-page--setup .fx-setup-row{
  display:flex;align-items:center;justify-content:space-between;
  gap:var(--fx-space-3);padding-block:var(--fx-space-2);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-row + .fx-setup-row{border-block-start:1px solid var(--fx-border)}
html[data-ui="v2"] .fx-page--setup .fx-setup-row__main{flex:1 1 auto;min-inline-size:0;display:grid;gap:2px}
html[data-ui="v2"] .fx-page--setup .fx-setup-row__name{
  flex:1 1 auto;min-inline-size:0;font-size:var(--fx-text-sm);color:var(--fx-text);overflow-wrap:anywhere;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-row__link{
  justify-self:start;border-radius:var(--fx-radius-sm);
  color:var(--fx-text);font-size:var(--fx-text-sm);font-weight:var(--fx-weight-medium);
  text-decoration:none;overflow-wrap:anywhere;
  transition:color var(--fx-dur-fast) var(--fx-ease-out),box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-row__link:hover{
  color:var(--fx-link-hover);text-decoration:underline;text-underline-offset:3px;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-row__link:focus-visible{outline:none;box-shadow:var(--fx-ring)}
html[data-ui="v2"] .fx-page--setup .fx-setup-row__meta{font-size:var(--fx-text-xs);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-page--setup .fx-setup-row .fx-chip{flex:none}

/* The record card: three compact stat tiles that stay one row at 390px,
   then the agencies and competitors lists side by side from 768px. */
html[data-ui="v2"] .fx-page--setup .fx-setup-stats{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--fx-space-3);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-stats .fx-stat{min-inline-size:0;padding:var(--fx-space-4)}
html[data-ui="v2"] .fx-page--setup .fx-setup-stats .fx-stat__value{
  min-inline-size:0;overflow-wrap:anywhere;
  font-size:clamp(var(--fx-text-lg),3.4vw,var(--fx-text-3xl));
}
html[data-ui="v2"] .fx-page--setup .fx-setup-split{display:grid;gap:var(--fx-space-5);align-items:start}
html[data-ui="v2"] .fx-page--setup .fx-setup-list{display:grid;gap:var(--fx-space-2);align-content:start;min-inline-size:0}
@media (min-width:768px){
  html[data-ui="v2"] .fx-page--setup .fx-setup-split{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:640px){
  html[data-ui="v2"] .fx-page--setup .fx-setup-stats{gap:var(--fx-space-2)}
  html[data-ui="v2"] .fx-page--setup .fx-setup-stats .fx-stat{padding:var(--fx-space-3)}
}

/* 6.6 «ملف الشركة»: the draft states, the draft button, and the suggested
   «+ kw» chips (dashed until used; keyword-tags.js removes a used one). */
html[data-ui="v2"] .fx-page--setup #setup-draft{display:grid;gap:var(--fx-space-4);min-inline-size:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-pending__spin{margin-block-start:3px;color:var(--fx-info)}
html[data-ui="v2"] .fx-page--setup .fx-setup-draft-form{margin:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-suggested .keyword-tag-list{
  display:flex;flex-wrap:wrap;gap:var(--fx-space-2);margin:0;
}
html[data-ui="v2"] .fx-page--setup .keyword-tag.suggest{
  min-block-size:28px;padding-block:1px;padding-inline:10px;
  border:1px dashed var(--fx-border-strong);background:transparent;color:var(--fx-text-muted);
  font:inherit;font-size:var(--fx-text-xs);font-weight:var(--fx-weight-medium);line-height:1.5;
  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),
    box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-page--setup .keyword-tag.suggest:hover{
  border-color:var(--fx-primary);background:var(--fx-primary-soft);color:var(--fx-primary);
}
html[data-ui="v2"] .fx-page--setup .keyword-tag.suggest:focus-visible{outline:none;box-shadow:var(--fx-ring)}

/* 6.7 «تحقق»: one hairline row per matched tender — title, muted agency and
   terms, then the «مناسبة / ليست مناسبة» pair. A fit row gets a success edge
   on the inline-start; a misfit row a danger-soft background and a muted
   title. The pressed «ليست مناسبة» is danger-soft. */
html[data-ui="v2"] .fx-page--setup .fx-setup-check{
  margin:0;padding:0;list-style:none;
  border-block:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__row{
  display:flex;align-items:center;justify-content:space-between;
  gap:var(--fx-space-3) var(--fx-space-4);
  padding:var(--fx-space-3);border-inline-start:3px solid transparent;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__row + .fx-setup-check__row{
  border-block-start:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__row.is-fit{border-inline-start-color:var(--fx-success)}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__row.is-misfit{background:var(--fx-danger-bg)}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__main{flex:1 1 auto;min-inline-size:0;display:grid;gap:2px}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__title{
  justify-self:start;border-radius:var(--fx-radius-sm);
  color:var(--fx-text);font-size:var(--fx-text-sm);font-weight:var(--fx-weight-semibold);
  text-decoration:none;overflow-wrap:anywhere;
  transition:color var(--fx-dur-fast) var(--fx-ease-out),box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__title:hover{
  color:var(--fx-link-hover);text-decoration:underline;text-underline-offset:3px;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__title:focus-visible{outline:none;box-shadow:var(--fx-ring)}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__row.is-misfit .fx-setup-check__title{color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__meta{
  margin:0;font-size:var(--fx-text-xs);line-height:var(--fx-leading-ui);color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__actions{flex:none;display:flex;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__actions form{margin:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__actions .fx-btn--ghost{border-color:var(--fx-border)}
html[data-ui="v2"] .fx-page--setup .fx-setup-check__misfit[aria-pressed="true"]{
  background:var(--fx-danger-bg);border-color:var(--fx-danger-border);color:var(--fx-danger);
}
@media (max-width:640px){
  html[data-ui="v2"] .fx-page--setup .fx-setup-check__row{flex-direction:column;align-items:stretch}
  html[data-ui="v2"] .fx-page--setup .fx-setup-check__actions{justify-content:flex-end}
}

/* The suggest form and its result: the reason as a quiet callout, each
   kind a legend over checkbox chips (the real checkbox visible and
   focusable; the chip tints while checked). */
html[data-ui="v2"] .fx-page--setup .fx-setup-suggest{margin:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-suggestions{display:grid;gap:var(--fx-space-3);margin:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-suggestions__reason{margin:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-fieldset{margin:0;padding:0;border:0;min-inline-size:0}
html[data-ui="v2"] .fx-page--setup .fx-setup-fieldset__legend{
  margin-block-end:var(--fx-space-2);padding:0;
  font-size:var(--fx-text-sm);font-weight:var(--fx-weight-semibold);color:var(--fx-text);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-checks{display:flex;flex-wrap:wrap;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--setup .fx-setup-checkchip{
  display:inline-flex;align-items:center;gap:6px;max-inline-size:100%;
  min-block-size:32px;padding-block:4px;padding-inline:8px 12px;
  border:1px solid var(--fx-border-strong);border-radius:var(--fx-radius-pill);
  background:var(--fx-surface);color:var(--fx-text);
  font-size:var(--fx-text-xs);font-weight:var(--fx-weight-medium);line-height:1.5;
  overflow-wrap:anywhere;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),
    box-shadow var(--fx-dur-fast) var(--fx-ease-out);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-checkchip input{
  flex:none;inline-size:16px;block-size:16px;margin:0;accent-color:var(--fx-primary);cursor:pointer;
}
html[data-ui="v2"] .fx-page--setup .fx-setup-checkchip:has(input:checked){
  border-color:var(--fx-info-border);background:var(--fx-primary-soft);color:var(--fx-primary);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-checkchip:has(input:focus-visible){box-shadow:var(--fx-ring)}
html[data-ui="v2"] .fx-page--setup .fx-setup-checkchip input:focus-visible{outline:none}

/* 6.8 «ابدأ»: the three lines as a short checklist with small success marks. */
html[data-ui="v2"] .fx-page--setup .fx-setup-done{margin:0;padding:0;list-style:none;display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-page--setup .fx-setup-done li{
  display:flex;align-items:flex-start;gap:var(--fx-space-2);
  font-size:var(--fx-text-sm);line-height:var(--fx-leading-body);color:var(--fx-text);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-done__icon{
  flex:none;display:inline-grid;place-items:center;
  inline-size:20px;block-size:20px;margin-block-start:1px;border-radius:50%;
  background:var(--fx-success-bg);color:var(--fx-success);
}
html[data-ui="v2"] .fx-page--setup .fx-setup-done__icon svg{display:block}

/* Super admins' activity page (/platform/activity): heat maps and rankings. */
html[data-ui="v2"] .fx-page--activity{display:grid;gap:var(--fx-space-5)}
html[data-ui="v2"] .fx-page--activity .fx-usage-head{display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-act-filters{display:flex;flex-wrap:wrap;gap:var(--fx-space-4);align-items:end}
html[data-ui="v2"] .fx-act-filters .fx-field{min-inline-size:12rem;flex:1 1 12rem}
html[data-ui="v2"] .fx-act-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(9.5rem,1fr));gap:var(--fx-space-3)}
html[data-ui="v2"] .fx-act-tile{display:grid;gap:var(--fx-space-1);padding:var(--fx-space-4)}
html[data-ui="v2"] .fx-act-tile__value{font-size:var(--fx-text-2xl);font-weight:var(--fx-weight-bold);font-variant-numeric:tabular-nums;color:var(--fx-text)}
html[data-ui="v2"] .fx-act-tile__label{font-size:var(--fx-text-sm);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-section{display:grid;gap:var(--fx-space-3);align-content:start;min-inline-size:0}
html[data-ui="v2"] .fx-act-h{margin:0;font-size:var(--fx-text-lg)}
html[data-ui="v2"] .fx-act-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,26rem),1fr));gap:var(--fx-space-5)}
html[data-ui="v2"] .fx-heat table{border-collapse:separate;border-spacing:3px}
html[data-ui="v2"] .fx-heat th{font-size:var(--fx-text-xs);color:var(--fx-text-muted);font-weight:var(--fx-weight-semibold);white-space:nowrap;text-align:start}
html[data-ui="v2"] .fx-heat thead th{max-inline-size:9rem;overflow:hidden;text-overflow:ellipsis;text-align:center}
html[data-ui="v2"] .fx-heat__cell{
  min-inline-size:3rem;padding:var(--fx-space-2);text-align:center;border-radius:var(--fx-radius-xs);
  font-size:var(--fx-text-sm);font-variant-numeric:tabular-nums;color:var(--fx-text);
  background:color-mix(in oklab, var(--fx-primary) calc(var(--heat, 0) * 100%), var(--fx-surface-sunken));
}
html[data-ui="v2"] .fx-heat__cell--strong{color:var(--fx-on-primary)}
html[data-ui="v2"] .fx-heat__total{font-weight:var(--fx-weight-semibold)}
html[data-ui="v2"] .fx-heat--hours .fx-heat__cell{min-inline-size:1.75rem;padding:var(--fx-space-1);font-size:var(--fx-text-2xs)}
html[data-ui="v2"] .fx-rank{list-style:none;margin:0;padding:0;display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-rank__row{display:grid;grid-template-columns:minmax(0,1fr) minmax(4rem,30%) 3.5rem;gap:var(--fx-space-3);align-items:center}
html[data-ui="v2"] .fx-rank__name{display:grid;min-inline-size:0;font-size:var(--fx-text-sm)}
html[data-ui="v2"] .fx-rank__meta{font-size:var(--fx-text-xs);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-rank__bar{block-size:8px;border-radius:var(--fx-radius-pill);background:var(--fx-surface-sunken);overflow:hidden}
html[data-ui="v2"] .fx-rank__bar span{display:block;block-size:100%;background:var(--fx-primary);border-radius:inherit}
html[data-ui="v2"] .fx-rank__count{text-align:end;font-variant-numeric:tabular-nums;font-weight:var(--fx-weight-semibold);font-size:var(--fx-text-sm)}
html[data-ui="v2"] .fx-act-email{display:block;font-size:var(--fx-text-xs);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-bad{color:var(--fx-danger)}

/* Activity charts: categorical palette (dataviz reference; series 1 and the ramp are the brand teal, guidelines p. 8), checked on FursaTech's
   light #fff and dark #0B1F3A surfaces, one-hue teal ramp for magnitude. */
html[data-ui="v2"] .fx-page--activity{
  --act-s0:#9aa3b2; --act-s1:#0FA3A0; --act-s2:#eb6834; --act-s3:#2a78d6; --act-s4:#eda100;
  --act-s5:#e87ba4; --act-s6:#008300; --act-s7:#6250d6; --act-s8:#e34948; --act-s9:var(--fx-text-muted);
  --act-q0:var(--fx-surface-sunken); --act-q1:#D5F1F0; --act-q2:#A8E2E0; --act-q3:#74CFCC; --act-q4:#3DBAB7;
  --act-q5:#0FA3A0; --act-q6:#0B8784; --act-q7:#086D6B;
}
html[data-ui="v2"].dark .fx-page--activity{
  --act-s0:#5d6880; --act-s1:#2FB5B2; --act-s2:#d95926; --act-s3:#3987e5; --act-s4:#c98500;
  --act-s5:#d55181; --act-s6:#008300; --act-s7:#9085e9; --act-s8:#e66767;
  --act-q1:#0C3C3B; --act-q2:#0B5654; --act-q3:#0B706E; --act-q4:#0B8784; --act-q5:#0FA3A0; --act-q6:#3DBAB7; --act-q7:#74CFCC;
}
html[data-ui="v2"] .fx-act-tile{position:relative;overflow:hidden}
html[data-ui="v2"] .fx-act-spark{display:block;inline-size:100%;block-size:28px;margin-block-start:var(--fx-space-2)}
html[data-ui="v2"] .fx-act-spark polyline{fill:none;stroke-width:2;vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round}
html[data-ui="v2"] .fx-act-mark{transition:opacity var(--fx-dur-fast) var(--fx-ease-out),filter var(--fx-dur-fast) var(--fx-ease-out)}
html[data-ui="v2"] .fx-act-mark.is-hot{filter:brightness(1.12) saturate(1.1)}
html[data-ui="v2"] .fx-act-donut{margin:0}
html[data-ui="v2"] .fx-act-donut svg{display:block;inline-size:100%;max-inline-size:440px;margin-inline:auto;block-size:auto}
html[data-ui="v2"] .fx-act-donut path{stroke:var(--fx-surface);stroke-width:3;stroke-linejoin:round}
html[data-ui="v2"] .fx-act-donut__total{text-anchor:middle;font-size:34px;font-weight:700;fill:var(--fx-text)}
html[data-ui="v2"] .fx-act-donut__sub{text-anchor:middle;font-size:14px;fill:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-legend{list-style:none;margin:0;padding:0;display:grid;gap:var(--fx-space-3)}
html[data-ui="v2"] .fx-act-legend__row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:var(--fx-space-1) var(--fx-space-3);align-items:center}
html[data-ui="v2"] .fx-act-swatch{position:relative;inline-size:28px;block-size:28px;border-radius:8px;grid-row:span 2}
html[data-ui="v2"] .fx-act-legend__name{font-weight:var(--fx-weight-semibold);font-size:var(--fx-text-sm)}
html[data-ui="v2"] .fx-act-legend__num{font-weight:var(--fx-weight-semibold);font-variant-numeric:tabular-nums;text-align:end;font-size:var(--fx-text-sm)}
html[data-ui="v2"] .fx-act-legend__num small,html[data-ui="v2"] .fx-act-funnel__num small{display:block;color:var(--fx-text-muted);font-weight:var(--fx-weight-regular);font-size:var(--fx-text-xs)}
html[data-ui="v2"] .fx-act-legend__track{grid-column:2 / -1;block-size:4px;border-radius:var(--fx-radius-pill);background:var(--fx-surface-sunken);overflow:hidden}
html[data-ui="v2"] .fx-act-legend__track span{display:block;block-size:100%;border-radius:inherit}
html[data-ui="v2"] .fx-act-crown{display:inline-grid;place-items:center;color:#fff}
html[data-ui="v2"] .fx-act-swatch .fx-act-crown{position:absolute;inset-block-start:-7px;inset-inline-start:-7px;inline-size:18px;block-size:18px;border-radius:50%;box-shadow:0 0 0 2px var(--fx-surface)}
html[data-ui="v2"] .fx-act-crown--1{background:var(--ft-gold)}
html[data-ui="v2"] .fx-act-crown--2{background:#8d96a3}
html[data-ui="v2"] .fx-act-crown--3{background:#b07a4f}
html[data-ui="v2"] .fx-act-keys{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:var(--fx-space-2) var(--fx-space-4);font-size:var(--fx-text-xs);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-keys li{display:inline-flex;align-items:center;gap:6px}
html[data-ui="v2"] .fx-act-key{inline-size:10px;block-size:10px;border-radius:3px}
html[data-ui="v2"] .fx-act-board{list-style:none;margin:0;padding:0;display:grid;gap:var(--fx-space-4)}
html[data-ui="v2"] .fx-act-board__row{display:grid;grid-template-columns:28px minmax(0,1fr) auto;gap:var(--fx-space-1) var(--fx-space-3);align-items:center}
html[data-ui="v2"] .fx-act-board__rank{grid-row:span 2;inline-size:26px;block-size:26px;border-radius:50%;display:grid;place-items:center;font-size:var(--fx-text-xs);font-weight:var(--fx-weight-semibold);color:var(--fx-text-muted);background:var(--fx-surface-sunken)}
html[data-ui="v2"] .fx-act-board__rank.fx-act-crown{color:#fff}
html[data-ui="v2"] .fx-act-board__rank.fx-act-crown--1{background:var(--ft-gold)}
html[data-ui="v2"] .fx-act-board__rank.fx-act-crown--2{background:#8d96a3}
html[data-ui="v2"] .fx-act-board__rank.fx-act-crown--3{background:#b07a4f}
html[data-ui="v2"] .fx-act-board__name{display:grid;min-inline-size:0;font-weight:var(--fx-weight-semibold);font-size:var(--fx-text-sm)}
html[data-ui="v2"] .fx-act-board__name small{font-weight:var(--fx-weight-regular);color:var(--fx-text-muted);font-size:var(--fx-text-xs);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html[data-ui="v2"] .fx-act-board__total{font-variant-numeric:tabular-nums;font-weight:var(--fx-weight-bold)}
html[data-ui="v2"] .fx-act-board__bar{grid-column:2 / -1;display:flex;gap:2px;block-size:10px}
html[data-ui="v2"] .fx-act-board__bar span{display:block;block-size:100%;border-radius:3px;min-inline-size:3px}
html[data-ui="v2"] .fx-act-columns svg{display:block;inline-size:100%;block-size:auto}
html[data-ui="v2"] .fx-act-gridline{stroke:var(--fx-border);stroke-width:1}
html[data-ui="v2"] line.fx-act-gridline--base{stroke:var(--fx-border-strong)}
html[data-ui="v2"] .fx-act-axis{font-size:11px;fill:var(--fx-text-muted);font-variant-numeric:tabular-nums}
html[data-ui="v2"] .fx-act-hit{fill:transparent}
html[data-ui="v2"] .fx-act-hit.is-hot{fill:var(--fx-text);fill-opacity:.06}
html[data-ui="v2"] .fx-act-funnel{list-style:none;margin:0;padding:0;display:grid;gap:var(--fx-space-1)}
html[data-ui="v2"] .fx-act-funnel__kept{display:block;font-size:var(--fx-text-xs);color:var(--fx-text-muted);padding-inline-start:9.5rem}
html[data-ui="v2"] .fx-act-funnel__row{display:grid;grid-template-columns:9rem minmax(0,1fr) 3.5rem;gap:var(--fx-space-3);align-items:center}
html[data-ui="v2"] .fx-act-funnel__name{font-size:var(--fx-text-sm)}
html[data-ui="v2"] .fx-act-funnel__bar{display:flex;justify-content:center;block-size:30px;background:var(--fx-surface-sunken);border-radius:6px}
html[data-ui="v2"] .fx-act-funnel__bar span{display:block;block-size:100%;border-radius:6px}
html[data-ui="v2"] .fx-act-funnel__num{text-align:end;font-weight:var(--fx-weight-semibold);font-variant-numeric:tabular-nums}
html[data-ui="v2"] .fx-act-clock{margin:0;display:grid;gap:var(--fx-space-2);justify-items:center}
html[data-ui="v2"] .fx-act-clock svg{inline-size:100%;max-inline-size:380px;block-size:auto}
html[data-ui="v2"] .fx-act-clock__big{text-anchor:middle;font-size:30px;font-weight:700;fill:var(--fx-text)}
html[data-ui="v2"] .fx-act-clock__sub{text-anchor:middle;font-size:13px;fill:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-ramp{display:flex;align-items:center;justify-content:center;gap:3px;font-size:var(--fx-text-xs);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-ramp i{inline-size:18px;block-size:10px;border-radius:2px}
html[data-ui="v2"] .fx-act-ramp span{margin-inline:6px}
html[data-ui="v2"] .fx-act-tree{position:relative;aspect-ratio:600 / 260;inline-size:100%}
html[data-ui="v2"] .fx-act-tree svg{position:absolute;inset:0;inline-size:100%;block-size:100%}
html[data-ui="v2"] .fx-act-tree__label{position:absolute;padding:8px 10px;color:#fff;font-size:var(--fx-text-xs);line-height:1.3;pointer-events:none;overflow:hidden}
html[data-ui="v2"] .fx-act-tree__label b{display:block;font-size:var(--fx-text-lg)}
.fx-act-tip{position:fixed;z-index:var(--fx-z-toast,90);pointer-events:none;padding:6px 10px;border-radius:8px;font-size:13px;font-weight:600;
  background:var(--ft-navy);color:#f3f6fb;box-shadow:0 6px 20px rgba(0,0,0,.25);white-space:nowrap;max-inline-size:90vw}
@media (max-width: 640px){
  html[data-ui="v2"] .fx-act-funnel__row{grid-template-columns:6.5rem minmax(0,1fr) 3rem}
  html[data-ui="v2"] .fx-act-funnel__kept{padding-inline-start:7rem}
  html[data-ui="v2"] .fx-act-tree{aspect-ratio:600 / 360}
}
@media (prefers-reduced-motion: reduce){html[data-ui="v2"] .fx-act-mark{transition:none}}
html[data-ui="v2"] .fx-act-auto{margin:0;padding:var(--fx-space-3) var(--fx-space-4);border-radius:var(--fx-radius-md);background:var(--fx-surface-sunken);font-size:var(--fx-text-sm);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-auto b{color:var(--fx-text);font-size:var(--fx-text-lg);margin-inline-end:4px}
html[data-ui="v2"] .fx-act-btngroups{display:grid;gap:var(--fx-space-2)}
html[data-ui="v2"] .fx-act-btngroup{border:1px solid var(--fx-border);border-radius:var(--fx-radius-md);background:var(--fx-surface)}
html[data-ui="v2"] .fx-act-btngroup > summary{display:flex;justify-content:space-between;gap:var(--fx-space-3);align-items:center;padding:var(--fx-space-3) var(--fx-space-4);cursor:pointer;font-weight:var(--fx-weight-semibold)}
html[data-ui="v2"] .fx-act-btngroup > summary:focus-visible{outline:2px solid var(--fx-ring);outline-offset:2px}
html[data-ui="v2"] .fx-act-btngroup__meta{font-weight:var(--fx-weight-regular);font-size:var(--fx-text-sm);color:var(--fx-text-muted)}
html[data-ui="v2"] .fx-act-btngroup__meta b{color:var(--fx-text)}
html[data-ui="v2"] .fx-act-btngroup .fx-rank{padding:0 var(--fx-space-4) var(--fx-space-4)}


/* Centered page heads (users, AI usage, activity, setup): title and description
   centered; the back link stays at the start edge; the create button centers. */
html[data-ui="v2"] .fx-page--users .fx-users-head{grid-template-columns:minmax(0,1fr)}
html[data-ui="v2"] .fx-page--users .fx-users-head__lead{justify-items:center;text-align:center}
html[data-ui="v2"] .fx-page--users .fx-create{grid-column:1;justify-self:center}
html[data-ui="v2"] .fx-page--usage .fx-usage-head__lead,
html[data-ui="v2"] .fx-page--setup .fx-setup-head{justify-items:center;text-align:center}
html[data-ui="v2"] .fx-page--activity .fx-usage-head :is(.fx-title,.fx-lede){text-align:center}
html[data-ui="v2"] .fx-page--users .fx-users-head__lead .fx-lede,
html[data-ui="v2"] .fx-page--usage .fx-usage-head__lead .fx-lede,
html[data-ui="v2"] .fx-page--activity .fx-usage-head .fx-lede,
html[data-ui="v2"] .fx-page--setup .fx-setup-head .fx-lede{max-inline-size:60ch;margin-inline:auto}
