/* ============================================================
   Gym Admin Theme — Manaret Amman
   Drop-in stylesheet. Load AFTER Bootstrap.
   All components are class-based: no inline styles needed.
   RTL and LTR safe (logical properties only).
   ============================================================ */

/* ---------- 1. Tokens ---------- */

:root {
  --bg:    oklch(0.968 0.006 265);
  --sf:    oklch(0.995 0.002 265);
  --sf2:   oklch(0.965 0.007 265);
  --bd:    oklch(0.915 0.008 265);
  --ink:   oklch(0.25 0.02 265);
  --ink2:  oklch(0.50 0.017 265);
  --ink3:  oklch(0.50 0.016 265);
  --ac:    oklch(0.55 0.2 265);
  --acs:   oklch(0.95 0.035 265);
  --ok:    oklch(0.58 0.15 160);
  --oks:   oklch(0.95 0.04 160);
  --warn:  oklch(0.70 0.16 70);
  --warns: oklch(0.95 0.055 70);
  --dgr:   oklch(0.57 0.2 22);
  --dgrs:  oklch(0.95 0.04 22);
  --shdw:  oklch(0.3 0.03 265 / 0.14);

  --r-pill: 7px;
  --r-ctl: 10px;
  --r-tile: 13px;
  --r-card: 18px;

  --font-body: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-head: 'Noto Kufi Arabic', var(--font-body);
}

[data-theme="dark"] {
  --bg:    oklch(0.185 0.018 265);
  --sf:    oklch(0.235 0.021 265);
  --sf2:   oklch(0.285 0.024 265);
  --bd:    oklch(0.34 0.025 265);
  --ink:   oklch(0.965 0.004 265);
  --ink2:  oklch(0.78 0.014 265);
  --ink3:  oklch(0.72 0.018 265);
  --ac:    oklch(0.74 0.16 265);
  --acs:   oklch(0.33 0.07 265);
  --ok:    oklch(0.78 0.16 160);
  --oks:   oklch(0.31 0.06 160);
  --warn:  oklch(0.83 0.15 80);
  --warns: oklch(0.35 0.08 70);
  --dgr:   oklch(0.72 0.18 22);
  --dgrs:  oklch(0.33 0.08 22);
  --shdw:  oklch(0.08 0.02 265 / 0.6);
}

/* Per-index hue for tiles and avatars. Apply gx-h1 … gx-h6. */
.gx-h1 { --hue: 265; } /* indigo  */
.gx-h2 { --hue: 195; } /* cyan    */
.gx-h3 { --hue: 160; } /* green   */
.gx-h4 { --hue: 75;  } /* amber   */
.gx-h5 { --hue: 25;  } /* red     */
.gx-h6 { --hue: 320; } /* magenta */

/* ---------- 2. Base ---------- */

body.gx {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
}

body.gx * { box-sizing: border-box; }

/* Bootstrap resets — these are what made the port look generic */
body.gx .card,
body.gx .table,
body.gx .btn,
body.gx .form-control,
body.gx .form-select {
  all: unset;
  box-sizing: border-box;
  font-family: inherit;
}

/* Only unclassed links get the accent colour. A component class must always
   win over this rule, so keep the :not([class]) guard. */
body.gx a:not([class]) { color: var(--ac); text-decoration: none; }
body.gx a:not([class]):hover { color: var(--ac); text-decoration: underline; }
body.gx a[class] { text-decoration: none; }
body.gx a[class]:hover { text-decoration: none; }

/* Icon font helper */
.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-size: 20px;
}
.ms-sm { font-size: 17px; }
.ms-xs { font-size: 14px; }

.gx-num { font-variant-numeric: tabular-nums; }
.gx-ltr { direction: ltr; }

body.gx ::-webkit-scrollbar { width: 9px; height: 9px; }
body.gx ::-webkit-scrollbar-thumb { background: var(--bd); border-radius: 9px; }
body.gx ::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. Shell ---------- */

.gx-shell { display: flex; min-height: 100vh; }

.gx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.gx-page {
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- 4. Header ---------- */

.gx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: var(--sf);
  border-bottom: 1px solid var(--bd);
}

.gx-header-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.gx-header-sub { font-size: 12.5px; color: var(--ink3); }

