/* The gym portal's fixes and upgrades (5 Nov, one PR; USE_GYM_FIXES in js/core/flags.js, html.uf-gym-fixes). Every rule sits
   under html.uf-gym-fixes and the portal (:not([data-skin])), so with the switch off the portal is exactly as before.
   One section per item of the prompt; RTL beside the rule it mirrors. */

/* 1.2 Month pills (Targets > PT team and Sales team, .mchips): the chosen month kept the old filled look's white amount on
   the light tint, so it could not be read; one dot only (no ring for the chosen month), inset from the rounded corner */
html.uf-gym-fixes:not([data-skin]) .mchip.on small{color:var(--ink-2)}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) .p3sl-mchips .mchip.on{color:var(--p3-link)}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) .p3sl-mchips .mchip.on b{font-weight:600}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) .p3sl-mchips .mchip.on small{color:var(--p3-text)}
html.uf-gym-fixes:not([data-skin]) .mchip i{top:8px;inset-inline-end:8px}
html.uf-gym-fixes:not([data-skin]) .mchip.on i.ok,html.uf-gym-fixes:not([data-skin]) .mchip.on i.part{box-shadow:none}

/* 1.3 Permissions matrix (Settings > Permissions, table.pmx) and every Settings table: Settings forced overflow-x:auto on
   its table wrappers, which made each wrapper the header's scroll box, so the header row (sticky 56 px from the top for the
   window's bar) sat 56 px down inside its own box, over the first rows ("Finance mgr" under Summary). A table that fits
   lets the page scroll it and its header sticks under the top bar; a wider one scrolls inside a box with its header on
   top. The header cells take the page's background, so rows never show through them. */
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) :is(.p3-set-body,.p3-perms) .tbl-wrap.fits:not(.imp-grid):not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){overflow:visible}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) :is(.p3-set-body,.p3-perms) .tbl-wrap.fits:not(.imp-grid) .tbl th:not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){position:sticky;top:var(--p3-top-h,56px);z-index:3;background:var(--p3-bg)}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) :is(.p3-set-body,.p3-perms) .tbl-wrap:not(.fits):not(.imp-grid):has(>table.pmx):not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){max-height:calc(100vh - var(--p3-top-h,56px) - 48px);max-height:calc(100dvh - var(--p3-top-h,56px) - 48px);overflow:auto}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) :is(.p3-set-body,.p3-perms) .tbl-wrap:not(.fits) .tbl th:not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){position:sticky;top:0;z-index:3;background:var(--p3-bg)}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) .p3-perms table.pmx th:first-child:not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){inset-inline-start:0;z-index:4}
html.uf-gym-fixes.pages-v3.portal-v3:not([data-skin]) .p3-perms table.pmx thead th:not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){height:auto;padding-block:10px;vertical-align:bottom;box-shadow:inset 0 -1px 0 var(--p3-line)}

/* 1.4 Count stock (Retail > Count stock, StockCount): the name and "Recorded X" stack in their own column, which takes the
   room the counted field leaves; every row is the same height; the list scrolls inside the dialog when it is long */
html.uf-gym-fixes:not([data-skin]) .sc-list{display:flex;flex-direction:column;max-height:min(52vh,480px);overflow-y:auto;overscroll-behavior:contain;margin-inline:-4px;padding-inline:4px;border-top:1px solid var(--line)}
html.uf-gym-fixes:not([data-skin]) .sc-row{display:grid;grid-template-columns:minmax(0,1fr) 112px;align-items:center;gap:12px;min-height:64px;padding-block:8px;border-bottom:1px solid var(--line)}
html.uf-gym-fixes:not([data-skin]) .sc-name{display:flex;flex-direction:column;gap:2px;min-width:0}
html.uf-gym-fixes:not([data-skin]) .sc-name b{overflow:hidden;font-weight:500;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere}
html.uf-gym-fixes:not([data-skin]) .sc-name small{line-height:1.3;white-space:nowrap}
html.uf-gym-fixes:not([data-skin]) .sc-row .sc-in{width:100%;min-width:0;text-align:end}

/* 1.5 Every dialog (New season and the rest): the body is a scrolling column, and its fields allow min-height 0, so a body
   taller than the dialog squeezed its children onto each other (the Name field under Start date, the season warning over
   "Extra prize for the top 3") instead of scrolling. The children keep their height; the body scrolls. */