.gx-header-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Small info chip (weather, license, etc.) */
.gx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink2);
  background: var(--sf2);
  border: 1px solid var(--bd);
  padding: 8px 12px;
  border-radius: 11px;
  white-space: nowrap;
}
.gx-chip .ms { color: var(--ink3); }
.gx-chip-warn .ms { color: var(--warn); }

/* Segmented control (language, old/new) */
.gx-seg {
  display: inline-flex;
  gap: 3px;
  background: var(--sf2);
  border: 1px solid var(--bd);
  padding: 3px;
  border-radius: 11px;
}
.gx-seg > button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink2);
}
.gx-seg > button.is-on { background: var(--ac); color: #fff; }

.gx-user { display: flex; align-items: center; gap: 9px; }
.gx-user-name { font-size: 13px; font-weight: 600; }
.gx-user-role { font-size: 11px; color: var(--ink3); }
.gx-divider-v { width: 1px; height: 26px; background: var(--bd); }

/* ---------- 5. Main buttons (KPI tiles) ---------- */

.gx-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 11px;
}

.gx-tile {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 15px;
  text-decoration: none;
  color: inherit;
  transition: transform .16s ease, box-shadow .16s ease;
}
.gx-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px var(--shdw);
  text-decoration: none;
  color: inherit;
}

/* decorative halo */
.gx-tile::after {
  content: "";
  position: absolute;
  inset-inline-end: -30px;
  top: -30px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: oklch(0.93 0.05 var(--hue) / 0.7);
}
[data-theme="dark"] .gx-tile::after { background: oklch(0.42 0.09 var(--hue) / 0.28); }

.gx-tile-icon {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--r-tile);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(140deg,
    oklch(0.64 0.19 var(--hue)),
    oklch(0.60 0.18 calc(var(--hue) + 22)));
  box-shadow: 0 6px 14px oklch(0.62 0.19 var(--hue) / 0.32);
}
.gx-tile-icon .ms { font-size: 23px; }

.gx-tile-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gx-tile-label {
  font-family: var(--font-head);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
/* The value line. Do not omit it — the tile looks empty without it. */
.gx-tile-value {
  font-size: 12px;
  color: var(--ink2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- 6. Panels ---------- */

/* Asymmetric 2-up grid: dense tables 58%, narrow panels 36% */
.gx-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}
.gx-col-wide   { flex: 1.4 1 58%; min-width: min(100%, 560px); }
.gx-col-narrow { flex: 1   1 36%; min-width: min(100%, 380px); }

.gx-panel {
  display: flex;
  flex-direction: column;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--r-card);
  overflow: hidden;
  width: 100%;
}

/* .gx-panel-body is a bare content wrapper with no padding of its own, so
   whatever sits first inside it (an "Add" button, a .gx-filters card, ...)
   ends up flush against the panel's outer border on every side -- zero
   breathing room. Give the wrapper itself a small inset; a child that
   already sets its own margin inline (e.g. .gx-filters' margin-top, used
   for spacing from a preceding sibling like an Add button) simply adds to
   this, since this is edge-of-container padding, not between-sibling
   spacing -- not a conflict. */
.gx-panel-body { padding: 16px 18px; }

/* .gx-filters only pads its own content -- the space AROUND the card
   depends entirely on its parent. When it's a standalone sibling of
   .gx-panel inside .gx-page, the page's own flex gap already gives it
   consistent spacing on every side, and .gx-panel-body (above) covers the
   case where it's nested inside a panel body. But a few pages instead
   nest .gx-filters directly inside .gx-panel with no .gx-panel-body
   wrapper at all, which (unlike .gx-panel-body) can't just get blanket
   padding -- .gx-panel-head already manages its own padding as a sibling,
   and padding the shared parent would double it up. Inset .gx-filters
   itself in exactly that one case instead. */
.gx-panel > .gx-filters {
  margin: 14px 18px;
}

.gx-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-bottom: 1px solid var(--bd);
}
.gx-panel-head-stack { flex-direction: column; align-items: stretch; gap: 13px; }

.gx-panel-id { display: flex; align-items: center; gap: 11px; min-width: 0; }

.gx-panel-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--r-tile);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(140deg,
    oklch(0.64 0.19 var(--hue)),
    oklch(0.60 0.18 calc(var(--hue) + 22)));
  box-shadow: 0 6px 16px oklch(0.62 0.19 var(--hue) / 0.32);
}
.gx-panel-icon .ms { font-size: 21px; }

.gx-panel-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
}
.gx-panel-sub { font-size: 12px; color: var(--ink3); }

.gx-panel-tools { display: flex; align-items: center; gap: 8px; }

/* Count pill — same gradient as the panel icon */
.gx-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  padding: 5px 15px;
  border-radius: 12px;
  background: linear-gradient(140deg,
    oklch(0.64 0.19 var(--hue)),
    oklch(0.60 0.18 calc(var(--hue) + 22)));
  box-shadow: 0 6px 16px oklch(0.62 0.19 var(--hue) / 0.3);
}
.gx-count-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: oklch(0.92 0.14 150);
}

/* The scroll area. Keeps the table from bleeding out of the card. */
.gx-panel-scroll { flex: 1; overflow-x: auto; overflow-y: auto; }
.gx-panel-scroll-cap { max-height: 404px; }

.gx-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--bd);
  background: var(--sf2);
  font-size: 12px;
  color: var(--ink3);
}

/* ---------- 7. Tables ---------- */

/* .gx-table-wrap had no CSS of its own (unlike its sibling .gx-panel-scroll,
   which already does overflow-x:auto) -- a wide table (many columns, or
   nowrap cells like dates/times) had nowhere to go but push the whole page
   wider instead of scrolling within its own box. Used on 76+ pages, so
   fixing it here covers all of them at once; pages where the table
   already fits are unaffected since overflow-x:auto only engages once
   content actually overflows. */
.gx-table-wrap { overflow-x: auto; }

body.gx table.gx-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: var(--ink);
}

body.gx .gx-table th {
  background: var(--sf2);
  padding: 10px 12px;
  text-align: start;          /* never left/right — RTL depends on this */
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink3);
  border-bottom: 1px solid var(--bd);
  white-space: nowrap;
  vertical-align: middle;
}
body.gx .gx-table th:first-child,
body.gx .gx-table td:first-child { padding-inline-start: 18px; }
body.gx .gx-table th:last-child,
body.gx .gx-table td:last-child  { padding-inline-end: 18px; }

body.gx .gx-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--bd);
  vertical-align: middle;
}
body.gx .gx-table tbody tr:hover { background: var(--sf2); }
body.gx .gx-table tbody tr.is-open { background: var(--sf2); }

/* sticky header for capped tables */
.gx-panel-scroll-cap .gx-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.gx-th-sort { cursor: pointer; user-select: none; }
.gx-th-sort.is-on { color: var(--ac); }
.gx-th-sort .ms { font-size: 14px; vertical-align: -3px; }

.gx-cell-end { text-align: end; }
.gx-cell-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gx-cell-seq { color: var(--ink3); font-variant-numeric: tabular-nums; }

/* Member name cell: link that does NOT look like a browser link */
.gx-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.gx-name:hover { color: var(--ac); text-decoration: none; }
.gx-name-text {
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 1px dashed var(--bd);
}
.gx-name-sub { font-size: 11.5px; color: var(--ink3); font-variant-numeric: tabular-nums; }
.gx-name-stack { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }

/* Row action cluster */
.gx-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

/* ---------- 8. Avatar ---------- */

.gx-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: oklch(0.93 0.045 var(--hue));
  color: oklch(0.43 0.16 var(--hue));
}
[data-theme="dark"] .gx-avatar {
  background: oklch(0.34 0.07 var(--hue));
  color: oklch(0.87 0.1 var(--hue));
}
.gx-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* hide a broken image so the initial underneath shows instead */
.gx-avatar img[data-broken] { display: none; }
.gx-avatar-lg { width: 38px; height: 38px; flex-basis: 38px; border-radius: 12px; font-size: 14px; }

.gx-avatar-dot {
  position: absolute;
  inset-inline-end: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--sf);
}

/* ---------- 9. Pills & badges ---------- */