html.uf-gym-fixes:not([data-skin]) :is(.modal,.sheet)>.sheet-bd>*:not(#p1):not(#p2):not(#p3):not(#p4){flex-shrink:0}
html.uf-gym-fixes:not([data-skin]) :is(.modal,.sheet)>.sheet-bd>.note:not(#p1):not(#p2):not(#p3):not(#p4){margin:0}

/* 1.6 Point of sale: "Charge SAR 4,000.30" touched the button's edges. Keep open takes its own width, Charge the rest, and
   the amount drops under "Charge" when the two do not fit on one line, at every width; the points are one switch row */
html.uf-gym-fixes:not([data-skin]) .two.pos-acts:not(#p1):not(#p2):not(#p3):not(#p4){display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:stretch}
html.uf-gym-fixes:not([data-skin]) .two.pos-acts>.btn:not(#p1):not(#p2):not(#p3):not(#p4){width:auto;min-width:0}
html.uf-gym-fixes:not([data-skin]) .btn.pos-charge:not(#p1):not(#p2):not(#p3):not(#p4){display:flex;flex-wrap:wrap;align-items:center;justify-content:center;column-gap:.35em;row-gap:0;height:auto;min-height:48px;padding:6px 16px;line-height:1.2;white-space:normal;text-align:center}
html.uf-gym-fixes:not([data-skin]) .btn.pos-charge>*{white-space:nowrap}
html.uf-gym-fixes:not([data-skin]) .pos-pts{padding-block:4px}

/* 1.9 A chart with fewer than 3 points (XbFewPoints, components/charts.js): the value large, its change, and the note */
html.uf-gym-fixes:not([data-skin]) .xb-few{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:4px;min-height:120px;padding:16px 4px}
html.uf-gym-fixes:not([data-skin]) .xb-few-v{color:var(--ink);font-size:40px;font-weight:400;line-height:1.05;font-variant-numeric:tabular-nums}
html.uf-gym-fixes:not([data-skin]) .xb-few-d{font-size:13px;font-weight:500;color:var(--ink-3)}
html.uf-gym-fixes:not([data-skin]) .xb-few-d.up{color:var(--ink-2)}
html.uf-gym-fixes:not([data-skin]) .xb-few-d.down{color:var(--ink-2)}
html.uf-gym-fixes:not([data-skin]) .xb-few-w{font-size:13px;color:var(--ink-3)}
html.uf-gym-fixes:not([data-skin]) .xb-few-n{margin-top:4px;font-size:13px;color:var(--ink-3)}
/* 1.7 the usual range's name sits in a key under the chart, never on the line */
html.uf-gym-fixes.charts-v3:not([data-skin]) .cv3-bandkey{margin-top:6px}
html.uf-gym-fixes.charts-v3:not([data-skin]) .cv3-bandsw{display:inline-block;width:14px;height:10px;border-radius:3px;background:var(--cv3-tint);box-shadow:inset 0 0 0 1px var(--p3-line)}

/* ================= phase 3: the Dashboard (USE_DASH_V4, html.uf-dash-v4) ================= */
/* the usual range behind a bar (Cv3BarChart ranges: the next 7 days) */
html.uf-dash-v4.charts-v3:not([data-skin]) .cv3-range{fill:var(--cv3-tint)}
/* 3.3 the check-ins card: today's total, then the active members under it */
html.uf-dash-v4.pages-v3:not([data-skin]) .p3-dash-cihd{display:flex;flex-direction:column;gap:2px;margin:0 0 8px}
html.uf-dash-v4.pages-v3:not([data-skin]) .p3-dash-cihd b{color:var(--p3-text);font-size:28px;font-weight:400;line-height:1.1;font-variant-numeric:tabular-nums}
html.uf-dash-v4.pages-v3:not([data-skin]) .p3-dash-cihd span{color:var(--p3-muted);font-size:13px;line-height:18px}
html.uf-dash-v4.pages-v3:not([data-skin]) .p3-dash-cihd button{all:unset;cursor:pointer;color:var(--p3-link);font-size:13px;line-height:18px}
html.uf-dash-v4.pages-v3:not([data-skin]) .p3-dash-cihd button:focus-visible{outline:2px solid var(--p3-primary);outline-offset:2px;border-radius:4px}
html.uf-dash-v4.pages-v3:not([data-skin]) .p3-dash-merged{display:flex;flex-direction:column;gap:24px;min-width:0}
/* 3.5 "How this works" (XbHow): a quiet disclosure under a section title */
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-how{margin-top:6px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-how-t{display:inline-flex;align-items:center;gap:6px;min-height:32px;padding:0;border:0;background:none;color:var(--p3-link);font:inherit;font-size:13px;font-weight:500;cursor:pointer}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-how-t:focus-visible{outline:2px solid var(--p3-primary);outline-offset:2px;border-radius:4px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-how.open .xb-how-c{transform:rotate(180deg)}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-how-b{display:grid;gap:8px;margin:6px 0 0;padding:12px 14px;border:1px solid var(--p3-line);border-radius:12px;background:var(--p3-surface);max-width:640px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-how-b dt{color:var(--p3-text);font-size:13px;font-weight:600}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-how-b dd{margin:2px 0 0;color:var(--p3-muted);font-size:13px;line-height:19px}
/* 3.4 Client progress (gprogress) */
html.uf-dash-v4.pages-v3:not([data-skin]) .p3-pg{display:flex;flex-direction:column;gap:24px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-hero{display:flex;flex-direction:column;align-items:flex-start;gap:8px;min-width:0}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-hero .xb-how{align-self:stretch}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-big b{font-size:48px;font-weight:400;line-height:1;font-variant-numeric:tabular-nums;color:var(--p3-text)}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-big small{margin-inline-start:4px;color:var(--p3-muted);font-size:15px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-hw{display:flex;flex-direction:column;gap:2px;min-width:0}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-expl{display:flex;flex-direction:column;gap:12px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-parts{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-part{display:flex;flex-direction:column;gap:4px;padding:12px;border:1px solid var(--p3-line);border-radius:12px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:24px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-tbl{display:flex;flex-direction:column;gap:12px;min-width:0}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-sc small{color:var(--p3-muted);font-size:12px}
html.uf-dash-v4.pages-v3:not([data-skin]) .xb-pg-link{display:flex;justify-content:flex-end}

/* ================= phase 4: tasks and incidents (USE_GYM_TASKS, html.uf-gym-tasks) ================= */
html.uf-gym-tasks:not([data-skin]) .xbt-two{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
@media (max-width:480px){html.uf-gym-tasks:not([data-skin]) .xbt-two{grid-template-columns:minmax(0,1fr)}}
html.uf-gym-tasks:not([data-skin]) .xbt-notes{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;max-height:240px;overflow-y:auto}
html.uf-gym-tasks:not([data-skin]) .xbt-notes li{display:flex;flex-direction:column;gap:2px;padding:8px 10px;border-inline-start:2px solid var(--line);background:var(--surface-2);border-radius:8px}
html.uf-gym-tasks:not([data-skin]) .xbt-add{display:flex;align-items:flex-end;gap:8px}
html.uf-gym-tasks:not([data-skin]) .xbt-add>.field{flex:1;min-width:0}

/* ================= phase 5: memberships (USE_MEM_V2, html.uf-mem-v2) ================= */
/* the Renewals view of Leads: one row per member, who and why on the start side, assign and the actions on the end side */
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn{display:flex;flex-direction:column;gap:12px}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn-list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;min-height:64px;padding:10px 0;border-bottom:1px solid var(--p3-line)}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn-row:last-child{border-bottom:0}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn-who{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 280px}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn-who b{font-weight:500}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn-act{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-rn-act .stat-sel{max-width:200px}
/* Renew membership at the till */
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-pos-rn{display:flex;justify-content:flex-end;margin-bottom:12px}
html.uf-mem-v2.pages-v3:not([data-skin]) .xb-pos-rn .btn-sm{display:inline-flex;align-items:center;gap:6px}

/* ================= phase 6: classes and rooms (USE_CLASS_V2, html.uf-class-v2) ================= */
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm{display:flex;flex-direction:column;gap:12px;min-width:0}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-t td,html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-t th{white-space:nowrap}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-all td{border-top:1px solid var(--p3-line)}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-bar{display:flex;width:160px;height:10px;overflow:hidden;border-radius:5px;background:var(--p3-tint)}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-bar i.done,html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-key i.done{background:var(--p3-primary)}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-bar i.left,html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-key i.left{background:var(--p3-tint-line)}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-key{display:flex;flex-wrap:wrap;gap:6px 16px;color:var(--p3-muted);font-size:13px}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-key span{display:inline-flex;align-items:center;gap:6px}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rm-key i{width:12px;height:10px;border-radius:3px;background:var(--p3-tint)}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rmw{display:flex;flex-direction:column;gap:8px;padding-top:8px;border-top:1px solid var(--p3-line)}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rmw-h{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px}
html.uf-class-v2.pages-v3:not([data-skin]) .xb-rmw .rg-h.on b{color:var(--p3-link)}

/* ================= phase 7: retail (USE_RETAIL_V2, html.uf-retail-v2) ================= */
html.uf-retail-v2.pages-v3:not([data-skin]) .p3-rt-old{color:var(--warn);font-weight:500}

/* ================= phase 8: loyalty and targets (USE_LOYAL_V2, html.uf-loyal-v2) ================= */
html.uf-loyal-v2.pages-v3:not([data-skin]) .xb-tm{display:flex;flex-direction:column;gap:16px;min-width:0}
html.uf-loyal-v2.pages-v3:not([data-skin]) .xb-tm-sec{display:flex;flex-direction:column;gap:8px;min-width:0}
html.uf-loyal-v2.pages-v3:not([data-skin]) .xb-tm-all td{border-top:1px solid var(--p3-line)}
html.uf-loyal-v2.pages-v3:not([data-skin]) .xb-ch-note{margin:0}
/* 1.3, every page: a table that fits its card lets the page scroll it (its header sticks under the top bar, page-fixes.css),
   whatever card or page rule set its wrapper to scroll sideways; a wider table keeps scrolling inside its wrapper */
@media (min-width:1100px){
  html.uf-gym-fixes.shell-v3:not([data-skin]) .gym.p3 main .tbl-wrap.fits:not(.imp-grid):not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){overflow:visible}
  /* a card that hides its overflow is a scroll box too, so the header stuck 56 px down inside it; clip draws the same edge
     without being one */
  html.uf-gym-fixes.shell-v3:not([data-skin]) .gym.p3 main :is(.p3-card,.card):has(.tbl-wrap.fits:not(.imp-grid)):not(#p1):not(#p2):not(#p3):not(#p4):not(#p5){overflow:clip}
}