.gx-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gx-pill-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.gx-pill-ok      { background: var(--oks);  color: color-mix(in oklch, var(--ok) 100%, black 12%); }
.gx-pill-warn    { background: var(--warns);color: color-mix(in oklch, var(--warn) 100%, black 22%); }
.gx-pill-danger  { background: var(--dgrs); color: color-mix(in oklch, var(--dgr) 100%, black 8%); }
.gx-pill-accent  { background: var(--acs);  color: var(--ac); }
.gx-pill-neutral { background: var(--sf2);  color: var(--ink3); }
[data-theme="dark"] .gx-pill-ok     { color: var(--ok); }
[data-theme="dark"] .gx-pill-warn   { color: var(--warn); }
[data-theme="dark"] .gx-pill-danger { color: var(--dgr); }

/* Soft tag (plan name) */
.gx-tag {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--acs);
  color: var(--ac);
  white-space: nowrap;
}

/* Time chip inside a cell */
.gx-timechip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink2);
  background: var(--sf2);
  border-radius: var(--r-pill);
  padding: 3px 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- 10. Buttons ---------- */

body.gx .gx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: filter .14s ease, border-color .14s ease, color .14s ease;
}
body.gx .gx-btn:hover { text-decoration: none; }

.gx-btn-primary { background: var(--ac); color: #fff; }
.gx-btn-primary:hover { filter: brightness(1.08); color: #fff; }

.gx-btn-ok { background: var(--ok); color: #fff; }
.gx-btn-ok:hover { filter: brightness(1.07); color: #fff; }

.gx-btn-secondary {
  background: var(--sf2);
  border-color: var(--bd);
  color: var(--ink2);
}
.gx-btn-secondary:hover { color: var(--ac); border-color: var(--ac); }

.gx-btn-danger {
  background: var(--sf2);
  border-color: var(--bd);
  color: var(--dgr);
}
.gx-btn-danger:hover { border-color: var(--dgr); background: var(--dgrs); color: var(--dgr); }

.gx-btn-sm { font-size: 12.5px; padding: 7px 13px; border-radius: var(--r-ctl); }

/* Square icon button */
body.gx .gx-btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  flex: 0 0 34px;
  border-radius: var(--r-ctl);
}
body.gx .gx-btn-icon-sm { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; }
body.gx .gx-btn-icon-lg { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }

/* ---------- 11. Form controls ---------- */

body.gx .gx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
body.gx .gx-label { font-size: 12px; font-weight: 500; color: var(--ink2); }

body.gx .gx-input,
body.gx .gx-select {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--ink);
  outline: none;
  appearance: none;
}
body.gx .gx-select {
  cursor: pointer;
  color: var(--ink2);
  padding-inline-end: 30px;
  background-image: linear-gradient(45deg, transparent 49%, var(--ink3) 50%),
                    linear-gradient(-45deg, transparent 49%, var(--ink3) 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-repeat: no-repeat;
}
body.gx [dir="rtl"] .gx-select,
body.gx.rtl .gx-select {
  background-position: 16px 55%, 11px 55%;
  padding-inline-end: 12px;
  padding-inline-start: 30px;
}
body.gx .gx-input:focus,
body.gx .gx-select:focus {
  border-color: var(--ac);
  background: var(--sf);
  box-shadow: 0 0 0 3px oklch(0.55 0.2 265 / 0.14);
}
body.gx .gx-input::placeholder { color: var(--ink3); }

/* native date inputs inherit the theme */
body.gx input[type="date"].gx-input { min-height: 38px; }
[data-theme="dark"] body.gx input[type="date"].gx-input::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.7);
}

/* select2 ("searchable" dropdowns, select2.min.js) -- site-wide, so every
   searchable select matches the look of a plain .gx-select wherever it's
   used (previously this reskin only existed scoped to .gx-cal-filter on
   the calendar page, so every other select2 instance -- most report
   filters, package zone pickers, etc. -- fell back to select2's own
   default white/square styling, visibly inconsistent with the rest of
   the filter row it sits in). */
body.gx .select2-container { width: 100% !important; }
body.gx .select2-container--default .select2-selection--single,
body.gx .select2-container--default .select2-selection--multiple {
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: var(--r-ctl);
  min-height: 40px;
}
body.gx .select2-container--default.select2-container--focus .select2-selection--single,
body.gx .select2-container--default.select2-container--open .select2-selection--single,
body.gx .select2-container--default.select2-container--focus .select2-selection--multiple,
body.gx .select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: var(--ac);
  background: var(--sf);
}
body.gx .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--ink);
  line-height: 38px;
  padding-inline-start: 12px;
  padding-inline-end: 30px;
}
body.gx .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--ink3); }
body.gx .select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }
body.gx .select2-container--default .select2-selection--multiple .select2-selection__rendered { padding: 3px 8px; }
body.gx .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--acs);
  border-color: var(--ac);
  color: var(--ac);
  border-radius: 6px;
}
body.gx .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--ac); }
body.gx .select2-dropdown {
  background: var(--sf);
  color: var(--ink);
  border-color: var(--bd);
  border-radius: var(--r-ctl);
  overflow: hidden;
}
body.gx .select2-search--dropdown .select2-search__field {
  background: var(--sf2);
  border: 1px solid var(--bd);
  border-radius: var(--r-ctl);
  color: var(--ink);
  outline: none;
}
body.gx .select2-results__option { color: var(--ink2); }
body.gx .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--ac); color: #fff; }
body.gx .select2-container--default .select2-results__option[aria-selected="true"] { background: var(--sf2); }
body.gx .select2-container--default .select2-selection--single .select2-selection__clear { color: var(--ink3); }

/* Filter bar */
.gx-filters {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gx-filters-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
}
.gx-filters-title .ms { color: var(--ac); font-size: 19px; }
/* The filter form's fields grid and its submit-button row are two separate
   sibling divs in the markup (every page follows this convention: a
   .gx-filters-grid holding the fields, then a .gx-row-wrap holding the
   Search/Reset buttons right after it) -- which used to mean the button(s)
   always dropped to their own line below the fields, even when there was
   plenty of room to sit beside them on the same row. display:contents
   un-wraps both of those container divs for layout purposes only (their
   own box/margin/padding is suppressed, children keep their styling), so
   their children -- the field .gx-field divs and the button(s) -- become
   direct flex items of .gx-filters form itself and flow together as one
   row, wrapping only when the row actually runs out of width. No markup
   change needed on any of the pages using this convention. */
.gx-filters form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 11px; }
.gx-filters-grid { display: contents; }
.gx-filters-grid > * { flex: 1 1 210px; min-width: 0; }
.gx-filters form > .gx-row-wrap { display: contents; }
.gx-filters form > .gx-row-wrap > * { flex: 0 0 auto; }

/* Toggle switch (status column) */
.gx-switch {
  width: 42px;
  height: 23px;
  border-radius: 20px;
  background: var(--bd);
  cursor: pointer;
  padding: 3px;
  display: flex;
  justify-content: flex-start;
  transition: background .15s ease;
  border: 0;
}
.gx-switch.is-on { background: var(--ac); justify-content: flex-end; }
.gx-switch > span {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px oklch(0.3 0.03 265 / 0.3);
}

/* ---------- 12. Empty state ---------- */
/* Use this whenever a table has zero rows. A bare <thead> over blank
   space is what made the ported dashboard look broken. */

.gx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
}
.gx-empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1.5px dashed var(--bd);
  background: var(--sf2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink3);
}
.gx-empty-icon .ms { font-size: 25px; }
.gx-empty-title {
  font-family: var(--font-head);
  font-size: 14.5px;
  font-weight: 600;
  margin: 2px 0 0;
}
.gx-empty-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink3);
  max-width: 340px;
  line-height: 1.7;
}

/* ---------- 13. Loading skeleton ---------- */

@keyframes gx-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.gx-skel {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sf2) 25%, var(--bd) 50%, var(--sf2) 75%);
  background-size: 200% 100%;
  animation: gx-shimmer 1.4s linear infinite;
}
.gx-skel-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--bd);
}

/* ---------- 14. Pagination ---------- */

.gx-pager { display: flex; gap: 5px; align-items: center; }
body.gx .gx-pager-btn {
  font-family: inherit;
  font-size: 12.5px;
  min-width: 32px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--bd);
  background: var(--sf);
  color: var(--ink2);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.gx .gx-pager-btn:hover { color: var(--ac); border-color: var(--ac); text-decoration: none; }
body.gx .gx-pager-btn.is-on { background: var(--ac); border-color: var(--ac); color: #fff; }

/* Laravel's paginator, restyled */
body.gx .pagination { display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
body.gx .pagination .page-link {
  font-size: 12.5px;
  min-width: 32px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--bd);
  background: var(--sf);
  color: var(--ink2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
body.gx .pagination .active .page-link {
  background: var(--ac);
  border-color: var(--ac);
  color: #fff;
}

/* ---------- 15. Dropdown menu ---------- */
/* Must be rendered in a fixed layer OUTSIDE any overflow:auto parent,
   otherwise the scroll container clips it. */

.gx-menu {
  position: fixed;
  z-index: 61;
  width: 250px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 14px;
  box-shadow: 0 16px 40px var(--shdw);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.gx-menu-overlay { position: fixed; inset: 0; z-index: 60; }
.gx-menu-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink3);
  padding: 6px 10px 7px;
}
.gx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: start;
  width: 100%;
}
.gx-menu-item:hover { background: var(--sf2); color: var(--ink); text-decoration: none; }
.gx-menu-item-danger { color: var(--dgr); }
.gx-menu-item-danger:hover { background: var(--dgrs); color: var(--dgr); }
.gx-menu-sep { height: 1px; background: var(--bd); margin: 4px 6px; }

/* Checkbox inside the column picker */
.gx-check {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 6px;
  border: 1.5px solid var(--bd);
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gx-check.is-on { border-color: var(--ac); background: var(--ac); }
.gx-check .ms { font-size: 13px; }
.gx-check:not(.is-on) .ms { display: none; }

.gx-menu-item-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; }
.gx-menu-item-row:hover { background: var(--sf2); }
.gx-menu-item-grow { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; min-width: 0; }
.gx-menu-item-grow > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gx-move { display: flex; gap: 3px; }
body.gx .gx-move > button {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid var(--bd);
  background: var(--sf2);
  color: var(--ink2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
body.gx .gx-move > button:hover { color: var(--ac); border-color: var(--ac); }
body.gx .gx-move .ms { font-size: 15px; }

/* ---------- 16. Payment progress ---------- */

.gx-pay { display: flex; flex-direction: column; gap: 5px; min-width: 104px; }
.gx-pay-nums {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.gx-pay-paid { font-weight: 600; }
.gx-pay-total { color: var(--ink3); font-size: 11.5px; }
.gx-pay-bar { height: 5px; border-radius: 4px; background: var(--sf2); overflow: hidden; }
.gx-pay-fill { height: 100%; border-radius: 4px; background: var(--warn); }
.gx-pay-fill.is-full { background: var(--ok); }

.gx-due { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink3); }
.gx-due.is-owing { color: var(--dgr); }

/* ---------- 17. Bar chart (pure CSS — no chart library) ---------- */
/* A charting lib will not match the theme. Render bars as divs and set
   --h (0–100) per bar from the controller. */

.gx-chart-wrap { padding: 20px 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.gx-chart-summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.gx-chart-total {
  font-family: var(--font-head);
  font-size: 27px;
  font-weight: 700;
}
.gx-chart-total-label { font-size: 12.5px; color: var(--ink3); }
.gx-chart-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ok);
  background: var(--sf2);
  padding: 4px 10px;
  border-radius: 20px;
}

.gx-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 218px;
  padding-top: 8px;
}
.gx-chart-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.gx-chart-val {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink3);
  font-variant-numeric: tabular-nums;
}
.gx-chart-bar {
  width: 100%;
  height: calc(var(--h, 0) * 0.82%);
  min-height: 3px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, oklch(0.62 0.19 265), oklch(0.68 0.16 240));
  transition: height .3s ease;
}
[data-theme="dark"] .gx-chart-bar {
  background: linear-gradient(180deg, oklch(0.72 0.19 265), oklch(0.60 0.16 240));
}
.gx-chart-bar.is-zero { background: var(--sf2); }
.gx-chart-label {
  font-size: 11px;
  color: var(--ink3);
  font-variant-numeric: tabular-nums;
}

/* ---------- 18. Nested panel (member subscriptions) ---------- */

.gx-subrow > td {
  padding: 0 18px 18px !important;
  background: var(--sf2);
}
.gx-subpanel {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 14px;
  overflow: hidden;
}
.gx-subpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-bottom: 1px solid var(--bd);
}
.gx-subpanel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
}
.gx-subpanel-title .ms { color: var(--ac); font-size: 19px; }
.gx-subpanel .gx-table { font-size: 12.5px; }
.gx-subpanel .gx-table th { font-size: 11px; padding: 9px 11px; }
.gx-subpanel .gx-table td { padding: 11px; }

.gx-chev { color: var(--ink3); transition: transform .15s ease; }
.is-open .gx-chev { color: var(--ac); transform: rotate(180deg); }

/* ---------- 19. Sidebar ---------- */

.gx-sidebar {
  width: 270px;
  flex: 0 0 270px;
  background: var(--sf);
  border-inline-end: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  transition: width .18s ease, flex-basis .18s ease;
}
.gx-sidebar.is-collapsed { width: 76px; flex-basis: 76px; }
.gx-sidebar.is-collapsed .gx-sidebar-hide { display: none !important; }
.gx-sidebar.is-collapsed .gx-nav-item { justify-content: center; padding: 10px; }
.gx-sidebar:not(.is-collapsed) .gx-sidebar-show { display: none !important; }

.gx-sidebar-head {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--bd);
}
.gx-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gx-brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--r-tile);
  background: linear-gradient(140deg, oklch(0.62 0.2 265), oklch(0.60 0.19 320));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px oklch(0.58 0.19 285 / 0.38);
}
.gx-brand-name { font-family: var(--font-head); font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.gx-brand-tag { font-size: 10px; letter-spacing: 0.14em; color: var(--ink3); }

.gx-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.gx-nav-group { display: flex; flex-direction: column; gap: 2px; padding-bottom: 4px; }
.gx-nav-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
  cursor: pointer;
  border-radius: 9px;
}
.gx-nav-group-head:hover { background: var(--sf2); }
.gx-nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink3);
  white-space: nowrap;
}
.gx-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 11px;
  text-decoration: none;
  background: transparent;
  color: var(--ink2);
  font-size: 13.5px;
}
.gx-nav-item:hover { background: var(--sf2); color: var(--ink); text-decoration: none; }
.gx-nav-item.is-active { background: var(--ac); color: #fff; font-weight: 600; }
.gx-nav-item .ms { font-size: 21px; flex: 0 0 21px; }
.gx-nav-item-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx-nav-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--acs);
  color: var(--ac);
  border-radius: 20px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.gx-nav-item.is-active .gx-nav-badge { background: #fff; color: var(--ac); }

.gx-sidebar-foot { padding: 10px; border-top: 1px solid var(--bd); }
.gx-nav-item-danger { color: var(--dgr); }
.gx-nav-item-danger:hover { background: var(--dgrs); color: var(--dgr); }

/* Sidebar search */
.gx-nav-search { position: relative; }
.gx-nav-search .ms {
  position: absolute;
  inset-inline-start: 11px;
  top: 9px;
  font-size: 18px;
  color: var(--ink3);
  pointer-events: none;
}
.gx-nav-search .gx-input { padding-inline-start: 36px; border-radius: 11px; }

/* ---------- 20. Footer ---------- */

.gx-footer {
  margin-top: auto;
  padding: 14px 24px;
  background: var(--sf);
  border-top: 1px solid var(--bd);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink3);
}
.gx-footer a { color: var(--ink2); }
.gx-footer a:hover { color: var(--ac); }

/* ---------- 21. Utilities ---------- */

.gx-stack { display: flex; flex-direction: column; }
.gx-stack-tight { display: flex; flex-direction: column; line-height: 1.35; }
.gx-row { display: flex; align-items: center; gap: 8px; }
.gx-row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gx-grow { flex: 1; min-width: 0; }
.gx-muted { color: var(--ink3); }
.gx-ink2 { color: var(--ink2); }
.gx-nowrap { white-space: nowrap; }
.gx-hidden { display: none !important; }

@media print {
  .gx-sidebar, .gx-header-tools, .gx-actions, .gx-pager { display: none !important; }
  .gx-panel { break-inside: avoid; }
}
