/* TOP GYM production stylesheet. */
/* Generated from public/css/main.source.css by npm run build:css. */
/* Edit the layer files, then rebuild; do not edit this artifact manually. */

/* TOP GYM layer: public/css/tokens.css */
:root {
  color-scheme: light;

  /* Core surfaces. Components should consume these semantic roles rather
     than choosing a color for a page or state themselves. */
  --bg-app: #f5f7fb;
  --bg-sidebar: #132238;
  --bg-header: #132238;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fbff;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;

  /* Borders and brand. */
  --border-primary: #d9e2ef;
  --border-secondary: #e7edf5;
  --border-hover: #b9d1f8;
  --primary: #1769e8;
  --primary-hover: #0f56c9;
  --primary-active: #0d47a1;
  --primary-soft: rgb(23 105 232 / 0.1);
  --primary-border: rgb(23 105 232 / 0.24);

  /* Text hierarchy. */
  --text-primary: #172033;
  --text-secondary: #41516a;
  --text-muted: #718096;
  --text-disabled: #98a3b5;
  --text-on-primary: #ffffff;
  --text-primary-soft: #6d28d9;
  --success-text: #0f7a57;
  --danger-text: #b42323;
  --warning-text: #9b6410;
  --info-text: #2454a6;
  --table-header-bg: #f1f5f9;
  --scrollbar-track: #eef3f9;
  --scrollbar-thumb: #cbd7e6;

  /* Semantic status roles. */
  --success: #0f9f6e;
  --success-soft: rgb(15 159 110 / 0.1);
  --success-border: rgb(15 159 110 / 0.25);
  --danger: #d74343;
  --danger-soft: rgb(215 67 67 / 0.1);
  --danger-border: rgb(215 67 67 / 0.25);
  --warning: #bd7604;
  --warning-soft: rgb(189 118 4 / 0.1);
  --warning-border: rgb(189 118 4 / 0.25);
  --info: #2563eb;
  --info-soft: rgb(37 99 235 / 0.1);
  --info-border: rgb(37 99 235 / 0.25);

  --overlay: rgb(2 6 23 / 0.58);
  --shadow-card: 0 8px 24px rgb(15 23 42 / 0.06);
  --shadow-popup: 0 20px 50px rgb(15 23 42 / 0.2);
  --shadow-primary: 0 8px 20px rgb(23 105 232 / 0.18);
  --shadow-primary-strong: 0 8px 20px rgb(23 105 232 / 0.22);
  --text-shadow-soft: 0 4px 16px rgb(0 0 0 / 0.24);
  --text-shadow-strong: 0 5px 18px rgb(0 0 0 / 0.3);

  /* Backward-compatible semantic aliases used by existing page layers. */
  --color-bg: var(--bg-app);
  --color-bg-subtle: #eef3f9;
  --color-surface: var(--bg-surface);
  --color-surface-elevated: var(--bg-elevated);
  --color-surface-muted: var(--bg-card-hover);
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-primary-soft: var(--primary-soft);
  --color-secondary: var(--text-secondary);
  --color-text: var(--text-primary);
  --color-text-soft: var(--text-secondary);
  --color-text-muted: var(--text-muted);
  --color-text-subtle: var(--text-disabled);
  --color-success: var(--success);
  --color-success-soft: var(--success-soft);
  --color-warning: var(--warning);
  --color-warning-soft: var(--warning-soft);
  --color-danger: var(--danger);
  --color-danger-soft: var(--danger-soft);
  --color-info: var(--info);
  --color-info-soft: var(--info-soft);
  --nav-active-bg: var(--primary-soft);
  --nav-active-text: var(--primary);
  --nav-active-border: var(--primary-border);
  --nav-active-shadow: 0 6px 16px rgb(23 105 232 / 0.12);

  /* Sidebar roles. The navigation remains a dark anchor in both themes. */
  --sidebar-bg: var(--bg-sidebar);
  --sidebar-bg-deep: #0b1a2e;
  --sidebar-text: #e6f0ff;
  --sidebar-text-muted: #aebed3;
  --sidebar-border: rgb(166 198 239 / 0.18);
  --sidebar-divider: rgb(166 198 239 / 0.14);
  --sidebar-hover-bg: rgb(255 255 255 / 0.08);
  --sidebar-active-bg: var(--primary);
  --sidebar-active-text: var(--text-on-primary);
  --sidebar-active-shadow: 0 10px 24px rgb(23 105 232 / 0.22);
  --sidebar-width-collapsed: 84px;
  --sidebar-width-expanded: 292px;

  /* Shared member-card and authentication aliases. */
  --color-page: var(--bg-app);
  --color-navy: var(--bg-header);
  --color-pale-blue: var(--primary-soft);
  --color-border-soft: var(--border-secondary);
  --color-warning-strong: var(--warning);
  --color-warning-surface: var(--warning-soft);
  --color-outstanding: var(--danger);
  --border-color: var(--border-primary);
  --border-strong: #cbd7e6;
  --border-focus: #8ab5ff;
  --store-primary: var(--primary);
  --store-primary-dark: var(--primary-hover);
  --store-border: var(--border-primary);
  --store-muted: var(--text-muted);
  --store-text: var(--text-primary);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 40px;
  --space-10: 48px;
  --space-11: 56px;
  --space-12: 64px;

  --font-xs: 0.75rem;
  --font-2xs: 0.6875rem;
  --font-sm: 0.8125rem;
  --font-md: 0.9375rem;
  --font-lg: 1.0625rem;
  --font-xl: 1.375rem;
  --font-2xl: 1.75rem;
  --font-3xl: 2.25rem;
  /* Cairo is the single UI typeface. Numeric fields keep LTR direction and
     tabular figures through typography rules, without switching font family. */
  --font-body: "Cairo", "Tahoma", sans-serif;
  --font-latin: "Cairo", "Tahoma", sans-serif;
  --font-heading: var(--font-body);
  --brand-base-font-size: 16px;
  --brand-radius-base: var(--radius-lg);
  --brand-image-radius: 6px;
  --brand-surface-secondary: var(--bg-surface);
  --brand-login-background: var(--bg-app);
  --brand-login-gradient-start: var(--primary);
  --brand-login-gradient-end: var(--bg-app);
  --brand-login-overlay-opacity: 0.72;
  --brand-login-image: url("/assets/gym-background.webp");
  --brand-name: "Logic Fit";

  /* Public brand contract. Runtime branding overrides these once and the
     existing component aliases keep every page on the same token graph. */
  --brand-primary: var(--primary);
  --brand-primary-hover: var(--primary-hover);
  --brand-primary-active: var(--primary-active);
  --brand-primary-soft: var(--primary-soft);
  --brand-primary-border: var(--primary-border);
  --brand-on-primary: var(--text-on-primary);
  --brand-secondary: var(--text-secondary);
  --brand-accent: var(--primary);
  --brand-background: var(--bg-app);
  --brand-surface: var(--bg-surface);
  --brand-surface-secondary: var(--color-bg-subtle);
  --brand-card-background: var(--bg-card);
  --brand-card-hover: var(--bg-card-hover);
  --brand-elevated: var(--bg-elevated);
  --brand-sidebar: var(--bg-sidebar);
  --brand-header: var(--bg-header);
  --brand-text-primary: var(--text-primary);
  --brand-text-secondary: var(--text-secondary);
  --brand-text-muted: var(--text-muted);
  --brand-text-disabled: var(--text-disabled);
  --brand-border: var(--border-primary);
  --brand-border-secondary: var(--border-secondary);
  --brand-border-hover: var(--border-hover);
  --brand-input-background: var(--bg-input);
  --brand-table-header: var(--table-header-bg);
  --brand-success: var(--success);
  --brand-warning: var(--warning);
  --brand-danger: var(--danger);
  --brand-info: var(--info);
  --brand-overlay: var(--overlay);
  --brand-focus-ring: var(--focus-ring);
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  --shadow-xs: 0 1px 2px rgb(15 23 42 / 0.03);
  --shadow-sm: 0 4px 14px rgb(15 23 42 / 0.05);
  --shadow-md: 0 10px 28px rgb(30 61 104 / 0.08);
  --shadow-lg: 0 18px 48px rgb(30 61 104 / 0.12);
  --focus-ring: 0 0 0 3px rgb(23 105 232 / 0.18);
  --anatomy-canvas-bg: #fafdff;
  --anatomy-selection: #2563eb;
  --anatomy-key-light: #ffffff;
  --anatomy-fill-light: #9fc4ff;
  --anatomy-rim-light: #b8d5ff;
  /* QR modules require a high-contrast paper/ink pair for reliable scans. */
  --qr-ink: #0f172a;
  --qr-paper: #ffffff;

  /* Visual redesign tokens. Components consume these semantic roles instead
     of embedding a page-specific palette. */
  --rf-page: #f4f7fb;
  --rf-surface: #ffffff;
  --rf-surface-raised: #ffffff;
  --rf-surface-soft: #eef3f8;
  --rf-ink: #0b1729;
  --rf-ink-soft: #1d304a;
  --rf-muted: #66758b;
  --rf-line: #d9e3ee;
  --rf-line-soft: #e9eff5;
  --rf-accent: #1976f3;
  --rf-accent-strong: #0758c9;
  --rf-accent-soft: rgb(25 118 243 / .1);
  --rf-teal: #12a99a;
  --rf-shadow-sm: 0 5px 16px rgb(11 23 41 / .055);
  --rf-shadow-md: 0 14px 34px rgb(11 23 41 / .09);
  --rf-shadow-focus: 0 0 0 4px rgb(25 118 243 / .16);
  --rf-radius-card: 18px;
  --rf-radius-control: 11px;

  /* Trainer Studio V2 semantic roles. Kept in the canonical token graph so
     the Vanilla surface does not need a second, page-owned palette. */
  --studio-ink: #142033;
  --studio-muted: #66758b;
  --studio-line: #d9e2ef;
  --studio-surface: #ffffff;
  --studio-surface-soft: #f4f7fb;
  --studio-navy: #102744;
  --studio-brand: #1769e8;
  --studio-brand-strong: #0f56c9;
  --studio-brand-soft: rgb(23 105 232 / .1);
  --studio-brand-border: rgb(23 105 232 / .24);
  --studio-accent: var(--studio-brand);
  --studio-accent-strong: var(--studio-brand-strong);
  --studio-warning: #bd7517;
  --studio-danger: #b44959;

  /* Guided builder accents. The page chooses a mode; the theme owns the
     actual palette so the workflow stays readable in both themes. */
  --builder-diet-accent: #0f766e;
  --builder-diet-accent-strong: #0d9488;
  --builder-diet-soft: rgb(15 159 110 / 0.1);
  --builder-diet-border: rgb(15 159 110 / 0.25);
  --builder-diet-stage-bg: #f0fdfa;
  --builder-workout-accent: #1d4ed8;
  --builder-workout-accent-strong: #2563eb;
  --builder-workout-soft: rgb(37 99 235 / 0.1);
  --builder-workout-border: rgb(37 99 235 / 0.25);
  --builder-workout-stage-bg: #f8fbff;
  --builder-accent: var(--builder-diet-accent);
  --builder-accent-strong: var(--builder-diet-accent-strong);
  --builder-soft: var(--builder-diet-soft);
  --builder-border: var(--builder-diet-border);
  --builder-stage-bg: var(--builder-diet-stage-bg);

  --transition-fast: 150ms ease;
  --transition-normal: 220ms ease;
  --transition-slow: 320ms ease;

  --z-base: 0;
  --z-content: 1;
  --z-sticky: 20;
  --z-dropdown: 40;
  --z-overlay: 80;
  --z-modal: 90;
  --z-toast: 100;
}

html[data-theme="dark"],
body[data-theme="dark"] {
  color-scheme: dark;
  /* Dark Navy + Purple system. Keep enough surface separation to preserve
     depth between the app canvas, cards and overlays. */
  --bg-app: #070d16;
  --bg-sidebar: #09111d;
  --bg-header: #0c1421;
  --bg-surface: #0f1826;
  --bg-card: #111c2b;
  --bg-card-hover: #162235;
  --bg-elevated: #182437;
  --bg-input: #0b1522;
  --border-primary: #243247;
  --border-secondary: #1b293b;
  --border-hover: #35465e;
  --primary: #7c3aed;
  --primary-hover: #8b5cf6;
  --primary-active: #6d28d9;
  --primary-soft: rgb(124 58 237 / 0.14);
  --primary-border: rgb(139 92 246 / 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-disabled: #64748b;
  --text-on-primary: #ffffff;
  --text-primary-soft: #c4b5fd;
  --success-text: #4ade80;
  --danger-text: #fb7185;
  --warning-text: #fbbf24;
  --info-text: #60a5fa;
  --table-header-bg: #0c1624;
  --scrollbar-track: #09111d;
  --scrollbar-thumb: #35465e;
  --success: #22c55e;
  --success-soft: rgb(34 197 94 / 0.13);
  --success-border: rgb(34 197 94 / 0.25);
  --danger: #f43f5e;
  --danger-soft: rgb(244 63 94 / 0.13);
  --danger-border: rgb(244 63 94 / 0.3);
  --warning: #f59e0b;
  --warning-soft: rgb(245 158 11 / 0.13);
  --warning-border: rgb(245 158 11 / 0.25);
  --info: #3b82f6;
  --info-soft: rgb(59 130 246 / 0.13);
  --info-border: rgb(59 130 246 / 0.25);
  --overlay: rgb(2 6 23 / 0.75);
  --shadow-card: 0 8px 24px rgb(0 0 0 / 0.18);
  --shadow-popup: 0 20px 50px rgb(0 0 0 / 0.4);
  --shadow-primary: 0 8px 20px rgb(124 58 237 / 0.18);
  --shadow-primary-strong: 0 8px 20px rgb(124 58 237 / 0.22);
  --text-shadow-soft: 0 4px 16px rgb(0 0 0 / 0.4);
  --text-shadow-strong: 0 5px 18px rgb(0 0 0 / 0.5);

  --color-bg: var(--bg-app);
  --color-bg-subtle: var(--bg-surface);
  --color-surface: var(--bg-surface);
  --color-surface-elevated: var(--bg-elevated);
  --color-surface-muted: var(--bg-card);
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-primary-soft: var(--primary-soft);
  --color-secondary: var(--text-secondary);
  --color-text: var(--text-primary);
  --color-text-soft: var(--text-secondary);
  --color-text-muted: var(--text-muted);
  --color-text-subtle: var(--text-disabled);
  --color-success: var(--success);
  --color-success-soft: var(--success-soft);
  --color-warning: var(--warning);
  --color-warning-soft: var(--warning-soft);
  --color-danger: var(--danger);
  --color-danger-soft: var(--danger-soft);
  --color-info: var(--info);
  --color-info-soft: var(--info-soft);
  --nav-active-bg: var(--primary-soft);
  --nav-active-text: #c4b5fd;
  --nav-active-border: var(--primary-border);
  --nav-active-shadow: 0 8px 20px rgb(124 58 237 / 0.18);
  --sidebar-bg: var(--bg-sidebar);
  --sidebar-bg-deep: #070d16;
  --sidebar-text: #f8fafc;
  --sidebar-text-muted: #94a3b8;
  --sidebar-border: var(--border-primary);
  --sidebar-divider: var(--border-secondary);
  --sidebar-hover-bg: rgb(124 58 237 / 0.1);
  --sidebar-active-bg: var(--primary);
  --sidebar-active-text: #ffffff;
  --sidebar-active-shadow: 0 8px 20px rgb(124 58 237 / 0.18);
  --builder-diet-accent: var(--success);
  --builder-diet-accent-strong: var(--success);
  --builder-diet-soft: var(--success-soft);
  --builder-diet-border: var(--success-border);
  --builder-diet-stage-bg: var(--bg-card);
  --builder-workout-accent: var(--primary);
  --builder-workout-accent-strong: var(--primary-hover);
  --builder-workout-soft: var(--primary-soft);
  --builder-workout-border: var(--primary-border);
  --builder-workout-stage-bg: var(--bg-card);
  --color-page: var(--bg-app);
  --color-navy: var(--bg-header);
  --color-pale-blue: var(--primary-soft);
  --color-border-soft: var(--border-secondary);
  --color-warning-strong: var(--warning);
  --color-warning-surface: var(--warning-soft);
  --color-outstanding: var(--danger);
  --border-color: var(--border-primary);
  --border-strong: var(--border-hover);
  --border-focus: var(--primary-hover);
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.14);
  --shadow-sm: 0 4px 14px rgb(0 0 0 / 0.18);
  --shadow-md: 0 10px 28px rgb(0 0 0 / 0.24);
  --shadow-lg: var(--shadow-popup);
  --focus-ring: 0 0 0 3px rgb(124 58 237 / 0.18);
  --anatomy-canvas-bg: #0b1522;
  --anatomy-selection: #a78bfa;
  --anatomy-key-light: #f8fafc;
  --anatomy-fill-light: #a78bfa;
  --anatomy-rim-light: #7c3aed;
  --qr-ink: #0f172a;
  --qr-paper: #ffffff;
  --rf-page: #070c15;
  --rf-surface: #101a29;
  --rf-surface-raised: #142135;
  --rf-surface-soft: #0c1523;
  --rf-ink: #f5f8fc;
  --rf-ink-soft: #d6e0ee;
  --rf-muted: #91a2b8;
  --rf-line: #26374e;
  --rf-line-soft: #1b2a3d;
  --rf-accent: #5ca8ff;
  --rf-accent-strong: #82bbff;
  --rf-accent-soft: rgb(92 168 255 / .13);
  --rf-teal: #42d3c5;
  --rf-shadow-sm: 0 8px 22px rgb(0 0 0 / .18);
  --rf-shadow-md: 0 18px 42px rgb(0 0 0 / .3);
  --rf-shadow-focus: 0 0 0 4px rgb(92 168 255 / .2);
  --studio-ink: #edf6ff;
  --studio-muted: #9db0c4;
  --studio-line: #26394e;
  --studio-surface: #142438;
  --studio-surface-soft: #102032;
  --studio-navy: #0d1b2b;
  --studio-brand: #62a7ff;
  --studio-brand-strong: #8dc1ff;
  --studio-brand-soft: rgb(98 167 255 / .14);
  --studio-brand-border: rgb(98 167 255 / .32);
  --studio-accent: var(--studio-brand);
  --studio-accent-strong: var(--studio-brand-strong);
  --studio-warning: #f4b84a;
  --studio-danger: #ff8495;
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/reset.css */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--color-bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-md);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
[role="button"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

::selection {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/icons.css */
/* Shared vector icon contract. Keep visual sizes predictable across pages. */
.ui-icon,
.action-icon,
.alert-status-icon,
.coaching-inline-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  overflow: visible;
}

.action-icon {
  width: 17px;
  height: 17px;
}

.alert-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}

.alert-status-icon {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.coaching-inline-icon {
  width: 18px;
  height: 18px;
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/typography.css */
body,
button,
input,
select,
textarea {
  font-family: var(--font-body);
}

body {
  font-size: var(--brand-base-font-size, 16px);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading, var(--font-body));
}

.ltr,
[dir="ltr"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"] {
  direction: ltr;
  text-align: left;
}

.numeric,
[data-numeric="true"] {
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: inherit;
}

.muted,
.text-muted {
  color: var(--color-text-muted);
}

.text-subtle {
  color: var(--color-text-subtle);
}

.text-danger {
  color: var(--color-danger);
}

.text-success {
  color: var(--color-success);
}

.text-warning {
  color: var(--color-warning);
}

.page-title,
.section-title {
  color: var(--color-text);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.02em;
}

.page-title {
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  line-height: 1.25;
}

.section-title {
  font-size: var(--font-xl);
  line-height: 1.35;
}

.eyebrow,
.section-label,
.brand-kicker {
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
}

.page-description,
.section-description {
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

small {
  font-size: var(--font-xs);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/layout.css */
body {
  overflow-x: hidden;
}

.auth-screen {
  min-height: 100vh;
}

.auth-pending .auth-screen,
.auth-locked .auth-screen {
  display: grid;
}

/* Session restoration happens before the application shell is released. Keep
   the login form out of the first paint so an already-authenticated user does
   not see it flash for a moment during refresh. */
.auth-pending .auth-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.auth-pending::before {
  position: fixed;
  z-index: var(--z-overlay);
  inset: 0;
  background: var(--color-bg);
  content: "";
}

.top-gym-navigation-pending .page {
  /* Navigation requests already have a token/idempotency guard in
     page-tabs.js. Do not disable the whole application while an optional
     feature script is loading: a delayed script must never make every
     control appear dead. Keep only a subtle visual pending signal. */
  opacity: .86;
  transition: opacity 160ms ease;
}

/* Dashboard analytics is dashboard-only. Keep this invariant in the layout
   layer as a second guard for late feature responses or cached scripts. */
html[data-top-gym-active-tab]:not([data-top-gym-active-tab="dashboard"]) #dashboardAnalytics,
html[data-top-gym-loading-tab]:not([data-top-gym-loading-tab="dashboard"]) #dashboardAnalytics {
  display: none;
}

html {
  scroll-padding-top: 104px;
}

.page {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-8) 0 var(--space-12);
}

.workspace,
.content-grid,
.dashboard-section,
.section-stack {
  display: grid;
  gap: var(--space-6);
}

.section-stack {
  gap: var(--space-8);
}

.overview-grid,
.stats-grid,
.kpi-grid,
.metrics-grid,
.management-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.two-column-grid,
.content-grid-two,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

.three-column-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}

.page-header,
.section-heading,
.toolbar,
.panel-header,
.members-toolbar,
.actions-row,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.page-header,
.section-heading {
  flex-wrap: wrap;
}

.page-header-copy,
.section-heading-copy,
.members-toolbar-copy {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.toolbar,
.actions-row,
.form-actions {
  flex-wrap: wrap;
}

.form-grid,
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.field-span-2,
.form-field-full {
  grid-column: 1 / -1;
}

.table-scroll,
.table-wrap,
.data-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stack-sm,
.stack-md,
.stack-lg {
  display: grid;
}

.stack-sm { gap: var(--space-2); }
.stack-md { gap: var(--space-4); }
.stack-lg { gap: var(--space-6); }

/* END TOP GYM layer */


/* TOP GYM layer: public/css/utilities.css */
.font-sans { font-family: var(--font-body); }
.bg-white { background: var(--color-surface); }
.bg-slate-50 { background: var(--color-surface-muted); }
.bg-slate-100,
.gym-page-bg { background: var(--color-bg); }
.bg-slate-900,
.bg-slate-950 { background: var(--bg-header); }
.text-slate-900 { color: var(--color-text); }
.text-slate-700 { color: var(--color-text-soft); }
.text-slate-600 { color: var(--color-text-muted); }
.text-slate-500 { color: var(--color-text-subtle); }
.text-white { color: var(--text-on-primary); }
.text-blue-600 { color: var(--color-primary); }
.text-green-600 { color: var(--color-success); }
.text-red-600 { color: var(--color-danger); }
.border-slate-200 { border-color: var(--border-color); }
.border-slate-800 { border-color: var(--border-primary); }
.border-blue-200 { border-color: var(--info-border); }
.rounded,
.rounded-lg,
.rounded-xl,
.rounded-2xl { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-pill); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.w-full { width: 100%; }
.max-w-7xl { width: min(1440px, calc(100% - 32px)); margin-inline: auto; }
.mx-auto { margin-inline: auto; }
.hidden { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.flex { display: flex; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-4 { margin-top: var(--space-4); }
.overflow-hidden { overflow: hidden; }

.truncate,
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gym-brand-bg {
  background: linear-gradient(135deg, var(--color-primary), var(--primary-hover));
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/buttons.css */
.btn,
button.btn,
a.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn:hover:not(:disabled),
a.btn:hover {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-primary,
.btn.btn-primary {
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: 0 6px 16px var(--primary-border);
}

.btn-primary:hover:not(:disabled),
.btn.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: 0 8px 20px var(--primary-border);
}

.btn-secondary,
.btn-light,
.btn.btn-light {
  border-color: var(--border-color);
  background: var(--color-surface);
  color: var(--color-primary);
}

.btn-secondary:hover:not(:disabled),
.btn-light:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: var(--color-primary-soft);
}

.btn-ghost,
.btn-link {
  background: transparent;
  color: var(--color-primary);
}

.btn-ghost:hover:not(:disabled),
.btn-link:hover:not(:disabled) {
  background: var(--color-primary-soft);
}

.btn-danger,
.danger-action,
.btn.btn-danger {
  background: var(--color-danger);
  color: var(--text-on-primary);
}

.btn-danger:hover:not(:disabled),
.danger-action:hover:not(:disabled) {
  background: var(--color-danger);
}

.btn-small,
.btn-sm {
  min-height: 34px;
  padding-inline: var(--space-3);
  font-size: var(--font-xs);
}

.btn-icon,
.icon-button,
.action-button,
button[data-action] {
  display: inline-flex;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.btn-icon:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.action-button:hover:not(:disabled),
button[data-action]:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.btn svg,
.btn-icon svg,
.icon-button svg,
.action-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.auth-submit {
  width: 100%;
  min-height: 56px;
  font-size: var(--font-lg);
}

.btn.is-loading,
button[aria-busy="true"] {
  pointer-events: none;
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/forms.css */
.form-field,
.field,
.auth-field {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.form-field > label,
.field > label,
.auth-field > label,
label.form-label {
  color: var(--color-text-soft);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.form-control,
.search-input,
.filter-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: 0;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
.form-control,
.search-input,
.filter-input {
  padding: 0 var(--space-3);
}

textarea {
  min-height: 100px;
  padding: var(--space-3);
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-subtle);
  opacity: 1;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus,
.form-control:focus,
.search-input:focus,
.filter-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"],
.is-invalid {
  border-color: var(--color-danger);
}

.input-hint,
.field-hint,
.help-text {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.field-error,
.input-error,
.error-text {
  color: var(--color-danger);
  font-size: var(--font-xs);
}

.permission-note {
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  line-height: 1.7;
  padding: var(--space-3);
}

.permission-restricted {
  opacity: 0.72;
}

.input-group,
.input-with-icon,
.auth-input-wrap {
  position: relative;
  min-width: 0;
}

.input-group > input,
.input-with-icon > input,
.auth-input-wrap > input {
  /* These icons are physically anchored to the left. In RTL, reserving
     inline-start would reserve the right side and make the icon collide with
     the value/placeholder. Keep the logical side normal and reserve the
     physical icon side explicitly. */
  padding-inline-start: var(--space-3);
  padding-left: var(--space-10);
}

.input-icon,
.auth-input-icon {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  z-index: var(--z-content);
  width: 18px;
  height: 18px;
  color: var(--color-text-subtle);
  pointer-events: none;
  transform: translateY(-50%);
}

.checkbox-field,
.radio-field,
.check-row {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-soft);
  font-size: var(--font-sm);
}

input[type="checkbox"],
input[type="radio"] {
  inline-size: 32px;
  block-size: 32px;
  min-inline-size: 32px;
  min-block-size: 32px;
  margin: 0;
  accent-color: var(--color-primary);
}

.search-field,
.filter-field,
.members-search-field {
  min-width: 220px;
  flex: 1 1 260px;
}

.filter-row,
.filters-row,
.members-toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-3);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/cards.css */
.panel,
.card,
.content-card,
.shadow-panel,
.stat-card,
.management-card,
.library-card,
.finance-card,
.attendance-card {
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.panel,
.content-card,
.shadow-panel {
  padding: var(--space-5);
}

.panel-header,
.card-header,
.panel-footer,
.card-footer {
  padding: var(--space-4) var(--space-5);
}

.panel-header,
.card-header {
  border-bottom: 1px solid var(--border-color);
}

.panel-footer,
.card-footer {
  border-top: 1px solid var(--border-color);
}

.stat-card {
  display: grid;
  min-width: 0;
  gap: var(--space-3);
  padding: var(--space-5);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.stat-card:hover,
.management-card:hover,
.library-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.stat-head,
.stat-card-header,
.stat-content {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.stat-icon,
.metric-icon,
.management-card-icon,
.members-toolbar-icon,
.section-heading-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.stat-icon svg,
.metric-icon svg,
.management-card-icon svg,
.section-heading-icon svg {
  width: 21px;
  height: 21px;
}

.stat-label,
.metric-label,
.stat-caption {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.stat-value,
.metric-value {
  display: block;
  min-width: 0;
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: center;
}

.stat-card.success .stat-icon,
.success .stat-icon { background: var(--color-success-soft); color: var(--color-success); }
.stat-card.warning .stat-icon,
.warning .stat-icon { background: var(--color-warning-soft); color: var(--color-warning); }
.stat-card.danger .stat-icon,
.danger .stat-icon { background: var(--color-danger-soft); color: var(--color-danger); }

.card-grid,
.library-grid,
.exercise-grid,
.food-grid,
.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.card-body {
  padding: var(--space-5);
}

.card-title {
  color: var(--color-text);
  font-size: var(--font-lg);
  font-weight: var(--weight-bold);
}

.card-subtitle {
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/tables.css */
.table-container,
.table-panel,
.members-panel,
.history-panel,
.data-table-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

table,
.data-table,
.members-table,
.history-table {
  width: 100%;
  min-width: 680px;
  table-layout: auto;
  color: var(--color-text-soft);
  font-size: var(--font-sm);
}

thead,
.table-head {
  background: var(--color-surface-muted);
}

th,
td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-secondary);
  text-align: center;
  vertical-align: middle;
}

th {
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

tbody tr {
  min-height: 68px;
  transition: background-color var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td strong,
.member-name,
.table-primary {
  color: var(--color-text);
  font-weight: var(--weight-bold);
}

td small,
.table-secondary {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.table-actions,
.row-actions,
.members-actions,
.action-group {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  white-space: nowrap;
}

.table-empty,
.table-loading {
  padding: var(--space-10) var(--space-5);
  text-align: center;
}

.table-scroll > table,
.table-wrap > table,
.data-table-wrap > table {
  min-width: 720px;
}

.table-scroll,
.table-wrap,
.data-table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
}

.table-scroll > table,
.table-wrap > table,
.data-table-wrap > table {
  border: 0;
}

.table-container > .table-scroll,
.table-panel > .table-scroll,
.members-panel > .table-scroll,
.history-panel > .table-scroll {
  border-top: 1px solid var(--border-color);
}

tbody td {
  height: 68px;
}

tbody td:not(:last-child) {
  max-width: 280px;
}

.table-main,
.table-money,
.table-member-name {
  display: block;
  overflow: hidden;
  color: var(--color-text);
  font-weight: var(--weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.table-money {
  font-family: var(--font-latin);
  direction: ltr;
  text-align: center;
}

.table-member-phone {
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-primary);
  direction: ltr;
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
  unicode-bidi: isolate;
  margin-inline: auto;
  text-align: center;
}

.table-sub {
  display: block;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.table-actions,
.row-actions,
.members-actions,
.action-group,
.library-row-actions,
.store-row-actions,
.day-pass-actions,
.attendance-row-actions,
.reports-debtor-actions,
.reports-coaching-actions,
.type-actions {
  min-width: max-content;
  flex-wrap: nowrap;
  align-items: center;
  white-space: nowrap;
}

.table-actions .btn,
.row-actions .btn,
.members-actions .btn,
.action-group .btn,
.library-row-actions .btn,
.store-row-actions .btn,
.day-pass-actions .btn,
.attendance-row-actions .btn,
.reports-debtor-actions .btn,
.reports-coaching-actions .btn,
.type-actions .btn {
  flex: 0 0 auto;
  min-height: 36px;
}


.table-scroll::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.data-table-wrap::-webkit-scrollbar {
  height: 7px;
}

.table-scroll::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.data-table-wrap::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

/* Shared table contract for every data view. Page-specific files may tune a
   column width, but the reading rhythm, scrolling behavior and action area
   remain consistent across members, attendance, library, reports and dialogs. */
table,
.data-table,
.members-table,
.history-table,
.attendance-table,
.reports-table,
.pricing-table,
.membership-types-table,
.library-data-table,
.external-trainees-table,
.profile-table,
.backup-history-table,
.backup-count-table,
.builder-review-table {
  border-collapse: separate;
  border-spacing: 0;
}

.table-scroll,
.table-wrap,
.data-table-wrap,
.history-scroll,
.reports-table-wrap,
.pricing-table-scroll,
.pricing-table-wrap,
.library-table-wrap,
.external-trainees-table-wrap,
.profile-table-wrap,
.backup-history-wrap,
.backup-count-table-wrap,
.attendance-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

/* Keep the horizontal scroll direction predictable in an RTL application.
   The table keeps RTL column order, while the wrapper uses LTR scrolling so
   the start/end edges do not hide the action column on narrow screens. */
.table-scroll,
.table-wrap,
.data-table-wrap,
.history-scroll,
.reports-table-wrap,
.pricing-table-scroll,
.pricing-table-wrap,
.library-table-wrap,
.external-trainees-table-wrap,
.profile-table-wrap,
.backup-history-wrap,
.backup-count-table-wrap,
.attendance-table-wrap {
  direction: ltr;
}

.table-scroll > table,
.table-wrap > table,
.data-table-wrap > table,
.history-scroll > table,
.reports-table-wrap > table,
.pricing-table-scroll > table,
.pricing-table-wrap > table,
.library-table-wrap > table,
.external-trainees-table-wrap > table,
.profile-table-wrap > table,
.backup-history-wrap > table,
.backup-count-table-wrap > table,
.attendance-table-wrap > table {
  direction: rtl;
}

.table-scroll::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.data-table-wrap::-webkit-scrollbar,
.history-scroll::-webkit-scrollbar,
.reports-table-wrap::-webkit-scrollbar,
.pricing-table-scroll::-webkit-scrollbar,
.pricing-table-wrap::-webkit-scrollbar,
.library-table-wrap::-webkit-scrollbar,
.external-trainees-table-wrap::-webkit-scrollbar,
.profile-table-wrap::-webkit-scrollbar,
.backup-history-wrap::-webkit-scrollbar,
.backup-count-table-wrap::-webkit-scrollbar,
.attendance-table-wrap::-webkit-scrollbar {
  height: 7px;
}

.table-scroll::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.data-table-wrap::-webkit-scrollbar-thumb,
.history-scroll::-webkit-scrollbar-thumb,
.reports-table-wrap::-webkit-scrollbar-thumb,
.pricing-table-scroll::-webkit-scrollbar-thumb,
.pricing-table-wrap::-webkit-scrollbar-thumb,
.library-table-wrap::-webkit-scrollbar-thumb,
.external-trainees-table-wrap::-webkit-scrollbar-thumb,
.profile-table-wrap::-webkit-scrollbar-thumb,
.backup-history-wrap::-webkit-scrollbar-thumb,
.backup-count-table-wrap::-webkit-scrollbar-thumb,
.attendance-table-wrap::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-content);
  border-bottom: 1px solid var(--border-strong);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  letter-spacing: 0.01em;
}

tbody tr:nth-child(even) {
  background: var(--color-surface-muted);
}

tbody tr:hover {
  background: var(--color-primary-soft);
}

tbody td {
  border-bottom-color: var(--border-color);
  line-height: 1.45;
}

table td:first-child,
table th:first-child {
  padding-inline-start: var(--space-5);
}

table td:last-child,
table th:last-child {
  padding-inline-end: var(--space-5);
}

table .table-actions,
table .row-actions,
table .members-actions,
table .action-group {
  align-items: center;
  justify-content: center;
  margin-inline: auto;
}

/* Action cells remain reachable while the data area scrolls. This is scoped
   to data tables that actually expose row actions, so ordinary summary tables
   are not forced into a sticky last column. */
.members-table th:last-child,
.members-table td:last-child,
.attendance-table th:last-child,
.attendance-table td:last-child,
.external-trainees-table th:last-child,
.external-trainees-table td:last-child,
.library-data-table th:last-child,
.library-data-table td:last-child,
.backup-history-table th:last-child,
.backup-history-table td:last-child {
  position: sticky;
  inset-inline-end: 0;
  z-index: 2;
  min-width: 132px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.members-table thead th:last-child,
.attendance-table thead th:last-child,
.external-trainees-table thead th:last-child,
.library-data-table thead th:last-child,
.backup-history-table thead th:last-child {
  z-index: 4;
  background: var(--color-surface-muted);
}

.members-table tbody tr:nth-child(even) td:last-child,
.attendance-table tbody tr:nth-child(even) td:last-child,
.external-trainees-table tbody tr:nth-child(even) td:last-child,
.library-data-table tbody tr:nth-child(even) td:last-child,
.backup-history-table tbody tr:nth-child(even) td:last-child {
  background: var(--color-surface-muted);
}

.members-table tbody tr:hover td:last-child,
.attendance-table tbody tr:hover td:last-child,
.external-trainees-table tbody tr:hover td:last-child,
.library-data-table tbody tr:hover td:last-child,
.backup-history-table tbody tr:hover td:last-child {
  background: var(--color-primary-soft);
}

/* One interaction contract for every data table. Page-specific files may
   keep semantic colors for dangerous/success actions, but the row hover and
   action wrapping stay identical everywhere. */
table tbody tr:hover > td,
table tbody tr:hover > th {
  background: var(--color-primary-soft);
}

.reports-table td:last-child,
.member-feedback-table td:last-child,
.day-pass-table td:last-child,
.dashboard-day-pass-table td:last-child,
.store-table td:last-child,
.table-actions > .btn,
.row-actions > .btn,
.members-actions > .btn,
.action-group > .btn,
.library-row-actions > .btn,
.store-row-actions > .btn,
.day-pass-actions > .btn,
.attendance-row-actions > .btn,
.reports-debtor-actions > .btn,
.reports-coaching-actions > .btn,
.type-actions > .btn {
  white-space: nowrap;
}

table td:last-child > .btn,
table td:last-child > .icon-action,
table td:last-child > .action-button {
  min-height: 36px;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .members-table td:last-child.has-open-action-menu {
    z-index: var(--z-modal);
  }
}

@media (max-width: 767px) {
  th,
  td {
    padding: var(--space-3);
  }

  table td:first-child,
  table th:first-child {
    padding-inline-start: var(--space-3);
  }

  table td:last-child,
  table th:last-child {
    padding-inline-end: var(--space-3);
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/modals.css */
dialog,
.modal,
.modal-dialog,
[role="dialog"] {
  width: min(680px, calc(100% - 32px));
  max-width: 100%;
  max-height: calc(100vh - 48px);
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
}

dialog {
  padding: 0;
}

/* One predictable close affordance for every native popup. It stays in the
   upper-left corner in RTL as part of the popup shell, not inside the
   scrolling content. */
dialog > .dialog-close-button {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: calc(var(--z-modal) + 2);
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

dialog > .dialog-close-button:hover,
dialog > .dialog-close-button:focus-visible {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  transform: translateY(-1px);
}

dialog > .dialog-close-button .ui-icon {
  width: 16px;
  height: 16px;
}

/* Legacy dialogs still keep their IDs for backwards-compatible event
   bindings, but the shared shell exposes one close control only: the X. */
button.legacy-dialog-close {
  display: none !important;
}

dialog:has(> .dialog-close-button) .dialog-header,
dialog:has(> .dialog-close-button) .details-dialog-head,
dialog:has(> .dialog-close-button) .member-details-head,
dialog:has(> .dialog-close-button) .section-heading {
  padding-left: 56px;
}

dialog::backdrop,
.modal-backdrop,
.modal-overlay {
  background: var(--overlay);
  backdrop-filter: blur(2px);
}

.modal-content,
.dialog-content {
  display: grid;
  max-height: inherit;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.modal-header,
.dialog-header,
.modal-footer,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.modal-header,
.dialog-header {
  border-bottom: 1px solid var(--border-color);
}

.modal-footer,
.dialog-footer {
  justify-content: flex-start;
  border-top: 1px solid var(--border-color);
}

.modal-body,
.dialog-body {
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-5);
}

.modal-title,
.dialog-title {
  color: var(--color-text);
  font-size: var(--font-lg);
  font-weight: var(--weight-bold);
}

.modal-close,
.dialog-close,
[data-modal-close] {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
}

.modal-close:hover,
.dialog-close:hover,
[data-modal-close]:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

body.modal-open,
body.dialog-open {
  overflow: hidden;
}

/* Native dialogs share one predictable shell even though their inner forms
   are owned by different features. */
dialog[open] {
  display: block;
}

dialog > .dialog-body,
dialog > form.dialog-body {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

/* Every native dialog uses the same three visual zones. The body owns the
   scroll, while the heading and actions remain readable above it instead of
   covering fields when a form is taller than the viewport. */
dialog > .dialog-body > .details-dialog-head,
dialog > form.dialog-body > .details-dialog-head {
  position: sticky;
  top: calc(var(--space-5) * -1);
  z-index: var(--z-content);
  flex: 0 0 auto;
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-1);
  border-bottom: 1px solid var(--border-color);
  background: var(--color-surface);
  padding: var(--space-5) var(--space-5) var(--space-4);
}

dialog > .dialog-body > .dialog-actions,
dialog > form.dialog-body > .dialog-actions {
  position: sticky;
  bottom: calc(var(--space-5) * -1);
  z-index: var(--z-content);
  flex: 0 0 auto;
  margin: var(--space-1) calc(var(--space-5) * -1) calc(var(--space-5) * -1);
  border-top: 1px solid var(--border-color);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-5);
}

dialog > .dialog-body::-webkit-scrollbar,
dialog > form.dialog-body::-webkit-scrollbar {
  width: 7px;
}

dialog > .dialog-body::-webkit-scrollbar-thumb,
dialog > form.dialog-body::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

dialog .details-dialog-head {
  position: sticky;
  top: calc(var(--space-5) * -1);
  z-index: var(--z-content);
  padding-block: var(--space-1) var(--space-4);
  background: var(--color-surface);
}

dialog .details-dialog-head > div {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

dialog .details-dialog-head > button,
dialog .details-dialog-head > .btn {
  flex: 0 0 auto;
  min-width: 76px;
  min-height: 40px;
  white-space: nowrap;
}

dialog .details-dialog-head h3,
dialog .details-dialog-head h4 {
  color: var(--color-text);
}

dialog .details-dialog-head p {
  max-width: 70ch;
  color: var(--color-text-muted);
  line-height: 1.6;
}

dialog .dialog-actions {
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-4);
}

/* SweetAlert is loaded lazily, so these rules intentionally target both the
   library defaults and the custom classes used by the application. */
body .swal2-container {
  z-index: calc(var(--z-modal) + 20);
  font-family: var(--font-body);
}

dialog .swal2-container {
  position: absolute;
  inset: 0;
  z-index: calc(var(--z-content) + 20);
  width: 100%;
  height: 100%;
}

body .swal2-popup,
body .swal2-popup.top-gym-alert {
  width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
}

body .swal2-popup.top-gym-toast {
  width: min(430px, calc(100vw - 24px));
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

body .swal2-title {
  color: var(--color-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-bold);
  line-height: 1.4;
}

body .swal2-html-container,
body .swal2-content {
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  line-height: 1.7;
}

body .swal2-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

body .swal2-popup .swal2-actions > button.swal2-styled,
body .swal2-popup .swal2-actions > button.btn,
body .swal2-popup .swal2-actions > a.btn {
  display: inline-flex !important;
  min-width: 118px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent !important;
  border-radius: var(--radius-md);
  padding: 0 var(--space-4) !important;
  font-family: var(--font-body);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  box-shadow: none;
  cursor: pointer;
}

body .swal2-popup .swal2-actions > button.swal2-confirm,
body .swal2-popup .swal2-actions > button.btn-primary,
body .swal2-popup .swal2-actions > button.btn-danger {
  background: var(--color-primary) !important;
  color: var(--text-on-primary) !important;
}

body .swal2-popup .swal2-actions > button.btn-danger {
  background: var(--color-danger) !important;
}

body .swal2-popup .swal2-actions > button.swal2-cancel,
body .swal2-popup .swal2-actions > button.btn-light {
  border-color: var(--border-color) !important;
  background: var(--color-surface-muted) !important;
  color: var(--color-text-soft) !important;
}

body .swal2-popup .swal2-actions > button.swal2-confirm:hover,
body .swal2-popup .swal2-actions > button.btn-primary:hover,
body .swal2-popup .swal2-actions > button.btn-danger:hover {
  filter: brightness(0.94);
}

body .swal2-popup .swal2-actions > button.swal2-cancel:hover,
body .swal2-popup .swal2-actions > button.btn-light:hover {
  border-color: var(--border-focus) !important;
  background: var(--color-primary-soft) !important;
  color: var(--color-primary) !important;
}

body .swal2-close {
  color: var(--color-text-muted);
}

body .swal2-close:hover {
  color: var(--color-danger);
}

@media (max-width: 600px) {
  dialog,
  .modal,
  .modal-dialog,
  [role="dialog"] {
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    border-radius: var(--radius-lg);
  }

  dialog > .dialog-body,
  dialog > form.dialog-body {
    max-height: calc(100vh - 24px);
    padding: var(--space-4);
  }

  dialog > .dialog-body > .details-dialog-head,
  dialog > form.dialog-body > .details-dialog-head {
    top: calc(var(--space-4) * -1);
    margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-1);
    padding: var(--space-4) var(--space-4) var(--space-3);
  }

  dialog > .dialog-body > .dialog-actions,
  dialog > form.dialog-body > .dialog-actions {
    bottom: calc(var(--space-4) * -1);
    margin: var(--space-1) calc(var(--space-4) * -1) calc(var(--space-4) * -1);
    padding: var(--space-3) var(--space-4);
  }

  dialog .details-dialog-head {
    top: calc(var(--space-4) * -1);
  }

  dialog .dialog-actions {
    flex-wrap: wrap;
  }

  dialog .dialog-actions > * {
    flex: 1 1 140px;
  }

  body .swal2-popup .swal2-actions > button.swal2-styled,
  body .swal2-popup .swal2-actions > button.btn,
  body .swal2-popup .swal2-actions > a.btn {
    min-width: 0;
    flex: 1 1 140px;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/tabs.css */
/* Generic tab primitives. The Gym App shell navigation is defined once in
   navigation-shell.css; keeping these selectors generic prevents tab rules
   from competing with the application rail. */
.tabs,
.tab-list {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-1);
}

.tab-button {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  min-width: max-content;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  padding: 0 var(--space-4);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.tab-button:hover,
.tab-button:focus-visible {
  border-color: var(--border-hover);
  background: var(--primary-soft);
  color: var(--color-primary);
}

.tab-button.active,
.tab-button[aria-selected="true"] {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--color-primary);
}

.tab-button .ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.tabs-light .tab-button {
  color: var(--color-text-muted);
}

.tabs-light .tab-button.active,
.tabs-light .tab-button[aria-selected="true"] {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

@media (prefers-reduced-motion: reduce) {
  .tab-button {
    transition: none;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/badges.css */
.badge,
.status-badge,
.tag,
.chip,
.membership-badge,
.role-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 3px var(--space-2);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  white-space: nowrap;
}

.badge::before,
.status-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-badge-with-icon::before {
  display: none;
}

.status-badge-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.badge-success,
.status-active,
.status-present,
.status-in,
.status-badge.success {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge-warning,
.status-near-expiry,
.status-pending,
.status-badge.warning {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge-danger,
.status-expired,
.status-cancelled,
.status-badge.danger {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge-info,
.status-frozen,
.status-badge.info {
  border-color: var(--info-border);
  background: var(--color-info-soft);
  color: var(--color-info);
}

/* Membership status values are rendered as data-driven classes by the
   members/details views. Keep their visual meaning consistent everywhere. */
.badge.active {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge.expiring_soon {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge.expired,
.badge.cancelled {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge.frozen {
  border-color: var(--info-border);
  background: var(--color-info-soft);
  color: var(--color-info);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/alerts.css */
.alert,
.notice,
.auth-message,
.error-message,
.success-message,
.info-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  font-size: var(--font-sm);
}

.alert-success,
.success-message {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.alert-warning {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.alert-danger,
.error-message,
.auth-message:not(.info) {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.alert-info,
.info-message,
.auth-message.info {
  border-color: var(--info-border);
  background: var(--color-info-soft);
  color: var(--color-info);
}

.alerts-panel,
.alerts-list,
.alerts-section {
  display: grid;
  gap: var(--space-3);
}

.alerts-panel {
  padding: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.alerts-panel-header {
  min-width: 0;
  flex-wrap: wrap;
  padding: 0 0 var(--space-4);
}

.alerts-heading {
  min-width: 0;
}

.alerts-heading > div {
  min-width: 0;
}

.alerts-heading h3,
.alerts-heading p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alerts-filter-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  cursor: text;
}

.alerts-filter-button:hover {
  border-color: var(--border-focus);
  color: var(--color-primary);
}

.alerts-filter-button .ui-icon {
  width: 16px;
  height: 16px;
}

.alerts-list {
  min-width: 0;
}

.alert-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  border: 1px solid var(--border-color);
  border-inline-start: 3px solid var(--color-info);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-3);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.alert-card:hover {
  border-color: var(--color-info);
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.alert-card.active {
  border-inline-start-color: var(--color-success);
}

.alert-card.expiring_soon {
  border-inline-start-color: var(--color-warning);
}

.alert-card.expired {
  border-inline-start-color: var(--color-danger);
}

.alert-card.frozen {
  border-inline-start-color: var(--color-info);
}

.alert-card-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--color-info-soft);
  color: var(--color-info);
}

.alert-card-icon .ui-icon {
  width: 19px;
  height: 19px;
}

.alert-card.active .alert-card-icon {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.alert-card.expiring_soon .alert-card-icon {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.alert-card.expired .alert-card-icon {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.alert-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.alert-card-content {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.alert-card-head {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2);
}

.alert-card-name,
.alert-card-detail,
.alert-card-phone {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-card-name {
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}

.alert-card-detail {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.alert-card-phone {
  width: fit-content;
  max-width: 100%;
  color: var(--color-primary);
  direction: ltr;
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  unicode-bidi: isolate;
}

.alert-card-phone:hover {
  text-decoration: underline;
}

.alert-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.alert-status {
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--color-info);
  border-radius: var(--radius-pill);
  background: var(--color-info-soft);
  color: var(--color-info);
  padding: 0 var(--space-2);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.alert-contact-state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-pill);
  padding: 0 var(--space-2);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.alert-contact-state.opened {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.alert-contact-state.sent {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.alert-contact-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
}

.alert-card.active .alert-status {
  border-color: var(--color-success);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.alert-card.expiring_soon .alert-status {
  border-color: var(--color-warning);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.alert-card.expired .alert-status {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.alert-whatsapp-button {
  display: inline-flex;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-success);
  padding: 0;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.alert-whatsapp-button > span {
  display: none;
}

.alert-whatsapp-button:hover {
  border-color: var(--color-success);
  background: var(--color-success-soft);
  transform: translateY(-1px);
}

.alert-whatsapp-button .ui-icon {
  width: 18px;
  height: 18px;
}

.alerts-search-result {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  white-space: nowrap;
}

.alerts-list-scroll {
  max-height: 390px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-inline-end: var(--space-1);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.alerts-list-scroll::-webkit-scrollbar {
  width: 6px;
}

.alerts-list-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.alerts-list-scroll::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

.alerts-pagination:empty {
  display: none;
}

.alerts-pagination {
  display: flex;
  justify-content: center;
  padding-top: var(--space-1);
}

.alerts-view-all {
  min-width: 132px;
}

@media (max-width: 767px) {
  .alerts-panel-header {
    align-items: flex-start;
  }

  .alerts-filter-button {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .alerts-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .alerts-search-result {
    align-self: flex-start;
  }

  .alert-card-body {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .alert-card-actions {
    justify-content: flex-start;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/sidebar.css */
.sidebar,
.app-sidebar {
  width: 260px;
  flex: 0 0 260px;
  border-inline-end: 1px solid var(--border-color);
  background: var(--color-surface);
}

.sidebar-nav,
.sidebar-menu {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
}

.sidebar-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/navbar.css */
/* Generic header utility primitives live here. The application shell header
   and navigation rail are intentionally kept in one canonical stylesheet:
   components/navigation-shell.css. */
.header-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--success);
  font-size: var(--font-xs);
}

.header-status-dot,
.online-dot {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--color-success);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/branch-context.css */
/* Branch context is an operational aid, never an authorization boundary. */
.branch-context-shell {
  position: relative;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 50px;
  min-height: 50px;
  max-width: min(100%, 540px);
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--primary-border) 42%, var(--sidebar-border));
  border-radius: 15px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sidebar-bg) 98%, var(--primary) 2%), color-mix(in srgb, var(--sidebar-bg) 88%, var(--primary) 12%));
  color: var(--sidebar-text);
  box-shadow: 0 10px 24px rgb(2 6 23 / .13), inset 0 1px 0 rgb(255 255 255 / .06);
  isolation: isolate;
}

.branch-context-kicker {
  display: inline-flex;
  min-width: 110px;
  align-items: center;
  gap: 8px;
  padding-inline: 5px 8px;
  white-space: nowrap;
}

.branch-context-kicker-icon,
.branch-context-field-icon {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary-border) 56%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary-soft) 72%, transparent);
  color: var(--color-primary);
}

.branch-context-kicker-icon svg,
.branch-context-field-icon svg {
  width: 14px;
  height: 14px;
}

.branch-context-kicker > span:last-child,
.branch-context-field-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.branch-context-kicker strong {
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -.01em;
}

.branch-context-kicker small,
.branch-context-field-copy small {
  color: var(--sidebar-text-muted);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.3;
}

.branch-context-divider {
  width: 1px;
  height: 28px;
  flex: 0 0 1px;
  margin-inline: 2px 4px;
  background: var(--sidebar-divider);
}

.branch-context-field {
  display: inline-flex;
  min-width: 126px;
  align-items: center;
  gap: 7px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 13px;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.branch-context-field:hover,
.branch-context-field:focus-within {
  border-color: color-mix(in srgb, var(--primary-border) 62%, transparent);
  background: color-mix(in srgb, var(--primary-soft) 68%, transparent);
}

.branch-context-field:focus-within { transform: translateY(-1px); }

.branch-context-field-copy select {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.branch-context-field-copy select:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.branch-context-field-copy select option {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.branch-context-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  margin-inline-start: 3px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--success) 32%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--success-soft) 78%, transparent);
  color: var(--success-text);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.branch-context-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft), 0 0 12px color-mix(in srgb, var(--success) 68%, transparent);
}

.branch-context-shell select:focus-visible {
  border-radius: 7px;
  box-shadow: var(--focus-ring);
}

.branches-page {
  display: grid;
  gap: 16px;
}

.branches-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, color-mix(in srgb, var(--sidebar-bg) 74%, var(--color-primary)) 68%, color-mix(in srgb, var(--sidebar-bg) 48%, var(--color-primary)) 150%);
  color: var(--sidebar-text);
  box-shadow: var(--shadow-lg);
}

.branches-page-heading h2,
.branches-page-heading p { margin: 0; }
.branches-page-heading h2 { margin-top: 7px; font-size: clamp(23px, 2.6vw, 31px); letter-spacing: -.03em; }
.branches-page-heading p { max-width: 680px; margin-top: 10px; color: var(--sidebar-text-muted); line-height: 1.8; }
.branches-page-kicker,
.branches-card-kicker { color: var(--color-primary); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.branches-page-summary { display: flex; gap: 10px; }
.branches-page-summary span { display: grid; gap: 4px; min-width: 108px; padding: 12px 14px; border: 1px solid var(--sidebar-border); border-radius: 14px; background: color-mix(in srgb, var(--sidebar-bg) 72%, transparent); }
.branches-page-summary strong { font-size: 22px; }
.branches-page-summary small { color: var(--sidebar-text-muted); font-size: 11px; }
.branches-layout { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.branches-card { padding: 18px; border: 1px solid var(--border-color); border-radius: 18px; background: var(--color-surface); box-shadow: var(--shadow-sm); }
.branches-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.branches-card-header h3,
.branches-card-header p { margin: 0; }
.branches-card-header h3 { margin-top: 5px; color: var(--color-text); }
.branches-card-header p { margin-top: 6px; color: var(--color-text-muted); font-size: 13px; line-height: 1.6; }
.branches-form { display: grid; gap: 11px; }
.branches-form label { display: grid; gap: 6px; color: var(--color-text-muted); font-size: 12px; font-weight: 800; }
.branches-form input { width: 100%; }
.branches-check-field { display: flex !important; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px !important; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 11px; background: var(--color-surface-elevated); }
.branches-check-field input { width: 16px; height: 16px; accent-color: var(--color-primary); }
.branches-form button { margin-top: 4px; }
.branches-form-status { min-height: 22px; margin: 14px 0 0; color: var(--color-success, #059669); font-size: 13px; font-weight: 700; }
.branches-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 10px; align-items: start; }
.branch-list-item { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: start; gap: 10px; min-width: 0; padding: 13px; border: 1px solid var(--border-color); border-radius: 15px; background: var(--color-surface-elevated); transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.branch-list-item:hover { border-color: color-mix(in srgb, var(--color-primary) 42%, var(--border-color)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.branch-list-marker { width: 5px; min-height: 78px; border-radius: 99px; background: linear-gradient(var(--color-primary), color-mix(in srgb, var(--color-primary) 55%, var(--color-primary))); }
.branch-list-copy { display: grid; gap: 3px; min-width: 0; }
.branch-list-copy strong { color: var(--color-text); font-size: 14px; }
.branch-list-copy span { color: var(--color-primary); font-size: 11px; font-weight: 800; }
.branch-list-copy small { display: -webkit-box; overflow: hidden; color: var(--color-text-muted); font-size: 12px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.branch-list-actions { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 7px; flex-wrap: wrap; padding-top: 9px; border-top: 1px solid var(--border-color); }
.branch-list-actions .btn { min-height: 34px; }
.branch-commerce-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.branch-commerce-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border: 1px solid var(--border-color); border-radius: 999px; color: var(--color-text-muted); font-size: .7rem; font-weight: 800; letter-spacing: .02em; }
.branch-commerce-chip.is-on { border-color: color-mix(in srgb, var(--color-primary) 38%, var(--border-color)); color: var(--color-primary); background: color-mix(in srgb, var(--color-primary-soft) 72%, transparent); }
.branch-status { padding: 5px 8px; border-radius: 99px; background: var(--success-soft); color: var(--success-text); font-size: 11px; font-weight: 800; white-space: nowrap; }
.branch-status.inactive { background: var(--warning-soft); color: var(--warning-text); }
.branch-status.archived { background: var(--color-surface-muted); color: var(--text-muted); }

@media (max-width: 900px) {
  .branches-layout { grid-template-columns: 1fr; }
  .branches-page-header { align-items: stretch; flex-direction: column; }
}

@media (max-width: 700px) {
  .branch-context-shell { width: 100%; max-width: none; justify-content: stretch; }
  .branch-context-kicker { min-width: auto; padding-inline: 4px 8px; }
  .branch-context-kicker small,
  .branch-context-field-icon { display: none; }
  .branch-context-field { min-width: 0; flex: 1 1 0; padding-inline: 7px; }
  .branch-context-status { margin-inline-start: 3px; padding-inline: 8px; }
  .branches-page-header, .branches-card { padding: 16px; }
  .branches-page-summary { width: 100%; }
  .branches-page-summary span { flex: 1; }
  .branches-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .branch-context-shell { height: 46px; min-height: 46px; border-radius: 13px; }
  .branch-context-kicker strong { font-size: 10px; }
  .branch-context-kicker { gap: 5px; }
  .branch-context-kicker-icon { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; }
  .branch-context-field { gap: 0; padding-inline: 5px; }
  .branch-context-field-copy small { font-size: 8px; }
  .branch-context-field-copy select { font-size: 11px; }
  .branch-context-status { min-height: 28px; padding-inline: 6px; font-size: 9px; }
  .branch-context-status-dot { width: 6px; height: 6px; flex-basis: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .branch-context-shell, .branches-card { scroll-behavior: auto; transition: none; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/bar-pos.css */
.bar-pos-view[hidden] { display: none; }
.bar-pos-card { overflow: hidden; }
.bar-pos-header { align-items: flex-start; gap: 1rem; }
.store-section-eyebrow { display: block; color: var(--primary); font-size: .68rem; font-weight: 800; letter-spacing: .16em; margin-bottom: .25rem; }
.bar-pos-toolbar, .bar-pos-shift-tools { display: flex; align-items: end; gap: .65rem; flex-wrap: wrap; }
.bar-pos-toolbar label, .bar-pos-shift-tools label { min-width: 170px; color: var(--text-muted); font-size: .78rem; font-weight: 700; }
.bar-pos-toolbar select, .bar-pos-shift-tools input { display: block; width: 100%; margin-top: .28rem; }
.bar-pos-status { margin: .15rem 0 1rem; padding: .75rem 1rem; border: 1px solid var(--border-secondary); border-radius: .8rem; color: var(--text-muted); background: color-mix(in srgb, var(--color-surface-muted) 82%, transparent); }
.bar-pos-status[data-status="ready"] { color: var(--success, #16855b); border-color: color-mix(in srgb, var(--success, #16855b) 30%, var(--border-secondary)); }
.bar-pos-status[data-status="warning"] { color: var(--warning, #a56700); border-color: color-mix(in srgb, var(--warning, #a56700) 30%, var(--border-secondary)); }
.bar-pos-status[data-status="error"] { color: var(--danger, #b33838); border-color: color-mix(in srgb, var(--danger, #b33838) 30%, var(--border-secondary)); }
.bar-pos-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 1rem; align-items: start; }
.bar-pos-menu-panel { min-width: 0; }
.bar-pos-menu-panel > .store-search-field { display: block; margin-bottom: .9rem; }
.bar-pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .7rem; }
.bar-pos-item { position: relative; display: grid; grid-template-columns: auto 1fr; gap: .65rem; align-items: center; min-height: 105px; padding: .8rem; border: 1px solid var(--border-secondary); border-radius: .9rem; color: var(--text-primary); background: var(--color-surface); text-align: start; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.bar-pos-item:hover:not(:disabled), .bar-pos-item:focus-visible:not(:disabled) { border-color: var(--primary); box-shadow: 0 10px 24px rgb(0 0 0 / 8%); transform: translateY(-2px); }
.bar-pos-item:disabled { cursor: not-allowed; opacity: .52; }
.bar-pos-item > b { grid-column: 2; color: var(--primary); font-size: .9rem; }
.bar-pos-item > em { grid-column: 1 / -1; color: var(--danger, #b33838); font-size: .72rem; font-style: normal; font-weight: 700; }
.bar-pos-item-icon { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: .7rem; color: white; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 62%, #0d2235)); font-size: 1.15rem; }
.bar-pos-item-copy { min-width: 0; }
.bar-pos-item-copy strong, .bar-pos-item-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-pos-item-copy small { margin-top: .2rem; color: var(--text-muted); font-size: .75rem; }
.bar-pos-order { position: sticky; top: 1rem; display: grid; gap: .75rem; padding: 1rem; border: 1px solid var(--border-secondary); border-radius: 1rem; background: var(--color-surface-muted); }
.bar-pos-order-heading { display: flex; justify-content: space-between; align-items: start; gap: .7rem; }
.bar-pos-order-heading h4 { margin: 0; }
.bar-pos-lines { display: grid; gap: .5rem; max-height: 360px; overflow: auto; }
.bar-pos-line { display: flex; justify-content: space-between; align-items: center; gap: .65rem; padding: .65rem; border-radius: .75rem; background: var(--color-surface); }
.bar-pos-line strong, .bar-pos-line small { display: block; }
.bar-pos-line small { margin-top: .2rem; color: var(--text-muted); font-size: .7rem; }
.bar-pos-line-actions { display: inline-flex; align-items: center; gap: .45rem; }
.bar-pos-line-actions button { width: 2rem; height: 2rem; border: 1px solid var(--border-secondary); border-radius: .55rem; color: var(--text-primary); background: transparent; font-size: 1.1rem; cursor: pointer; }
.bar-pos-line-actions button:hover, .bar-pos-line-actions button:focus-visible { border-color: var(--primary); color: var(--primary); }
.bar-pos-total { display: flex; justify-content: space-between; align-items: center; padding-top: .8rem; border-top: 1px solid var(--border-secondary); }
.bar-pos-total strong { color: var(--primary); font-size: 1.15rem; }
@media (max-width: 900px) { .bar-pos-layout { grid-template-columns: 1fr; } .bar-pos-order { position: static; } }
@media (max-width: 560px) { .bar-pos-header { display: grid; } .bar-pos-toolbar, .bar-pos-shift-tools { align-items: stretch; } .bar-pos-toolbar > *, .bar-pos-shift-tools > * { flex: 1 1 100%; } .bar-pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; } .bar-pos-item { min-height: 96px; padding: .65rem; } }
@media (prefers-reduced-motion: reduce) { .bar-pos-item { transition: none; } }

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/dropdowns.css */
.dropdown,
.dropdown-menu,
.more-menu,
[data-dropdown-menu] {
  position: absolute;
  z-index: var(--z-dropdown);
  min-width: 180px;
  max-width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-text-soft);
  padding: var(--space-2);
}

.action-menu {
  position: relative;
  display: inline-flex;
  min-width: 0;
  max-width: none;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.action-menu-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  inset-inline-end: 0;
  z-index: var(--z-dropdown);
  min-width: 180px;
  max-width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-text-soft);
  padding: var(--space-2);
}

.action-menu-panel.is-floating {
  position: fixed;
  inset: auto;
  z-index: var(--z-modal);
  inset-inline-end: auto;
  max-height: min(360px, calc(100vh - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Lift an open menu above adjacent table rows. Sticky action cells otherwise
   create competing stacking contexts and can paint over the dropdown. */
.action-menu.is-open {
  position: relative;
  z-index: var(--z-modal);
}

.action-menu > .action-menu-toggle {
  width: 40px;
  min-width: 40px;
  padding-inline: 0;
}

.action-menu-toggle .action-menu-icon {
  width: 18px;
  height: 18px;
}

.dropdown-item,
.action-menu button,
.more-menu button,
[data-dropdown-menu] button,
[data-dropdown-item] {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  padding: 0 var(--space-3);
  text-align: start;
  font-size: var(--font-sm);
}

.dropdown-item:hover,
.action-menu button:hover,
.more-menu button:hover,
[data-dropdown-menu] button:hover,
[data-dropdown-item]:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* Member advanced actions keep the same compact menu, but each operation has
   a recognizable semantic accent without adding another row of buttons. */
.action-menu-item[data-action="freeze"] .action-icon {
  color: var(--color-warning);
}

.action-menu-item[data-action="payment"] .action-icon {
  color: var(--color-success);
}

.action-menu-item[data-action="qr"] .action-icon {
  color: var(--color-primary);
}

.action-menu-item[data-action="print"] .action-menu-print-icon {
  color: var(--color-warning);
}

.action-menu-item[data-action="freeze"]:hover {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.action-menu-item[data-action="payment"]:hover {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.action-menu-item[data-action="qr"]:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.dropdown-item.danger,
.action-menu button.danger,
.more-menu button.danger,
[data-dropdown-item][data-danger] {
  color: var(--color-danger);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/assistant.css */
/* Shared Smart Assistant surface. The launcher belongs to the Gym App shell;
   its navigation presentation is defined in navigation-shell.css. */
.smart-assistant-close:focus-visible,
.smart-assistant-tab:focus-visible,
.smart-assistant-quick-action:focus-visible,
.smart-assistant-submit:focus-visible {
  outline: 3px solid var(--primary-border);
  outline-offset: 2px;
}

.smart-assistant-panel {
  position: fixed;
  left: 24px;
  right: auto;
  bottom: 88px;
  z-index: var(--z-toast);
  display: grid;
  width: min(400px, calc(100vw - 48px));
  max-height: min(650px, calc(100dvh - 112px));
  grid-template-rows: auto auto auto minmax(150px, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-popup), var(--shadow-sm);
  color: var(--color-text);
  animation: smart-assistant-enter 180ms ease both;
}

.smart-assistant-panel[hidden] {
  display: none;
}

.smart-assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
  padding: var(--space-4);
}

.smart-assistant-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}

.smart-assistant-brand-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: 0 8px 16px var(--primary-border);
}

.smart-assistant-brand-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.smart-assistant-brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.smart-assistant-brand-copy strong,
.smart-assistant-brand-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-assistant-brand-copy strong {
  color: var(--color-text);
  font-size: var(--font-md);
  font-weight: var(--weight-extrabold);
}

.smart-assistant-brand-copy small {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.smart-assistant-close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.smart-assistant-close:hover {
  border-color: var(--border-strong);
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.smart-assistant-close .ui-icon {
  width: 18px;
  height: 18px;
}

.smart-assistant-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-3) var(--space-4) 0;
}

.smart-assistant-tab {
  min-height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}

.smart-assistant-tab:hover {
  color: var(--color-primary);
}

.smart-assistant-tab[aria-selected="true"] {
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
}

.smart-assistant-context {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-3) var(--space-4);
}

.smart-assistant-context strong {
  color: var(--color-text);
  font-size: var(--font-sm);
}

.smart-assistant-context span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.smart-assistant-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  max-height: 112px;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4) 0;
}

.smart-assistant-quick-actions:empty {
  display: none;
}

.smart-assistant-quick-action {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.smart-assistant-quick-action:hover {
  border-color: var(--border-focus);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.smart-assistant-quick-action .ui-icon {
  width: 15px;
  height: 15px;
}

.smart-assistant-messages {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4);
}

.smart-assistant-message {
  display: grid;
  max-width: 92%;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: var(--space-3);
  font-size: var(--font-sm);
  line-height: 1.65;
  white-space: pre-wrap;
}

.smart-assistant-message.assistant {
  justify-self: start;
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
}

.smart-assistant-message.user {
  justify-self: end;
  border-color: var(--primary-border);
  background: var(--color-primary-soft);
  color: var(--color-text);
}

.smart-assistant-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.smart-assistant-message-action {
  min-height: 32px;
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
  padding: 0 var(--space-2);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.smart-assistant-message-action:hover {
  background: var(--color-primary-soft);
}

.smart-assistant-composer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-top: 1px solid var(--border-color);
  background: var(--color-surface);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
}

.smart-assistant-input {
  min-width: 0;
  min-height: 46px;
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--color-surface-muted);
  color: var(--color-text);
  padding: 0 var(--space-3);
  font-size: var(--font-sm);
}

.smart-assistant-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
  outline: 0;
}

.smart-assistant-submit {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--color-primary);
  color: var(--text-on-primary);
}

.smart-assistant-submit:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.smart-assistant-submit:disabled {
  cursor: wait;
  opacity: 0.6;
}

.smart-assistant-submit .ui-icon {
  width: 19px;
  height: 19px;
}

@keyframes smart-assistant-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 767px) {
  .smart-assistant-panel {
    inset-inline: 10px;
    bottom: max(78px, calc(62px + env(safe-area-inset-bottom, 0px)));
    width: auto;
    max-height: min(78dvh, 680px);
    border-radius: 18px;
  }

  .smart-assistant-messages {
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .smart-assistant-panel,
  .smart-assistant-quick-action {
    animation: none;
    transition: none;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/pagination.css */
.pagination,
.members-pagination,
.table-pagination,
.coaching-pagination,
.library-pagination {
  display: flex;
  flex-wrap: wrap;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-top: 1px solid var(--border-color);
  background: var(--color-surface);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.pagination-controls,
.pagination-pages,
.members-pagination-actions,
.library-pagination-actions,
.coaching-pagination > div {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.members-pagination-info,
.library-pagination-info,
.coaching-pagination > span,
.pagination-info {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  padding: 0 var(--space-3);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pagination button,
.pagination a,
.pagination-page,
.members-pagination button,
.library-pagination button,
.coaching-pagination button {
  display: inline-flex;
  min-width: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  line-height: 1;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.members-pagination button:not(:disabled):hover,
.library-pagination button:not(:disabled):hover,
.coaching-pagination button:not(:disabled):hover,
.pagination button:not(:disabled):hover,
.pagination a:hover,
.pagination-page:hover {
  border-color: var(--border-focus);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.members-pagination button:focus-visible,
.library-pagination button:focus-visible,
.coaching-pagination button:focus-visible,
.pagination button:focus-visible,
.pagination a:focus-visible,
.pagination-page:focus-visible,
.members-page-size select:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.members-pagination button.active,
.pagination button.active,
.pagination-page.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: 0 5px 14px var(--primary-border);
}

.members-pagination button:disabled,
.library-pagination button:disabled,
.coaching-pagination button:disabled,
.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.members-pagination .members-page-button,
.pagination .page-button {
  width: 38px;
  padding: 0;
}

.members-pagination .members-page-button .ui-icon {
  width: 17px;
  height: 17px;
}

.members-page-size {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: 0 var(--space-2) 0 var(--space-3);
  white-space: nowrap;
}

.members-page-size select {
  min-width: 54px;
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 var(--space-2);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.library-pagination-actions button,
.coaching-pagination > div button {
  min-width: 82px;
  padding-inline: var(--space-3);
}

.pagination button,
.pagination a,
.pagination-page {
  height: 34px;
  align-items: center;
  justify-content: center;
}

@media (max-width: 600px) {
  .pagination,
  .members-pagination,
  .table-pagination,
  .coaching-pagination,
  .library-pagination {
    align-items: stretch;
    flex-direction: column;
    padding: var(--space-3);
  }

  .members-pagination-info,
  .library-pagination-info,
  .coaching-pagination > span,
  .pagination-info {
    justify-content: center;
  }

  .pagination-controls,
  .pagination-pages,
  .members-pagination-actions,
  .library-pagination-actions,
  .coaching-pagination > div {
    justify-content: center;
  }

  .members-page-size {
    flex: 1 1 100%;
    justify-content: space-between;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/loading.css */
.loading,
.loading-state,
.page-loading,
.auth-loading,
.spinner-wrap {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--color-text-muted);
}

div.loading,
div.loading-state,
div.page-loading {
  position: relative;
  display: block;
  min-height: 142px;
  padding: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: transparent;
}

div.loading:not(.skeleton-loading-host)::before,
div.loading-state:not(.skeleton-loading-host)::before,
div.page-loading:not(.skeleton-loading-host)::before {
  display: block;
  width: 100%;
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-card-hover);
  box-shadow: 0 30px 0 var(--bg-card-hover), 0 60px 0 var(--bg-card-hover);
  content: "";
}

div.loading:not(.skeleton-loading-host)::after,
div.loading-state:not(.skeleton-loading-host)::after,
div.page-loading:not(.skeleton-loading-host)::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 0.08) 45%, transparent 70%);
  content: "";
  transform: translateX(-100%);
  animation: top-gym-skeleton-shimmer 1.25s ease-in-out infinite;
}

.skeleton-loading-host {
  display: block;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  width: 100%;
}

.skeleton-card {
  position: relative;
  display: grid;
  min-height: 128px;
  align-content: start;
  gap: 12px;
  padding: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--bg-card), var(--bg-surface));
}

.skeleton-card::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 18%, rgb(255 255 255 / 0.08) 48%, transparent 76%);
  content: "";
  transform: translateX(-100%);
  animation: top-gym-skeleton-shimmer 1.3s ease-in-out infinite;
}

.skeleton-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.skeleton-block {
  display: block;
  border-radius: var(--radius-sm);
  background: var(--bg-card-hover);
}

.skeleton-avatar { width: 34px; height: 34px; border-radius: 50%; }
.skeleton-chip { width: 54px; height: 10px; border-radius: var(--radius-pill); }
.skeleton-title { width: 68%; height: 13px; }
.skeleton-line { width: 92%; height: 9px; }
.skeleton-line.is-short { width: 55%; }

.skeleton-table {
  display: grid;
  gap: 8px;
  width: 100%;
}

.skeleton-table-head,
.skeleton-table-row {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: var(--space-3);
  min-height: 42px;
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--border-secondary);
}

.skeleton-table-head { min-height: 34px; background: var(--bg-card); }
.skeleton-table-cell { width: 78%; height: 9px; }
.skeleton-table-cell:first-child { width: 90%; }
.skeleton-table-cell.is-head { height: 8px; background: var(--bg-elevated); }

@keyframes top-gym-skeleton-shimmer {
  to { transform: translateX(100%); }
}

.top-progress {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: var(--z-toast);
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.top-progress.is-visible { opacity: 1; }

.top-progress-track {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.top-progress-bar {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--color-primary), var(--primary-hover), transparent);
  box-shadow: 0 0 12px var(--primary-border);
  transform: translateX(-140%);
  animation: top-gym-progress-slide 1.15s cubic-bezier(.4, 0, .2, 1) infinite;
}

.top-progress.is-completing .top-progress-bar {
  width: 100%;
  transform: translateX(0);
  animation: none;
  transition: width 180ms ease, transform 180ms ease;
}

.top-progress-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.spinner,
.auth-spinner,
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: top-gym-spin 0.75s linear infinite;
}

.auth-spinner {
  display: none;
  width: 18px;
  height: 18px;
}

button[aria-busy="true"] .auth-spinner,
button[aria-busy="true"] .loading-spinner {
  display: inline-block;
}

.skeleton,
.skeleton-row,
.skeleton-line {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: top-gym-skeleton 1.2s ease-in-out infinite;
}

.skeleton-line {
  height: 12px;
  width: 70%;
}

@keyframes top-gym-spin {
  to { transform: rotate(360deg); }
}

@keyframes top-gym-skeleton {
  to { background-position: -200% 0; }
}

@keyframes top-gym-progress-slide {
  0% { transform: translateX(-140%); }
  55% { transform: translateX(145%); }
  100% { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
  .top-progress-bar,
  .skeleton,
  .skeleton-row,
  .skeleton-line,
  .skeleton-card::after,
  div.loading::after,
  div.loading-state::after,
  div.page-loading::after { animation-duration: 1.8s; }
}

@media (max-width: 768px) {
  .skeleton-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .skeleton-cards { grid-template-columns: 1fr; }
  .skeleton-table-head,
  .skeleton-table-row { gap: var(--space-2); padding-inline: var(--space-2); }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/feedback.css */
/* Unified interaction feedback: one language and one visual contract for
   buttons, toasts and assistive status updates across all app surfaces. */
.logicfit-button-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid color-mix(in srgb, currentColor 28%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: logicfit-feedback-spin .72s linear infinite;
}

.logicfit-button-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logicfit-button-success { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; }
.logicfit-button-success .ui-icon { width: 16px; height: 16px; }
button[data-feedback-loading="true"],
button[data-loading="true"] { cursor: wait; }

#toast,
.logicfit-feedback-toast-stack {
  position: fixed;
  z-index: calc(var(--z-toast, 100) + 2);
  inset-inline-start: max(16px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  width: min(430px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast:not(.show),
.logicfit-feedback-toast-stack:not(.show) { visibility: hidden; }
.toast.show { visibility: visible; }

.toast > .toast-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg, 14px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 11px 12px;
  box-shadow: var(--shadow-popup);
  pointer-events: auto;
  animation: logicfit-feedback-toast-in 180ms ease-out both;
}

.toast > .toast-item.success { border-color: var(--success-border); }
.toast > .toast-item.error { border-color: var(--danger-border); }
.toast > .toast-item.warning { border-color: var(--warning-border); }
.toast > .toast-item.info { border-color: var(--info-border); }
.toast > .toast-item .toast-icon { display: inline-flex; color: var(--primary); }
.toast > .toast-item.success .toast-icon { color: var(--success-text); }
.toast > .toast-item.error .toast-icon { color: var(--danger-text); }
.toast > .toast-item.warning .toast-icon { color: var(--warning-text); }
.toast > .toast-item.info .toast-icon { color: var(--info-text); }
.toast > .toast-item .toast-icon .ui-icon { width: 19px; height: 19px; }
.toast > .toast-item .toast-message { min-width: 0; color: var(--text-secondary); font-size: var(--font-sm, 13px); font-weight: var(--weight-semibold, 600); line-height: 1.55; }
.toast > .toast-item .toast-close { display: inline-grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; }
.toast > .toast-item .toast-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.toast > .toast-item.is-leaving { animation: logicfit-feedback-toast-out 180ms ease-in both; }

.logicfit-feedback-toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg, 14px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 11px 12px;
  box-shadow: var(--shadow-popup);
  pointer-events: auto;
  animation: logicfit-feedback-toast-in 180ms ease-out both;
}

.logicfit-feedback-toast.success { border-color: var(--success-border); }
.logicfit-feedback-toast.error { border-color: var(--danger-border); }
.logicfit-feedback-toast.warning { border-color: var(--warning-border); }
.logicfit-feedback-toast.info { border-color: var(--info-border); }
.logicfit-feedback-toast .toast-icon { display: inline-flex; color: var(--primary); }
.logicfit-feedback-toast.success .toast-icon { color: var(--success-text); }
.logicfit-feedback-toast.error .toast-icon { color: var(--danger-text); }
.logicfit-feedback-toast.warning .toast-icon { color: var(--warning-text); }
.logicfit-feedback-toast.info .toast-icon { color: var(--info-text); }
.logicfit-feedback-toast .toast-icon .ui-icon { width: 19px; height: 19px; }
.logicfit-feedback-toast .toast-message { min-width: 0; color: var(--text-secondary); font-size: var(--font-sm, 13px); font-weight: var(--weight-semibold, 600); line-height: 1.55; }
.logicfit-feedback-toast .toast-close { display: inline-grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; }
.logicfit-feedback-toast .toast-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.logicfit-feedback-toast.is-leaving { animation: logicfit-feedback-toast-out 180ms ease-in both; }

@keyframes logicfit-feedback-spin { to { transform: rotate(360deg); } }
@keyframes logicfit-feedback-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logicfit-feedback-toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }

@media (max-width: 560px) {
  #toast,
  .logicfit-feedback-toast-stack { inset-inline: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .logicfit-button-spinner { animation: none; }
  .toast > .toast-item,
  .logicfit-feedback-toast,
  .logicfit-feedback-toast.is-leaving { animation: none; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/empty-states.css */
.empty-state,
.empty,
.no-data,
.not-found-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  text-align: center;
}

.empty-state h3,
.empty-state strong,
.empty-title {
  color: var(--color-text-soft);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.empty-state p,
.empty-description {
  max-width: 42ch;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/login.css */
.auth-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  place-items: center start;
  overflow: hidden;
  padding: clamp(12px, 2.2vw, 24px);
  isolation: isolate;
  background-color: var(--bg-app);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* Do not fetch the login-only hero while the session is being restored or
   while the authenticated application is already visible. */
body.auth-locked .auth-screen {
  background-image: linear-gradient(180deg, var(--overlay), var(--overlay)), url("/assets/gym-background.webp");
}

.auth-screen::before {
  position: absolute;
  inset: -4%;
  z-index: 0;
  background:
    linear-gradient(90deg, var(--primary-soft), transparent 48%, var(--primary-soft)),
    radial-gradient(circle at 50% 0%, var(--primary-soft), transparent 42%);
  content: "";
  filter: none;
  pointer-events: none;
  transform: none;
}

.auth-shell {
  position: relative;
  z-index: var(--z-content);
  width: min(440px, 100%);
  margin: auto;
}

.auth-card {
  display: block;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border-primary);
  border-radius: 24px;
  background: var(--bg-card);
  box-shadow: var(--shadow-popup);
}

.auth-form-panel {
  position: relative;
  display: block;
  min-width: 0;
  padding: 36px 40px 30px;
  background: var(--bg-card);
}

.auth-form {
  display: grid;
  width: 100%;
  gap: var(--space-4);
  margin-inline: auto;
}

.auth-form-heading {
  display: grid;
  gap: 4px;
  margin-bottom: var(--space-3);
  text-align: center;
}

.auth-form-heading h2 {
  color: var(--text-primary);
  font-size: 32px;
  font-weight: var(--weight-extrabold);
  line-height: 1.25;
}

.auth-field {
  display: grid;
  gap: var(--space-2);
}

.auth-form .auth-field > label {
  display: block;
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}

.auth-form .auth-input-wrap,
.auth-form .auth-password-wrap {
  position: relative;
  min-width: 0;
}

.auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]),
.auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  box-sizing: border-box;
  min-height: 54px;
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--font-md);
  outline: 0;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]):hover,
.auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]):hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
}

.auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]):focus,
.auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]):focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  direction: ltr;
  padding: 0 16px;
  text-align: left;
  unicode-bidi: plaintext;
}

.auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  direction: ltr;
  padding: 0 16px 0 54px;
  text-align: left;
  unicode-bidi: plaintext;
}

.auth-form .auth-input-icon {
  position: absolute;
  top: 50%;
  right: 16px;
  z-index: var(--z-content);
  left: auto;
  display: none;
  transform: translateY(-50%);
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: auto;
  left: 8px;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  transform: translateY(-50%);
}

.auth-password-toggle:hover {
  background: var(--color-pale-blue);
  color: var(--color-primary);
}

.auth-password-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.auth-password-toggle svg {
  width: 20px;
  height: 20px;
}

.auth-remember {
  display: inline-flex;
  width: max-content;
  min-height: 44px;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  color: var(--color-secondary);
  cursor: pointer;
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

.auth-remember input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.auth-message {
  margin-top: calc(var(--space-2) * -1);
}

.auth-setup-note {
  color: var(--color-warning-strong);
  font-size: var(--font-xs);
  line-height: 1.7;
  text-align: right;
}

.auth-submit {
  position: relative;
  width: 100%;
  min-height: 54px;
  border-radius: 12px;
  background: var(--primary);
  box-shadow: var(--shadow-primary);
  font-size: var(--font-lg);
}

.auth-submit:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-primary-strong);
}

.auth-submit:active:not(:disabled) {
  background: var(--primary-active);
}

.auth-submit:disabled,
.auth-submit[aria-busy="true"] {
  background: var(--text-disabled);
  box-shadow: none;
}

.auth-submit-label {
  flex: 0 0 auto;
}

.auth-submit-arrow {
  display: none;
}

.auth-submit[aria-busy="true"] .auth-submit-arrow,
.auth-submit[aria-busy="true"] .auth-submit-label {
  opacity: 0.72;
}

.auth-footer {
  margin: var(--space-3) 0 0;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: center;
}

.auth-footer span {
  padding-inline: 4px;
  color: var(--color-primary);
}

@media (max-width: 600px) {
  .auth-screen {
    place-items: center;
    padding: 14px 12px;
  }

  .auth-card {
    border-radius: 20px;
  }

  .auth-form-panel {
    padding: 28px 20px 24px;
  }

  .auth-form-heading h2 {
    font-size: 29px;
  }

  .auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]),
  .auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]),
  .auth-submit {
    min-height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit-arrow,
  .auth-form input,
  .auth-password-toggle {
    transition: none;
  }
}

/* SaaS entry gateway -----------------------------------------------------
   The first screen is intentionally a platform-level introduction. It must
   not inherit a tenant's custom identity before authentication resolves. */
.auth-screen[data-auth-stage="gateway"] {
  overflow: auto;
  align-items: center;
}

.auth-screen[data-auth-stage="gateway"] .auth-shell {
  width: min(1040px, 100%);
}

.auth-screen[data-auth-stage="login"] .auth-shell {
  width: min(440px, 100%);
}

.auth-screen[data-auth-stage="login"] .saas-entry-card {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .auth-card {
  display: none;
}

.saas-entry-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-primary);
  border-radius: 28px;
  background: var(--bg-card);
  box-shadow: var(--shadow-popup);
  isolation: isolate;
}

.saas-entry-card::before {
  position: absolute;
  z-index: -1;
  inset: auto -12% -54% 32%;
  height: 78%;
  border-radius: 50%;
  background: var(--primary-soft);
  content: "";
  filter: blur(8px);
  opacity: .9;
  pointer-events: none;
}

.saas-entry-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: clamp(20px, 3vw, 30px) clamp(22px, 4vw, 44px) 0;
}

.saas-entry-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: 16px;
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}

.saas-entry-mark .ui-icon {
  width: 27px;
  height: 27px;
}

.saas-entry-brand-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.saas-entry-brand-copy > span,
.saas-entry-eyebrow,
.saas-entry-action-label,
.tenant-welcome-eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: var(--weight-extrabold);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.saas-entry-brand-copy strong {
  color: var(--text-primary);
  font-size: 23px;
  font-weight: var(--weight-extrabold);
  line-height: 1.1;
}

.saas-entry-brand-copy small {
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.6;
}

.saas-entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  gap: clamp(22px, 4vw, 58px);
  align-items: stretch;
  padding: clamp(26px, 4vw, 48px) clamp(22px, 4vw, 44px) clamp(24px, 4vw, 42px);
}

.saas-entry-copy {
  display: grid;
  align-content: center;
  min-width: 0;
  padding-block: 8px;
}

.saas-entry-copy h1 {
  max-width: 680px;
  margin: 10px 0 12px;
  color: var(--text-primary);
  font-size: clamp(29px, 4.2vw, 49px);
  font-weight: var(--weight-extrabold);
  letter-spacing: -.03em;
  line-height: 1.16;
}

.saas-entry-copy > p {
  max-width: 620px;
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(var(--font-sm), 1.5vw, var(--font-md));
  line-height: 1.9;
}

.saas-entry-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: clamp(24px, 4vw, 38px);
}

.saas-entry-features article {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 15px 13px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.saas-entry-feature-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.saas-entry-feature-icon .ui-icon {
  width: 18px;
  height: 18px;
}

.saas-entry-features article > span:last-child {
  display: grid;
  gap: 3px;
}

.saas-entry-features strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saas-entry-features small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.65;
}

.saas-entry-action {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--primary-border);
  border-radius: 22px;
  background: var(--bg-elevated);
}

.saas-entry-action-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid var(--border-primary);
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
}

.saas-entry-action-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.saas-entry-action h2 {
  margin: 9px 0 8px;
  color: var(--text-primary);
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: var(--weight-extrabold);
}

.saas-entry-action p {
  margin: 0 0 22px;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  line-height: 1.85;
}

.saas-entry-continue {
  width: 100%;
  min-height: 52px;
  border-radius: var(--radius-md);
  font-size: var(--font-md);
}

.saas-entry-continue .ui-icon {
  width: 18px;
  height: 18px;
}

.saas-entry-action > small {
  margin-top: 13px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.tenant-welcome-layer {
  position: fixed;
  z-index: var(--z-modal);
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.tenant-welcome-layer.is-visible {
  opacity: 1;
}

.tenant-welcome-card {
  display: grid;
  width: min(470px, 100%);
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--primary-border);
  border-radius: 22px;
  background: var(--bg-card);
  box-shadow: var(--shadow-popup);
  transform: translateY(8px) scale(.98);
  transition: transform 240ms ease;
}

.tenant-welcome-layer.is-visible .tenant-welcome-card {
  transform: translateY(0) scale(1);
}

.tenant-welcome-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--brand-image-radius);
  background: transparent;
  color: var(--primary);
  font-size: 25px;
  font-weight: var(--weight-extrabold);
}

.tenant-welcome-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 7px;
}

.tenant-welcome-copy {
  min-width: 0;
}

.tenant-welcome-copy h2 {
  margin: 7px 0 4px;
  color: var(--text-primary);
  font-size: clamp(20px, 3vw, 26px);
  font-weight: var(--weight-extrabold);
}

.tenant-welcome-copy h2 strong {
  color: var(--primary);
}

.tenant-welcome-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-sm);
  line-height: 1.7;
}

.tenant-welcome-progress {
  grid-column: 1 / -1;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border-secondary);
}

.tenant-welcome-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: tenant-welcome-progress 1.35s ease-in-out forwards;
}

@keyframes tenant-welcome-progress {
  from { width: 0; }
  to { width: 100%; }
}

@media (max-width: 760px) {
  .saas-entry-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .saas-entry-features {
    grid-template-columns: 1fr;
  }

  .saas-entry-features article {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .saas-entry-feature-icon {
    grid-row: span 2;
  }
}

@media (max-width: 420px) {
  .saas-entry-brand {
    padding-inline: 18px;
  }

  .saas-entry-layout {
    padding-inline: 18px;
  }

  .saas-entry-copy h1 {
    font-size: 30px;
  }

  .tenant-welcome-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .tenant-welcome-mark {
    margin-inline: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tenant-welcome-layer,
  .tenant-welcome-card,
  .tenant-welcome-progress span {
    animation: none;
    transition: none;
  }
}

/* Logic Fit product gateway ---------------------------------------------
   Keep the entry screen product-led: the preview is the visual anchor and
   the authenticated gym action remains the only meaningful CTA. */
body.auth-locked .auth-screen[data-auth-stage="gateway"] {
  background-image: none;
  background-color: var(--bg-app);
}

.auth-screen[data-auth-stage="gateway"] {
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(16px, 3vw, 34px);
}

.auth-screen[data-auth-stage="gateway"] .auth-shell {
  width: min(1240px, 100%);
}

.auth-screen[data-auth-stage="gateway"] .auth-theme-toggle {
  margin-inline-start: auto;
  margin-bottom: clamp(14px, 2vw, 22px);
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-card {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-card::before {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-brand {
  width: max-content;
  max-width: 100%;
  padding: 0 0 clamp(22px, 3vw, 34px);
}

  .auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
    direction: ltr;
    grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr);
    grid-template-areas: "preview copy";
    gap: clamp(24px, 5vw, 72px);
    padding: 0;
  }

.auth-screen[data-auth-stage="gateway"] .saas-entry-copy,
.auth-screen[data-auth-stage="gateway"] .saas-entry-action,
.auth-screen[data-auth-stage="gateway"] .saas-entry-preview {
  direction: rtl;
}

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy {
    grid-area: copy;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(12px, 2vw, 24px) 0 0;
  }

.auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 {
  max-width: 580px;
  margin: 14px 0 14px;
  font-size: clamp(34px, 4.3vw, 58px);
  line-height: 1.14;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-copy > p {
  max-width: 520px;
  font-size: clamp(var(--font-sm), 1.35vw, var(--font-md));
  line-height: 1.85;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: clamp(20px, 3vw, 30px);
}

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features article {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    padding: 9px 0 9px 12px;
    border: 0;
    border-inline-start: 2px solid var(--primary-border);
    border-radius: 0;
    background: transparent;
  }

.auth-screen[data-auth-stage="gateway"] .saas-entry-feature-icon {
  width: 31px;
  height: 31px;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features strong {
  font-size: var(--font-xs);
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features small {
  font-size: 10px;
}

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action {
    grid-area: auto;
    align-self: start;
    width: min(100%, 430px);
    margin-top: clamp(22px, 3vw, 30px);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .saas-entry-action-heading {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0;
    border-radius: 12px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action h2 {
    margin: 4px 0 0;
    font-size: clamp(19px, 2vw, 23px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action p {
    max-width: 390px;
    margin: 11px 0 16px;
    line-height: 1.75;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-continue {
    min-height: 50px;
    width: min(100%, 360px);
  }

.saas-entry-preview {
  position: relative;
  display: grid;
  min-width: 0;
  grid-area: preview;
  align-content: center;
  min-height: 500px;
  isolation: isolate;
}

.saas-entry-preview-layer,
.saas-entry-preview-window {
  position: absolute;
  border: 1px solid var(--border-primary);
  border-radius: 22px;
}

.saas-entry-preview-layer {
  inset: 6% 3% 11% 1%;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
}

.saas-entry-preview-layer-back {
  z-index: -2;
  opacity: .5;
  transform: translate(-18px, 14px) rotate(-3deg);
}

.saas-entry-preview-layer-mid {
  z-index: -1;
  inset: 3% 1% 14% 3%;
  opacity: .75;
  transform: translate(-8px, 7px) rotate(-1.5deg);
}

.saas-entry-preview-window {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 720px);
  min-height: 430px;
  margin: 0 auto 28px;
  grid-template-columns: 58px minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-popup);
  transform: rotate(-1deg);
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.saas-entry-preview:hover .saas-entry-preview-window {
  border-color: var(--border-hover);
  transform: rotate(0deg) translateY(-2px);
}

.saas-entry-preview-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 8px;
  border-inline-end: 1px solid var(--border-secondary);
  background: var(--bg-sidebar);
}

.saas-entry-preview-logo,
.saas-entry-preview-nav {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
}

.saas-entry-preview-logo {
  margin-bottom: 18px;
  border-color: var(--primary-border);
  background: var(--primary);
  color: var(--text-on-primary);
}

.saas-entry-preview-logo .ui-icon {
  width: 19px;
  height: 19px;
}

.saas-entry-preview-nav .ui-icon {
  width: 17px;
  height: 17px;
}

.saas-entry-preview-nav.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.saas-entry-preview-nav-bottom {
  margin-top: auto;
}

.saas-entry-preview-main {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 17px;
  padding: 22px 24px 24px;
  background: var(--bg-card);
}

.saas-entry-preview-topbar,
.saas-entry-preview-welcome,
.saas-entry-preview-section-title,
.saas-entry-preview-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saas-entry-preview-topbar {
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}

.saas-entry-preview-date,
.saas-entry-preview-topbar::before {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--weight-medium);
}

.saas-entry-preview-date {
  order: 2;
  padding: 5px 8px;
  border: 1px solid var(--border-secondary);
  border-radius: 7px;
  background: var(--bg-surface);
}

.saas-entry-preview-welcome {
  align-items: flex-end;
  padding: 13px 15px;
  border: 1px solid var(--border-secondary);
  border-radius: 14px;
  background: var(--bg-surface);
}

.saas-entry-preview-welcome div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.saas-entry-preview-welcome small {
  color: var(--primary);
  font-size: 10px;
  font-weight: var(--weight-bold);
}

.saas-entry-preview-welcome strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saas-entry-preview-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 10px;
}

.saas-entry-preview-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.saas-entry-preview-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.saas-entry-preview-kpis article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border-secondary);
  border-radius: 12px;
  background: var(--bg-surface);
}

.saas-entry-preview-kpis article small {
  align-self: center;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saas-entry-preview-kpis article strong {
  grid-column: 1 / -1;
  color: var(--text-primary);
  font-size: 21px;
  line-height: 1;
}

.saas-entry-preview-kpi-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
}

.saas-entry-preview-kpi-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.saas-entry-preview-kpi-icon.members {
  background: var(--primary-soft);
  color: var(--primary);
}

.saas-entry-preview-kpi-icon.attendance {
  background: var(--success-soft);
  color: var(--success);
}

.saas-entry-preview-kpi-icon.renewals {
  background: var(--warning-soft);
  color: var(--warning);
}

.saas-entry-preview-insights {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(180px, .92fr);
  gap: 10px;
}

.saas-entry-preview-chart,
.saas-entry-preview-activity {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border-secondary);
  border-radius: 13px;
  background: var(--bg-surface);
}

.saas-entry-preview-section-title {
  margin-bottom: 14px;
}

.saas-entry-preview-section-title strong {
  color: var(--text-primary);
  font-size: 11px;
}

.saas-entry-preview-section-title span {
  color: var(--text-muted);
  font-size: 9px;
}

.saas-entry-preview-bars {
  display: flex;
  height: 92px;
  align-items: flex-end;
  gap: 9px;
  padding: 0 7px;
  border-bottom: 1px solid var(--border-secondary);
  background: linear-gradient(to top, var(--border-secondary) 1px, transparent 1px) 0 0 / 100% 25%;
}

.saas-entry-preview-bars i {
  display: block;
  flex: 1 1 0;
  min-width: 8px;
  border-radius: 5px 5px 0 0;
  background: var(--primary);
  opacity: .86;
}

.saas-entry-preview-bars .bar-1 { height: 38%; opacity: .38; }
.saas-entry-preview-bars .bar-2 { height: 54%; opacity: .48; }
.saas-entry-preview-bars .bar-3 { height: 46%; opacity: .58; }
.saas-entry-preview-bars .bar-4 { height: 68%; opacity: .68; }
.saas-entry-preview-bars .bar-5 { height: 76%; opacity: .78; }
.saas-entry-preview-bars .bar-6 { height: 92%; }

.saas-entry-preview-axis {
  display: flex;
  justify-content: space-between;
  padding-top: 7px;
  color: var(--text-disabled);
  font-size: 8px;
}

.saas-entry-preview-activity ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saas-entry-preview-activity li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.45;
}

.saas-entry-preview-activity li span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.saas-entry-preview-activity small {
  color: var(--text-muted);
  font-size: 8px;
}

.activity-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 50%;
}

.activity-dot.purple { background: var(--primary); }
.activity-dot.green { background: var(--success); }
.activity-dot.orange { background: var(--warning); }

.saas-entry-preview-caption {
  position: absolute;
  inset: auto 4px 0;
  color: var(--text-muted);
  font-size: 10px;
}

.saas-entry-preview-caption span:last-child {
  color: var(--primary);
  font-weight: var(--weight-bold);
}

@media (max-width: 980px) {
  .auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
    grid-template-columns: minmax(0, 1.06fr) minmax(280px, .94fr);
    gap: 28px;
  }

  .saas-entry-preview {
    min-height: 450px;
  }

  .saas-entry-preview-main {
    padding: 18px;
  }

  .saas-entry-preview-insights {
    grid-template-columns: 1fr;
  }

  .saas-entry-preview-activity {
    display: none;
  }
}

@media (max-width: 760px) {
  .auth-screen[data-auth-stage="gateway"] {
    align-items: start;
    padding: 16px 14px 26px;
  }

  .auth-screen[data-auth-stage="gateway"] .auth-theme-toggle {
    margin-bottom: 18px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-brand {
    width: 100%;
    padding-bottom: 22px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
    display: flex;
    flex-direction: column;
    gap: 17px;
    direction: rtl;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy {
    display: contents;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy > .saas-entry-eyebrow {
    order: 1;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy > h1 {
    order: 2;
    max-width: 620px;
    margin: 0;
    font-size: clamp(34px, 9vw, 48px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy > p {
    order: 3;
    max-width: 620px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action {
    order: 4;
    width: 100%;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-preview {
    order: 5;
    width: 100%;
    min-height: 360px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features {
    order: 6;
    width: 100%;
    margin-top: 0;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-continue {
    width: 100%;
  }

  .saas-entry-preview-layer-back {
    transform: translate(-8px, 8px) rotate(-2deg);
  }

  .saas-entry-preview-layer-mid {
    transform: translate(-4px, 4px) rotate(-1deg);
  }

  .saas-entry-preview-window {
    min-height: 350px;
    margin-bottom: 25px;
    transform: none;
  }

  .saas-entry-preview:hover .saas-entry-preview-window {
    transform: translateY(-1px);
  }

  .saas-entry-preview-main {
    gap: 12px;
    padding: 14px;
  }

  .saas-entry-preview-kpis article {
    padding: 9px;
  }

  .saas-entry-preview-kpis article strong {
    font-size: 18px;
  }

  .saas-entry-preview-bars {
    height: 76px;
  }

  .saas-entry-preview-caption {
    inset-inline: 0;
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .auth-screen[data-auth-stage="gateway"] .saas-entry-preview-window {
    grid-template-columns: 48px minmax(0, 1fr);
    border-radius: 17px;
  }

  .saas-entry-preview-sidebar {
    gap: 9px;
    padding: 12px 6px;
  }

  .saas-entry-preview-logo,
  .saas-entry-preview-nav {
    width: 29px;
    height: 29px;
  }

  .saas-entry-preview-logo {
    margin-bottom: 10px;
  }

  .saas-entry-preview-main {
    padding: 12px 10px;
  }

  .saas-entry-preview-welcome {
    padding: 10px;
  }

  .saas-entry-preview-kpis {
    gap: 5px;
  }

  .saas-entry-preview-kpis article {
    gap: 4px;
    padding: 7px 6px;
  }

  .saas-entry-preview-kpi-icon {
    width: 21px;
    height: 21px;
  }

  .saas-entry-preview-kpis article small {
    font-size: 8px;
  }

  .saas-entry-preview-kpis article strong {
    font-size: 16px;
  }

  .saas-entry-preview-section-title {
    margin-bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .saas-entry-preview-window {
    transition: none;
    transform: none;
  }
}

/* Final gateway fit: keep the product preview and entry action inside the
   first viewport on normal desktop displays without changing the auth flow. */
@media (min-width: 1024px) {
  .auth-screen[data-auth-stage="gateway"] {
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
    padding: clamp(14px, 2vw, 26px);
  }

  .auth-screen[data-auth-stage="gateway"] .auth-shell {
    display: flex;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
  }

  .auth-screen[data-auth-stage="gateway"] .auth-theme-toggle {
    margin-bottom: clamp(10px, 1.5vw, 18px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-brand {
    padding-bottom: clamp(14px, 2vw, 24px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
    align-items: center;
    gap: clamp(24px, 4vw, 58px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy {
    padding-top: 0;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 {
    margin-block: 10px 11px;
    font-size: clamp(32px, 4vw, 52px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy > p {
    line-height: 1.7;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action {
    margin-top: 16px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action p {
    margin-block: 7px 12px;
    line-height: 1.65;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features {
    margin-top: 14px;
  }

  .saas-entry-preview {
    min-height: clamp(360px, calc(100svh - 252px), 470px);
  }

  .saas-entry-preview-window {
    min-height: clamp(340px, calc(100svh - 315px), 405px);
    margin-bottom: 18px;
  }
}

@media (min-width: 1024px) and (max-height: 760px) {
  .auth-screen[data-auth-stage="gateway"] {
    padding-block: 10px;
  }

  .auth-screen[data-auth-stage="gateway"] .auth-theme-toggle {
    margin-bottom: 8px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-brand {
    padding-bottom: 10px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
    gap: 26px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 {
    margin-block: 7px 8px;
    font-size: clamp(30px, 3.6vw, 46px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy > p {
    font-size: var(--font-sm);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action {
    margin-top: 10px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features {
    margin-top: 8px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features article {
    gap: 8px;
    padding-block: 4px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-feature-icon {
    width: 27px;
    height: 27px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features small {
    line-height: 1.35;
  }

  .saas-entry-preview {
    min-height: clamp(320px, calc(100svh - 214px), 400px);
  }

  .saas-entry-preview-window {
    min-height: clamp(300px, calc(100svh - 360px), 350px);
  }

  .saas-entry-preview-main {
    gap: 9px;
    padding: 12px;
  }

  .saas-entry-preview-welcome {
    padding: 10px 12px;
  }

  .saas-entry-preview-kpis article {
    padding: 7px;
  }

  .saas-entry-preview-kpis article strong {
    font-size: 17px;
  }

  .saas-entry-preview-bars {
    height: 62px;
  }
}

@media (min-width: 761px) and (max-width: 1023px) {
  .auth-screen[data-auth-stage="gateway"] {
    min-height: 100svh;
    overflow-y: auto;
  }
}

@media (max-width: 760px) {
  .auth-screen[data-auth-stage="gateway"] {
    min-height: 100svh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* SaaS gateway direction ---------------------------------------------------
   The gateway is a product introduction, not a second dashboard. Keep this
   visual layer scoped to the pre-login stage so the real auth form and its
   stage transition remain untouched. */
.auth-screen[data-auth-stage="gateway"] {
  display: block;
  align-items: stretch;
  overflow-x: hidden;
  padding: 0;
  background-color: var(--bg-surface);
  background-image:
    radial-gradient(circle at 82% 42%, var(--primary-soft), transparent 34%),
    radial-gradient(circle at 78% 48%, color-mix(in srgb, var(--primary) 8%, transparent) 1px, transparent 1.5px);
  background-size: auto, 18px 18px;
}

.auth-screen[data-auth-stage="gateway"]::before {
  background: radial-gradient(circle at 72% 52%, var(--primary-soft), transparent 34%);
  opacity: .72;
}

.auth-screen[data-auth-stage="gateway"] .auth-shell {
  display: block;
  width: 100%;
  min-height: 100dvh;
  margin: 0;
}

.auth-screen[data-auth-stage="gateway"] .auth-theme-toggle {
  position: absolute;
  top: clamp(24px, 4vh, 42px);
  inset-inline-end: clamp(22px, 3.2vw, 58px);
  z-index: 6;
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding-inline: 15px;
  flex-direction: row-reverse;
  gap: 8px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--bg-card) 84%, transparent);
  color: var(--text-secondary);
  box-shadow: 0 8px 20px rgb(2 12 30 / .1);
  font-size: var(--font-sm);
}

.auth-screen[data-auth-stage="gateway"] .auth-theme-toggle:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: var(--primary);
  transform: translateY(-1px);
}

.auth-screen[data-auth-stage="gateway"] .auth-theme-toggle:active {
  transform: translateY(0);
}

.auth-screen[data-auth-stage="gateway"] .auth-theme-toggle > span[data-theme-toggle-label] {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
}

.auth-screen[data-auth-stage="gateway"] .auth-theme-toggle .ui-icon {
  width: 19px;
  height: 19px;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-card {
  display: grid;
  width: 100%;
  min-height: 100svh;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 72% 44%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 34%),
    radial-gradient(circle, color-mix(in srgb, var(--primary) 12%, transparent) 1px, transparent 1.4px) 0 0 / 18px 18px,
    var(--bg-surface);
  box-shadow: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-card::before {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-brand {
  position: absolute;
  top: clamp(26px, 4vh, 48px);
  inset-inline-start: clamp(24px, 4.8vw, 88px);
  z-index: 5;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: row-reverse;
  direction: rtl;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  box-shadow: var(--shadow-primary);
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-mark .ui-icon {
  width: 24px;
  height: 24px;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-brand-copy {
  text-align: right;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-brand-copy strong {
  font-size: 21px;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-brand-copy small {
  max-width: 260px;
  font-size: 11px;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
  display: grid;
  position: relative;
  min-height: 100svh;
  height: 100dvh;
  direction: ltr;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  grid-template-areas: "preview copy";
  gap: 0;
  align-items: center;
  padding: 0;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-copy {
  display: flex;
  grid-area: copy;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  height: 100%;
  padding-block: clamp(86px, 10vh, 128px) clamp(58px, 7vh, 88px);
  padding-inline: clamp(52px, 6.8vw, 124px) clamp(34px, 4.2vw, 84px);
  direction: rtl;
  text-align: right;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-eyebrow {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-eyebrow::after {
  width: 44px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--primary-border);
  content: "";
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 {
  max-width: 720px;
  margin: 18px 0 20px;
  font-size: clamp(40px, 4.35vw, 72px);
  letter-spacing: -.035em;
  line-height: 1.1;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 span {
  display: block;
  background: linear-gradient(110deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 58%, var(--text-primary-soft) 42%) 58%, var(--text-primary-soft) 100%);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-copy > p {
  max-width: 620px;
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(var(--font-md), 1.4vw, 20px);
  line-height: 1.8;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-action {
  width: min(100%, 560px);
  margin-top: clamp(26px, 2.5vw, 36px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-action-heading {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-action-icon {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-action-label {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-action h2 {
  margin: 4px 0 0;
  font-size: clamp(20px, 2vw, 24px);
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-action > p {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-continue {
  width: 100%;
  min-height: 68px;
  margin-top: 0;
  border-radius: 16px;
  background: linear-gradient(110deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 48%, var(--text-primary-soft) 52%) 100%);
  box-shadow: 0 18px 38px color-mix(in srgb, var(--primary) 25%, transparent);
  font-size: clamp(var(--font-md), 1.5vw, 20px);
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-action > small {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features {
  width: min(100%, 600px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: clamp(20px, 2.2vw, 30px);
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features article {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-feature-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features article > span:last-child {
  display: block;
  min-width: 0;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features strong {
  display: block;
  overflow: visible;
  font-size: clamp(11px, 1vw, 15px);
  line-height: 1.45;
  text-overflow: clip;
  white-space: nowrap;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-features small {
  display: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-preview {
  position: relative;
  display: block;
  grid-area: preview;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: var(--bg-sidebar);
  box-shadow: none;
  isolation: isolate;
  direction: rtl;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-preview::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background-image: linear-gradient(145deg, rgb(2 12 30 / .04), rgb(2 12 30 / .32)), url("/assets/gym-background.webp");
  background-position: center center;
  background-size: cover;
  content: "";
  filter: brightness(1.02) contrast(1.03) saturate(1.08);
  border-radius: inherit;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-preview::after {
  position: absolute;
  z-index: 1;
  inset-block: -8%;
  inset-inline-start: -3%;
  width: 25%;
  background: var(--bg-surface);
  border-inline-end: 2px solid color-mix(in srgb, var(--primary) 70%, var(--text-primary-soft) 30%);
  border-radius: 50% 0 0 50% / 50% 0 0 50%;
  box-shadow: -8px 0 24px color-mix(in srgb, var(--primary) 18%, transparent), -2px 0 12px color-mix(in srgb, var(--text-primary-soft) 18%, transparent);
  content: "";
  opacity: .98;
  pointer-events: none;
}

.auth-screen[data-auth-stage="gateway"] .saas-entry-preview-layer,
.auth-screen[data-auth-stage="gateway"] .saas-entry-preview-window,
.auth-screen[data-auth-stage="gateway"] .saas-entry-preview-caption {
  display: none;
}

.saas-entry-preview-glass-panel {
  position: absolute;
  top: 50%;
  inset-inline-start: clamp(-16px, -.8vw, -8px);
  inset-inline-end: auto;
  z-index: 3;
  display: grid;
  gap: 16px;
  width: min(470px, calc(100% - 74px));
  max-height: calc(100% - 72px);
  padding: clamp(24px, 2.7vw, 32px);
  border: 1px solid rgb(184 194 255 / .54);
  border-radius: 30px;
  background: linear-gradient(135deg, rgb(28 50 103 / .62), rgb(8 22 49 / .5));
  box-shadow: 0 28px 68px rgb(2 7 24 / .44), 0 0 26px rgb(76 83 255 / .14), inset 0 1px 0 rgb(255 255 255 / .13);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  transform: translateY(-50%);
}

.saas-entry-preview-glass-brand,
.saas-entry-preview-glass-brand > span:last-child,
.saas-entry-preview-glass-list > div,
.saas-entry-preview-glass-list > div > span:last-child {
  display: grid;
}

.saas-entry-preview-glass-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgb(167 190 255 / .18);
  direction: ltr;
  text-align: left;
}

.saas-entry-preview-glass-brand > span:last-child {
  gap: 3px;
  justify-items: start;
  direction: ltr;
  text-align: left;
}

.saas-entry-preview-glass-brand strong {
  color: rgb(246 248 255);
  font-size: clamp(20px, 1.8vw, 25px);
  font-weight: var(--weight-extrabold);
  line-height: 1.1;
}

.saas-entry-preview-glass-brand small {
  color: rgb(159 178 217);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: .12em;
}

.saas-entry-preview-glass-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgb(150 159 255 / .35);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--text-primary-soft));
  color: var(--text-on-primary);
  box-shadow: 0 10px 24px rgb(41 86 255 / .3);
}

.saas-entry-preview-glass-mark .ui-icon {
  width: 21px;
  height: 21px;
}

.saas-entry-preview-glass-list {
  display: grid;
  gap: 0;
}

.saas-entry-preview-glass-list > div {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgb(167 190 255 / .16);
  direction: ltr;
}

.saas-entry-preview-glass-list > div:last-child {
  border-bottom: 0;
}

.saas-entry-preview-glass-list > div > span:last-child {
  gap: 1px;
  min-width: 0;
  direction: rtl;
  text-align: right;
}

.saas-entry-preview-glass-list strong {
  color: rgb(246 248 255);
  font-size: clamp(var(--font-md), 1.5vw, var(--font-lg));
  font-weight: var(--weight-bold);
}

.saas-entry-preview-glass-list small {
  overflow: hidden;
  color: rgb(184 199 226);
  font-size: clamp(10px, 1vw, 13px);
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: normal;
}

.saas-entry-preview-glass-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgb(111 93 255 / .6);
  border-radius: 15px;
  background: rgb(18 31 75 / .76);
  color: rgb(125 164 255);
  box-shadow: inset 0 0 0 1px rgb(72 91 185 / .18);
}

.saas-entry-preview-glass-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.saas-entry-preview-glass-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgb(167 190 255 / .16);
  text-align: center;
  color: rgb(184 199 226);
  font-size: 11px;
  line-height: 1.6;
}

.saas-entry-preview-glass-note .ui-icon {
  width: 16px;
  height: 16px;
  color: rgb(201 215 255);
}

.saas-entry-copyright {
  position: absolute;
  right: 0;
  bottom: clamp(14px, 2.2vh, 24px);
  left: 0;
  z-index: 5;
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

@media (max-width: 1023px) and (min-width: 761px) {
  .auth-screen[data-auth-stage="gateway"] .auth-theme-toggle {
    top: 24px;
    inset-inline-end: 28px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-brand {
    position: relative;
    top: auto;
    inset-inline-start: auto;
    width: 100%;
    padding: 82px 28px 24px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    gap: 34px;
    padding: 0 28px 42px;
    direction: rtl;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy {
    display: flex;
    width: 100%;
    height: auto;
    align-items: stretch;
    order: 1;
    padding: 0;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 {
    max-width: 720px;
    font-size: clamp(42px, 6vw, 62px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy > p {
    max-width: 680px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action {
    max-width: 560px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features {
    max-width: 680px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-preview {
    order: 2;
    width: 100%;
    height: auto;
    min-height: 500px;
    overflow: hidden;
    border-radius: 28px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-preview::after {
    inset: 0;
    width: auto;
    background: linear-gradient(145deg, transparent 10%, rgb(2 6 23 / .64));
    border: 0;
    border-radius: inherit;
    box-shadow: none;
  }

  .saas-entry-preview-glass-panel {
    inset-inline-start: 50%;
    inset-inline-end: auto;
    width: min(560px, calc(100% - 48px));
    max-height: calc(100% - 32px);
    padding: 28px;
    transform: translate(50%, -50%);
  }
}

@media (max-width: 760px) {
  .auth-screen[data-auth-stage="gateway"] {
    display: block;
    align-items: start;
    min-height: 100dvh;
    padding: 0;
  }

  .auth-screen[data-auth-stage="gateway"] .auth-shell {
    display: block;
    width: 100%;
    min-height: 100dvh;
  }

  .auth-screen[data-auth-stage="gateway"] .auth-theme-toggle {
    top: 16px;
    inset-inline-end: 16px;
    margin: 0;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-brand {
    position: relative;
    top: auto;
    inset-inline-start: auto;
    z-index: 5;
    width: 100%;
    margin: 0;
    padding: 78px 18px 18px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    gap: 26px;
    padding: 0 16px 30px;
    direction: rtl;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy {
    display: flex;
    width: 100%;
    height: auto;
    align-items: stretch;
    order: 1;
    padding: 0;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 {
    max-width: 620px;
    margin-block: 14px 12px;
    font-size: clamp(33px, 9vw, 46px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy > p {
    max-width: 620px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action {
    width: 100%;
    max-width: 430px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features {
    width: 100%;
    max-width: 560px;
    margin-top: 24px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-preview {
    position: relative;
    order: 2;
    width: 100%;
    height: auto;
    min-height: clamp(332px, 82vw, 390px);
    overflow: hidden;
    border-radius: 26px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-preview::after {
    inset: 0;
    width: auto;
    background: linear-gradient(145deg, transparent 10%, rgb(2 6 23 / .64));
    border: 0;
    border-radius: inherit;
    box-shadow: none;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-action {
    margin-top: 24px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-continue {
    min-height: 58px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy-break {
    display: none;
  }

  .saas-entry-preview-glass-panel {
    top: 50%;
    inset-inline: 6%;
    width: auto;
    max-height: none;
    gap: 14px;
    padding: 20px;
    border-radius: 20px;
    transform: translateY(-50%);
  }

  .saas-entry-preview-glass-brand {
    padding-bottom: 14px;
  }

  .saas-entry-preview-glass-mark {
    width: 44px;
    height: 44px;
  }

  .saas-entry-preview-glass-list > div {
    gap: 10px;
    padding: 10px 0;
  }

  .saas-entry-preview-glass-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .saas-entry-preview-glass-panel .saas-entry-preview-glass-list strong {
    font-size: var(--font-sm);
  }

  .saas-entry-preview-glass-panel .saas-entry-preview-glass-list small {
    font-size: 10px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copyright {
    position: static;
    margin: 0 0 18px;
  }
}

@media (max-width: 420px) {
  .auth-screen[data-auth-stage="gateway"] .saas-entry-brand-copy strong {
    font-size: 19px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-brand-copy small {
    font-size: 10px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-copy h1 {
    font-size: clamp(34px, 10vw, 44px);
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-eyebrow {
    font-size: 10px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features {
    gap: 7px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features article {
    gap: 5px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-feature-icon {
    width: 22px;
    height: 22px;
  }

  .auth-screen[data-auth-stage="gateway"] .saas-entry-features strong {
    font-size: 9px;
  }

  .saas-entry-preview-glass-panel {
    inset-inline: 7%;
    gap: 10px;
    padding: 15px;
  }

  .saas-entry-preview-glass-list {
    gap: 5px;
  }

  .saas-entry-preview-glass-list > div {
    gap: 8px;
    padding: 7px 0;
  }

  .saas-entry-preview-glass-list small {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen[data-auth-stage="gateway"] .auth-theme-toggle,
  .saas-entry-preview-glass-panel {
    transition: none;
  }
}

/* Reference login experience --------------------------------------------
   This is the canonical pre-auth surface. The existing authentication hooks
   remain unchanged; this layer owns only the rendered composition. */
.auth-screen[data-auth-stage="login"] {
  --auth-bg: #f3f7fc;
  --auth-surface: rgb(255 255 255 / .88);
  --auth-surface-solid: #ffffff;
  --auth-input: #f8fbff;
  --auth-border: #d7e5f7;
  --auth-text: #0b1e42;
  --auth-muted: #6d7d98;
  --auth-blue: #1769e8;
  --auth-blue-bright: #168ff9;
  --auth-shadow: 0 28px 70px rgb(20 67 129 / .16);
  display: block;
  min-height: 100dvh;
  overflow: hidden;
  padding: 0;
  background: var(--auth-bg);
}
.auth-screen[data-auth-stage="login"]::before { display: none; }

html[data-theme="dark"] .auth-screen[data-auth-stage="login"] {
  --auth-bg: #020b18;
  --auth-surface: rgb(7 22 41 / .86);
  --auth-surface-solid: #08182b;
  --auth-input: rgb(10 30 53 / .78);
  --auth-border: rgb(137 171 218 / .32);
  --auth-text: #f7fbff;
  --auth-muted: #a7b8d0;
  --auth-blue: #2584ff;
  --auth-blue-bright: #1597ff;
  --auth-shadow: 0 30px 90px rgb(0 0 0 / .42);
}

.auth-screen[data-auth-stage="login"] .auth-shell {
  display: grid;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  grid-template-columns: minmax(0, 1.82fr) minmax(0, 1fr);
  margin: 0;
  direction: ltr;
  column-gap: 0;
}

.auth-screen[data-auth-stage="login"] .auth-reference-hero {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  direction: ltr;
  color: #fff;
}

.auth-reference-hero-backdrop {
  position: absolute;
  z-index: -3;
  inset: 0;
  background:
    linear-gradient(90deg, rgb(2 8 18 / .9) 0%, rgb(2 8 18 / .62) 42%, rgb(2 8 18 / .16) 100%),
    linear-gradient(180deg, rgb(2 8 18 / .24), rgb(2 8 18 / .7)),
    url("/assets/gym-background.webp") center / cover no-repeat;
  transform: scale(1.02);
}

.auth-reference-hero::after {
  position: absolute;
  z-index: 1;
  right: 1%;
  bottom: -1%;
  width: min(54%, 610px);
  height: 94%;
  background: url("/assets/login-athlete.webp") center bottom / auto 100% no-repeat;
  content: "";
  filter: drop-shadow(-16px 12px 28px rgb(0 0 0 / .32));
  pointer-events: none;
}

.auth-reference-hero-curve {
  position: absolute;
  z-index: 0;
  top: -24%;
  right: -43%;
  width: 82%;
  height: 148%;
  border: 54px solid transparent;
  border-left-color: rgb(4 35 83 / .96);
  border-radius: 50%;
  transform: rotate(7deg);
  pointer-events: none;
}

.auth-reference-hero-curve::after {
  position: absolute;
  top: -51px;
  right: 22px;
  width: 100%;
  height: 100%;
  border: 16px solid transparent;
  border-left-color: #1769e8;
  border-radius: 50%;
  content: "";
}

.auth-reference-hero-content {
  position: relative;
  z-index: 3;
  display: flex;
  width: min(64%, 710px);
  min-height: 100%;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: clamp(60px, 8vh, 72px) clamp(28px, 4.4vw, 80px) clamp(58px, 8vh, 74px);
  direction: ltr;
}

.auth-reference-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
}

.auth-reference-brand-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #168ff9, #1655e8);
  color: #fff;
  box-shadow: 0 10px 24px rgb(23 105 232 / .32);
}

.auth-reference-brand-icon .ui-icon { width: 31px; height: 31px; }

.auth-reference-brand-copy { display: grid; gap: 1px; }
.auth-reference-brand-copy strong {
  color: #f6f9ff;
  font-family: var(--font-heading);
  font-size: clamp(1.32rem, 2vw, 1.75rem);
  font-weight: 800;
  line-height: 1;
}
.auth-reference-brand-copy small {
  color: rgb(217 229 248 / .74);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  line-height: 1.6;
}

.auth-reference-badge {
  display: inline-flex;
  margin-top: clamp(34px, 5vh, 46px);
  padding: 7px 13px;
  border: 1px solid rgb(55 147 255 / .58);
  border-radius: 8px;
  background: rgb(3 19 42 / .52);
  color: #91c7ff;
  font-size: clamp(.65rem, .8vw, .78rem);
  font-weight: 700;
  white-space: nowrap;
}

.auth-reference-copy {
  margin-top: clamp(52px, 7vh, 66px);
  direction: rtl;
  text-align: left;
}

.auth-reference-copy h1 {
  margin: 0;
  color: #f8fbff;
  font-size: clamp(2.6rem, 3vw, 3.45rem);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.12;
  text-wrap: balance;
}

.auth-reference-copy h1 strong {
  color: #2388ff;
  font-weight: 800;
}

.auth-reference-copy p {
  margin: 18px 0 0;
  color: rgb(229 238 250 / .84);
  font-size: clamp(.82rem, .95vw, .98rem);
  line-height: 1.95;
}

.auth-reference-features {
  display: grid;
  width: min(100%, 540px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.7vw, 24px);
  margin-top: clamp(28px, 4vh, 38px);
  direction: ltr;
}

.auth-reference-features article {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  color: #f2f7ff;
  font-size: clamp(.68rem, .9vw, .82rem);
  font-weight: 700;
  line-height: 1.38;
  text-align: center;
}

.auth-reference-feature-icon {
  display: grid;
  width: clamp(46px, 4vw, 60px);
  height: clamp(46px, 4vw, 60px);
  place-items: center;
  border: 1px solid rgb(28 131 255 / .66);
  border-radius: 14px;
  background: rgb(5 27 58 / .62);
  color: #2b94ff;
  box-shadow: inset 0 0 18px rgb(24 131 255 / .07), 0 8px 20px rgb(0 0 0 / .16);
}
.auth-reference-feature-icon .ui-icon { width: 24px; height: 24px; }

.auth-reference-hero-footer {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: clamp(24px, 4vh, 44px);
  color: rgb(221 235 252 / .82);
  font-size: clamp(.68rem, .85vw, .82rem);
}
.auth-reference-hero-footer span {
  display: block;
  width: 42px;
  height: 2px;
  background: #1b91ff;
  box-shadow: 0 0 12px rgb(27 145 255 / .7);
}

.auth-screen[data-auth-stage="login"] .auth-theme-toggle {
  position: absolute;
  z-index: 12;
  top: 28px;
  right: clamp(184px, 15vw, 274px);
  display: inline-flex;
  width: 112px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--auth-border);
  border-radius: 14px;
  background: var(--auth-surface);
  color: var(--auth-text);
  padding: 0 13px;
  box-shadow: 0 8px 22px rgb(11 30 66 / .08);
  backdrop-filter: blur(14px);
}
.auth-reference-controls {
  position: absolute;
  z-index: 12;
  top: 28px;
  right: clamp(20px, 4.3vw, 80px);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.auth-language-control {
  display: inline-flex;
  min-width: 150px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--auth-border);
  border-radius: 14px;
  background: var(--auth-surface);
  color: var(--auth-text);
  font-size: .78rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgb(11 30 66 / .08);
  direction: rtl;
}
.auth-language-control .ui-icon { width: 19px; height: 19px; color: var(--auth-blue); }
.auth-screen[data-auth-stage="login"] .auth-theme-toggle > span[data-theme-toggle-label] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.auth-screen[data-auth-stage="login"] .auth-theme-toggle:hover,
.auth-screen[data-auth-stage="login"] .auth-theme-toggle:focus-visible {
  border-color: var(--auth-blue);
  color: var(--auth-blue);
}
.auth-screen[data-auth-stage="login"] .auth-theme-toggle > span[data-theme-toggle-label] { font-size: .7rem; }
.auth-screen[data-auth-stage="login"] .auth-theme-toggle .ui-icon { width: 19px; height: 19px; }

.auth-screen[data-auth-stage="login"] .auth-card {
  display: grid;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 100%;
  grid-column: 2;
  place-items: center end;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: var(--auth-bg);
  box-shadow: none;
  direction: rtl;
  padding: clamp(56px, 8vh, 78px) 0 clamp(100px, 12vh, 116px);
  padding-inline-end: 0;
  transform: translateY(5px);
}

.auth-screen[data-auth-stage="login"] .auth-form-panel {
  width: min(100%, 580px);
  min-height: 596px;
  box-sizing: border-box;
  padding: 62px 38px 30px;
  border: 1px solid var(--auth-border);
  border-radius: 28px;
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(18px);
}

.auth-screen[data-auth-stage="login"] .auth-branding-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  direction: ltr;
  text-align: left;
}
.auth-screen[data-auth-stage="login"] .auth-branding-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  box-shadow: none;
}
.auth-screen[data-auth-stage="login"] .auth-branding-dumbbell { display: grid; place-items: center; }
.auth-screen[data-auth-stage="login"] .auth-branding-dumbbell .ui-icon { width: 54px; height: 54px; color: var(--auth-blue-bright); }
.auth-screen[data-auth-stage="login"] .auth-branding-mark img[data-brand-logo],
.auth-screen[data-auth-stage="login"] .auth-branding-mark [data-brand-logo-fallback] { display: none; }
.auth-screen[data-auth-stage="login"] .auth-branding-copy { display: grid; gap: 3px; }
.auth-screen[data-auth-stage="login"] .auth-branding-copy strong {
  color: var(--auth-text);
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
}
.auth-screen[data-auth-stage="login"] .auth-branding-copy small {
  color: var(--auth-muted);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .16em;
}

.auth-screen[data-auth-stage="login"] .auth-form { gap: 18px; margin-top: 32px; }
.auth-screen[data-auth-stage="login"] .auth-form-heading { margin-bottom: 2px; text-align: center; }
.auth-screen[data-auth-stage="login"] .auth-form-heading h2 {
  color: var(--auth-text);
  font-size: clamp(1.42rem, 2.2vw, 1.8rem);
  font-weight: 800;
}
.auth-screen[data-auth-stage="login"] .auth-form-heading p {
  margin-top: 7px;
  color: var(--auth-muted);
  font-size: .82rem;
}
.auth-screen[data-auth-stage="login"] .auth-field { gap: 7px; }
.auth-screen[data-auth-stage="login"] .auth-field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auth-screen[data-auth-stage="login"] .auth-field > label,
.auth-screen[data-auth-stage="login"] .auth-remember { color: var(--auth-text); font-size: .78rem; font-weight: 700; }
.auth-screen[data-auth-stage="login"] .auth-input-wrap,
.auth-screen[data-auth-stage="login"] .auth-password-wrap {
  min-height: 58px;
  border: 1px solid var(--auth-border);
  border-radius: 14px;
  background: var(--auth-input);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-screen[data-auth-stage="login"] .auth-input-wrap:focus-within,
.auth-screen[data-auth-stage="login"] .auth-password-wrap:focus-within {
  border-color: var(--auth-blue);
  background: var(--auth-surface-solid);
  box-shadow: 0 0 0 4px rgb(23 105 232 / .12);
}
.auth-screen[data-auth-stage="login"] .auth-input-wrap > input,
.auth-screen[data-auth-stage="login"] .auth-password-wrap > input {
  min-height: 56px;
  background: transparent;
  color: var(--auth-text);
  font-size: .9rem;
}
.auth-screen[data-auth-stage="login"] .auth-input-icon { color: var(--auth-blue); }
.auth-screen[data-auth-stage="login"] .auth-input-wrap input::placeholder,
.auth-screen[data-auth-stage="login"] .auth-password-wrap input::placeholder { color: var(--auth-muted); }
.auth-screen[data-auth-stage="login"] .auth-password-toggle {
  color: var(--auth-muted);
  transition: color .18s ease, background .18s ease;
}
.auth-screen[data-auth-stage="login"] .auth-password-toggle:hover,
.auth-screen[data-auth-stage="login"] .auth-password-toggle:focus-visible {
  color: var(--auth-blue);
  background: rgb(23 105 232 / .08);
}
.auth-screen[data-auth-stage="login"] .auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -2px;
}
.auth-screen[data-auth-stage="login"] .auth-account-row {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  direction: rtl;
}
.auth-screen[data-auth-stage="login"] .auth-account-row .auth-remember { margin-top: 0; }
.auth-screen[data-auth-stage="login"] .auth-forgot-note {
  color: var(--auth-blue-bright);
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
}
.auth-screen[data-auth-stage="login"] .auth-remember input { width: 18px; height: 18px; accent-color: var(--auth-blue); }
.auth-screen[data-auth-stage="login"] .auth-submit {
  min-height: 62px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--auth-blue-bright), #2d56ec);
  box-shadow: 0 14px 24px rgb(23 105 232 / .22);
  font-size: 1rem;
}
.auth-screen[data-auth-stage="login"] .auth-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #2aa3ff, #3563f1);
  box-shadow: 0 16px 28px rgb(23 105 232 / .3);
  transform: translateY(-1px);
}
.auth-screen[data-auth-stage="login"] .auth-submit-arrow { display: inline-block; width: 20px; height: 20px; }
.auth-screen[data-auth-stage="login"] .auth-message { margin-top: -4px; border-radius: 12px; }
.auth-screen[data-auth-stage="login"] .auth-footer {
  margin-top: 22px;
  color: var(--auth-muted);
  font-size: .67rem;
}

.auth-screen[data-auth-stage="login"] .saas-entry-card,
.auth-screen[data-auth-stage="login"] .saas-entry-copyright { display: none; }

@media (max-width: 1180px) {
  .auth-screen[data-auth-stage="login"] .auth-shell { grid-template-columns: minmax(0, 1.12fr) minmax(400px, .88fr); }
  .auth-reference-hero-content { width: min(76%, 680px); padding-inline-start: clamp(24px, 4.5vw, 68px); }
  .auth-reference-copy h1 { font-size: clamp(2.25rem, 3.6vw, 3.2rem); }
  .auth-reference-hero::after { right: -5%; width: min(58%, 560px); height: 92%; }
  .auth-reference-hero-curve { right: -40%; width: 78%; }
  .auth-reference-security { left: calc(64% + 4px); }
}

@media (max-width: 860px) {
  .auth-reference-controls { top: 18px; right: 18px; }
  .auth-screen[data-auth-stage="login"] .auth-theme-toggle { right: 188px; }
  .auth-screen[data-auth-stage="login"] { overflow: auto; }
  .auth-screen[data-auth-stage="login"] .auth-shell {
    min-height: 100dvh;
    height: auto;
    grid-template-columns: 1fr;
  }
  .auth-screen[data-auth-stage="login"] .auth-reference-hero {
    min-height: 390px;
    overflow: hidden;
  }
  .auth-reference-hero-content { width: 72%; min-height: 390px; padding: 60px 28px 30px; }
  .auth-reference-hero::after { right: -9%; width: 47%; height: 118%; }
  .auth-reference-hero-curve { right: -18%; top: 57%; width: 70%; height: 65%; border-width: 12px; transform: rotate(-7deg); }
  .auth-reference-hero-curve::after { top: -11px; border-width: 6px; }
  .auth-screen[data-auth-stage="login"] .auth-card {
    grid-column: 1;
    min-height: auto;
    padding: 56px 24px 34px;
  }
  .auth-screen[data-auth-stage="login"] .auth-theme-toggle { top: 18px; }
}

@media (max-width: 560px) {
  .auth-reference-controls { top: 14px; right: 14px; }
  .auth-language-control { min-width: 42px; width: 42px; padding: 0; }
  .auth-language-control > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .auth-screen[data-auth-stage="login"] .auth-theme-toggle { right: 70px; width: 42px; padding: 0; }
  .auth-screen[data-auth-stage="login"] .auth-reference-hero { min-height: 340px; }
  .auth-reference-hero-content { width: 100%; min-height: 340px; justify-content: flex-start; padding: 28px 20px 24px; }
  .auth-reference-brand-icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: 12px; }
  .auth-reference-brand-icon .ui-icon { width: 27px; height: 27px; }
  .auth-reference-brand-copy strong { font-size: 1.2rem; }
  .auth-reference-brand-copy small { font-size: 7px; }
  .auth-reference-badge { margin-top: 22px; font-size: .62rem; }
  .auth-reference-copy { margin-top: 18px; }
  .auth-reference-copy h1 { font-size: clamp(2rem, 10vw, 2.8rem); }
  .auth-reference-copy p { margin-top: 10px; font-size: .75rem; line-height: 1.7; }
  .auth-reference-copy-break { display: none; }
  .auth-reference-features { width: min(92%, 360px); gap: 6px; margin-top: 18px; }
  .auth-reference-features article { font-size: .58rem; gap: 4px; }
  .auth-reference-feature-icon { width: 40px; height: 40px; border-radius: 11px; }
  .auth-reference-feature-icon .ui-icon { width: 19px; height: 19px; }
  .auth-reference-hero-footer { display: none; }
  .auth-reference-hero::after { right: -22%; width: 58%; height: 116%; opacity: .84; }
  .auth-reference-hero-curve { right: -30%; top: 52%; width: 90%; }
  .auth-screen[data-auth-stage="login"] .auth-card { padding: 36px 14px 24px; }
  .auth-screen[data-auth-stage="login"] .auth-form-panel { padding: 28px 18px 24px; border-radius: 22px; }
  .auth-screen[data-auth-stage="login"] .auth-theme-toggle { top: 14px; min-height: 40px; padding-inline: 10px; }
  .auth-screen[data-auth-stage="login"] .auth-theme-toggle > span[data-theme-toggle-label] { display: none; }
}

@media (max-width: 360px) {
  .auth-screen[data-auth-stage="login"] .auth-reference-hero { min-height: 305px; }
  .auth-reference-hero-content { min-height: 305px; padding-top: 24px; }
  .auth-reference-badge { margin-top: 16px; }
  .auth-reference-copy { margin-top: 14px; }
  .auth-reference-copy h1 { font-size: 1.86rem; }
  .auth-reference-features { margin-top: 14px; }
  .auth-reference-feature-icon { width: 35px; height: 35px; }
  .auth-screen[data-auth-stage="login"] .auth-form-panel { padding-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen[data-auth-stage="login"] .auth-input-wrap,
  .auth-screen[data-auth-stage="login"] .auth-password-wrap,
  .auth-screen[data-auth-stage="login"] .auth-submit,
  .auth-screen[data-auth-stage="login"] .auth-password-toggle { transition: none; }
}

/* Final cascade guard: the shared visual layer is intentionally broad, so
   these scoped rules keep the login contract blue and theme-correct. */
body.auth-locked .auth-screen[data-auth-stage="login"] {
  background: var(--auth-bg);
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-input-icon {
  right: auto;
  left: 16px;
  display: block;
  width: 20px;
  height: 20px;
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-input-wrap > input {
  padding-left: 52px;
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]),
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--auth-text);
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-reference-security strong {
  color: var(--auth-text);
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-reference-security small,
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-reference-copyright,
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-footer {
  color: var(--auth-muted);
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-submit {
  border-color: transparent;
  background: linear-gradient(135deg, var(--auth-blue-bright), #2d56ec);
  color: #fff;
  box-shadow: 0 14px 24px rgb(23 105 232 / .22);
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-submit:hover:not(:disabled) {
  border-color: transparent;
  background: linear-gradient(135deg, #2aa3ff, #3563f1);
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-remember input {
  width: 20px;
  height: 20px;
  appearance: none;
  border: 1px solid var(--auth-border);
  border-radius: 5px;
  background: var(--auth-input);
  cursor: pointer;
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-remember input:checked {
  border-color: var(--auth-blue);
  background: var(--auth-blue);
}
body.auth-locked .auth-screen[data-auth-stage="login"] .auth-remember input:checked::after {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #fff;
  content: "✓";
  font-size: .75rem;
  font-weight: 800;
}
.auth-reference-security {
  position: absolute;
  right: auto;
  left: calc(64.5% + 4px);
  bottom: 70px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  gap: 10px;
  direction: ltr;
  color: var(--auth-text);
}
.auth-reference-security > span:last-child {
  direction: rtl;
  text-align: right;
}
.auth-reference-security-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--auth-blue);
  color: #fff;
}
.auth-reference-security-icon .ui-icon { width: 20px; height: 20px; }
.auth-reference-security strong,
.auth-reference-security small { display: block; }
.auth-reference-security strong { font-size: .74rem; font-weight: 800; }
.auth-reference-security small { margin-top: 2px; color: var(--auth-muted); font-size: .64rem; }
.auth-reference-copyright {
  position: absolute;
  right: 30px;
  bottom: 59px;
  z-index: 4;
  margin: 0;
  color: var(--auth-muted);
  direction: rtl;
  font-size: .62rem;
}

@media (max-width: 860px) {
  .auth-reference-security { position: static; grid-column: 1; justify-self: center; margin: 6px 0 12px; }
  .auth-reference-copyright { position: static; grid-column: 1; justify-self: center; margin: 0 0 18px; }
}

/* Reference reconstruction pass. The supplied visual is the source of truth
   for the cinematic hero geometry; the live form remains real DOM. */
.auth-screen[data-auth-stage="login"] .auth-reference-hero {
  background: #020b18 url("/assets/login-reference-light.png") left top / auto 100% no-repeat;
}

html[data-theme="dark"] .auth-screen[data-auth-stage="login"] .auth-reference-hero {
  background-image: url("/assets/login-reference-dark.png");
}

.auth-screen[data-auth-stage="login"] .auth-reference-hero-backdrop,
.auth-screen[data-auth-stage="login"] .auth-reference-hero::after,
.auth-screen[data-auth-stage="login"] .auth-reference-hero-curve {
  display: none;
}

.auth-screen[data-auth-stage="login"] .auth-reference-hero-content {
  position: absolute;
  width: 1px;
  min-height: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  padding: 0;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .auth-screen[data-auth-stage="login"] .auth-reference-hero {
    background-size: auto 100%;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/change-password.css */
/* Isolated forced-password surface. It intentionally has no application
   shell selectors so a locked session cannot render Gym navigation behind it. */
body.password-change-page {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgb(23 105 232 / 0.12), transparent 28rem),
    radial-gradient(circle at 94% 100%, rgb(15 159 110 / 0.08), transparent 25rem),
    var(--bg-app);
  color: var(--text-primary);
}

.password-change-page .password-change-shell {
  display: grid;
  width: min(100% - 32px, 560px);
  min-height: 100dvh;
  align-content: center;
  gap: 18px;
  margin-inline: auto;
  padding-block: 28px;
}

.password-change-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 800;
}

.password-change-brand > span:last-child { display: grid; gap: 1px; }
.password-change-brand small { color: var(--text-muted); font-size: 11px; font-weight: 600; }

.password-change-mark,
.password-change-icon {
  display: inline-grid;
  place-items: center;
  color: var(--text-on-primary);
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  box-shadow: var(--shadow-primary);
}

.password-change-mark { width: 40px; height: 40px; border-radius: 13px; }
.password-change-mark .ui-icon { width: 22px; height: 22px; }

.password-change-card {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 5vw, 48px);
  border: 1px solid var(--border-primary);
  border-radius: 26px;
  background: var(--bg-card);
  box-shadow: 0 24px 64px rgb(15 23 42 / 0.12);
}

.password-change-card::before {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--success));
  content: "";
}

.password-change-icon { width: 52px; height: 52px; margin-block-end: 18px; border-radius: 17px; }
.password-change-icon .ui-icon { width: 26px; height: 26px; }
.password-change-eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.password-change-card h1 { margin-block: 7px 10px; color: var(--text-primary); font-size: clamp(26px, 4vw, 34px); font-weight: 850; line-height: 1.25; }
.password-change-description { max-width: 46ch; margin: 0; color: var(--text-secondary); font-size: 15px; line-height: 1.85; }
.password-change-identity { margin-block: 16px 0; color: var(--text-primary); font-size: 13px; font-weight: 700; }

.password-change-form { display: grid; gap: 16px; margin-block-start: 26px; }
.password-change-field { display: grid; gap: 7px; }
.password-change-field > label { color: var(--text-primary); font-size: 13px; font-weight: 800; }
.password-change-field small { color: var(--text-muted); font-size: 11px; line-height: 1.65; }
.password-change-input-wrap { position: relative; }
.password-change-input-wrap input { width: 100%; min-height: 54px; box-sizing: border-box; padding: 0 15px 0 52px; border: 1px solid var(--border-primary); border-radius: 13px; background: var(--bg-input); color: var(--text-primary); direction: ltr; font: 600 16px var(--font-body); text-align: left; transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast); }
.password-change-input-wrap input:hover { border-color: var(--border-hover); background: var(--bg-card); }
.password-change-input-wrap input:focus { border-color: var(--primary); outline: 0; box-shadow: var(--focus-ring); }
.password-change-toggle { position: absolute; inset-block-start: 50%; inset-inline-start: 6px; display: inline-grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--text-muted); transform: translateY(-50%); }
.password-change-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.password-change-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.password-change-toggle .ui-icon { width: 19px; height: 19px; }
.password-change-submit { width: 100%; min-height: 54px; margin-block-start: 4px; border-radius: 13px; box-shadow: var(--shadow-primary); font-size: 15px; }
.password-change-submit[aria-busy="true"] { cursor: wait; }
.password-change-submit-spinner { display: none; width: 17px; height: 17px; margin-inline-start: 8px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: password-change-spin .7s linear infinite; }
.password-change-submit[aria-busy="true"] .password-change-submit-spinner { display: inline-block; }
.password-change-message { margin: 0; padding: 11px 13px; border: 1px solid var(--danger-border); border-radius: 11px; background: var(--danger-soft); color: var(--danger-text); font-size: 13px; line-height: 1.7; }
.password-change-message.is-info { border-color: var(--info-border); background: var(--info-soft); color: var(--info-text); }
.password-change-message.is-success { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.password-change-note { display: flex; align-items: center; gap: 7px; margin: 20px 0 0; color: var(--text-muted); font-size: 11px; }
.password-change-note .ui-icon { flex: 0 0 auto; width: 16px; height: 16px; color: var(--success); }
.password-change-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--text-muted); font-size: 11px; }
.password-change-footer > span:first-child { color: var(--text-primary); font-weight: 800; }
.password-change-theme { min-height: 36px; margin-inline-start: auto; padding-inline: 11px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-card); color: var(--text-secondary); font: 700 11px var(--font-body); }
.password-change-theme:hover { border-color: var(--border-hover); color: var(--primary); }

@keyframes password-change-spin { to { transform: rotate(360deg); } }

html[data-theme="dark"] .password-change-card { box-shadow: 0 24px 64px rgb(0 0 0 / 0.24); }
html[data-theme="dark"] body.password-change-page { background: radial-gradient(circle at 8% 0%, rgb(23 105 232 / 0.2), transparent 28rem), var(--bg-app); }

@media (max-width: 600px) {
  .password-change-page .password-change-shell { width: min(100% - 24px, 520px); padding-block: 18px; }
  .password-change-card { padding: 28px 20px 22px; border-radius: 21px; }
  .password-change-card h1 { font-size: 27px; }
  .password-change-footer { align-items: flex-start; }
  .password-change-theme { margin-inline-start: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .password-change-submit-spinner { animation: none; }
  .password-change-input-wrap input { transition: none; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/dashboard.css */
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 0;
  align-items: stretch;
  gap: var(--space-3);
  overflow: hidden;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  background: linear-gradient(120deg, var(--primary-soft), var(--bg-card) 60%, var(--bg-card-hover));
  box-shadow: var(--shadow-md);
}

.dashboard-hero-visual {
  position: relative;
  display: none;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, var(--primary-soft), var(--bg-card-hover));
}

.dashboard-hero-visual::before,
.dashboard-hero-visual::after {
  position: absolute;
  width: 210px;
  height: 210px;
  border: 1px solid var(--primary-border);
  border-radius: 50%;
  content: "";
}

.dashboard-hero-visual::after {
  width: 150px;
  height: 150px;
}

.dashboard-hero-visual-ring {
  position: absolute;
  display: block;
  border: 1px dashed var(--primary-border);
  border-radius: 50%;
  transform: rotate(25deg);
}

.dashboard-hero-visual-ring-one { width: 270px; height: 98px; }
.dashboard-hero-visual-ring-two { width: 290px; height: 118px; transform: rotate(-25deg); }

.dashboard-hero-visual-logo {
  display: grid;
  width: 90px;
  height: 90px;
  z-index: var(--z-content);
  place-items: center;
  border: 1px solid var(--border-hover);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.dashboard-hero-visual-logo svg { width: 47px; height: 47px; }

.dashboard-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

.dashboard-hero-stat {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  text-align: center;
}

.dashboard-hero-stat + .dashboard-hero-stat {
  border-inline-start: 1px solid var(--border-secondary);
}

.dashboard-hero-stat-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.dashboard-hero-stat-icon svg { width: 18px; height: 18px; }

.dashboard-hero-stat-copy {
  display: grid;
  gap: 0;
}

.dashboard-hero-stat-copy small,
.dashboard-hero-stat-copy em {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  font-style: normal;
}

.dashboard-hero-stat-copy strong {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: 1.2rem;
  font-weight: var(--weight-extrabold);
  line-height: 1.2;
  direction: ltr;
}

.dashboard-hero-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  text-align: right;
}

.dashboard-page-actions-copy {
  display: grid;
  gap: var(--space-1);
}

.dashboard-page-actions-copy strong {
  color: var(--color-text);
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.2;
}

.dashboard-page-actions-copy span {
  color: var(--color-text-muted);
  font-size: var(--font-lg);
}

.dashboard-hero-pulse {
  display: flex;
  align-items: end;
  gap: 3px;
  height: 20px;
  margin-top: var(--space-2);
}

.dashboard-hero-pulse b {
  display: block;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--primary-hover);
}

.dashboard-hero-pulse b:nth-child(1), .dashboard-hero-pulse b:nth-child(7) { height: 5px; }
.dashboard-hero-pulse b:nth-child(2), .dashboard-hero-pulse b:nth-child(6) { height: 10px; }
.dashboard-hero-pulse b:nth-child(3), .dashboard-hero-pulse b:nth-child(5) { height: 15px; }
.dashboard-hero-pulse b:nth-child(4) { height: 20px; background: var(--color-primary); }

.dashboard-pricing-print-button {
  align-self: center;
  min-height: 38px;
  white-space: nowrap;
}

.overview-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  margin-top: var(--space-6);
}

.overview-grid > .stats-grid {
  grid-column: 1 / -1;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.overview-grid > .alerts-panel {
  grid-column: span 5;
  grid-row: 3;
}

.overview-grid > .monthly-finance-card {
  grid-column: span 7;
  grid-row: 3;
}

.overview-grid > .monthly-finance-snapshot {
  grid-column: span 7;
  grid-row: 3;
}

.alerts-panel-header,
.monthly-finance-head,
.monthly-finance-heading,
.monthly-finance-head-actions,
.monthly-finance-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.monthly-finance-metric-top {
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

.alerts-heading,
.monthly-finance-heading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.alerts-heading-icon,
.monthly-finance-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.alerts-heading-icon svg,
.monthly-finance-icon svg { width: 20px; height: 20px; }

.alerts-heading h3,
.monthly-finance-heading h3,
.management-tab-header h3,
.library-heading h3,
.attendance-heading h3,
.coaching-heading h3 {
  color: var(--color-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-extrabold);
}

.alerts-heading p,
.monthly-finance-heading p,
.management-tab-header p,
.library-heading p,
.attendance-heading p,
.coaching-heading p {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.alerts-eyebrow,
.monthly-finance-eyebrow,
.management-eyebrow,
.library-kicker,
.coaching-kicker {
  color: var(--color-primary);
  font-size: 10px;
  font-weight: var(--weight-bold);
}

.alerts-count,
.monthly-finance-status {
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-xs);
  white-space: nowrap;
}

.alerts-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) 0;
}

.alerts-search-field,
.attendance-search-wrap,
.coaching-search {
  position: relative;
  display: block;
  flex: 1;
}

.alerts-search-field svg,
.attendance-search-wrap svg,
.coaching-search svg {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  width: 17px;
  height: 17px;
  color: var(--color-text-subtle);
  pointer-events: none;
  transform: translateY(-50%);
}

.alerts-search-field input,
.attendance-search-wrap input,
.coaching-search input {
  padding-inline-start: var(--space-3);
  padding-left: var(--space-9);
}

.monthly-finance-card {
  display: grid;
  gap: var(--space-5);
}

.monthly-finance-snapshot {
  display: grid;
  gap: var(--space-5);
}

.monthly-finance-snapshot-head,
.snapshot-membership-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.snapshot-membership-status-head {
  align-items: end;
}

.snapshot-membership-status-head span {
  color: var(--color-text);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.snapshot-membership-status-head small {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.snapshot-membership-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
}

.monthly-finance-snapshot-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.monthly-finance-snapshot-metric {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-4);
}

.monthly-finance-snapshot-metric > span:not(.monthly-finance-snapshot-metric-icon) {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.monthly-finance-snapshot-metric strong {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: 1.3rem;
  font-weight: var(--weight-extrabold);
  direction: ltr;
}

.monthly-finance-snapshot-metric-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.monthly-finance-snapshot-metric-icon svg { width: 18px; height: 18px; }
.monthly-finance-snapshot-metric.subscriptions { border-top: 3px solid var(--color-primary); }
.monthly-finance-snapshot-metric.expenses { border-top: 3px solid var(--color-danger); }
.monthly-finance-snapshot-metric.net { border-top: 3px solid var(--color-success); }

.monthly-finance-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.monthly-finance-metric {
  display: grid;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--color-surface-muted);
}

.monthly-finance-label,
.monthly-finance-metric small {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.monthly-finance-value {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: 1.35rem;
  font-weight: var(--weight-extrabold);
  direction: ltr;
}

.monthly-finance-metric.subscriptions { border-top: 3px solid var(--color-primary); }
.monthly-finance-metric.day-passes { border-top: 3px solid var(--info); }
.monthly-finance-metric.expenses { border-top: 3px solid var(--color-danger); }
.monthly-finance-metric.net { border-top: 3px solid var(--color-success); }

.monthly-expenses-list {
  display: grid;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.management-tab-panel,
.library-section,
.attendance-section,
.coaching-section,
.reports-section {
  display: grid;
  gap: var(--space-5);
}

.management-shortcuts,
.backup-management-panel,
.backup-history-section,
.auth-users-panel {
  display: grid;
  gap: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  background: var(--color-surface-muted);
}

.management-shortcuts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.management-shortcut {
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-4);
  text-align: start;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.management-shortcut:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.management-shortcut > span:nth-child(2) { display: grid; flex: 1; gap: var(--space-1); }
.management-shortcut strong { font-size: var(--font-sm); }
.management-shortcut small { color: var(--color-text-muted); font-size: var(--font-xs); }
.management-shortcut-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--color-primary-soft); color: var(--color-primary); }
.management-shortcut-arrow { width: 18px; color: var(--color-text-subtle); }

.backup-management-panel,
.backup-history-section-head,
.auth-users-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.backup-management-panel p,
.backup-history-section p,
.auth-users-panel p { color: var(--color-text-muted); font-size: var(--font-xs); }
.backup-management-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.backup-history-list,
.auth-users-loading { color: var(--color-text-muted); font-size: var(--font-xs); }

.backup-storage-warning {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  padding: var(--space-3) var(--space-4);
  color: var(--warning-text);
}

.backup-storage-warning strong { color: var(--warning-text); font-size: var(--font-sm); }
.backup-storage-warning p { margin: 0; color: var(--text-secondary); font-size: var(--font-xs); line-height: 1.8; }

.backup-history-page { min-width: 0; }
.backup-history-page-head { align-items: center; }
.backup-history-page-heading { display: grid; min-width: 0; gap: var(--space-1); }
.backup-history-page-heading h3 { margin: 0; color: var(--color-text); font-size: var(--font-xl); }
.backup-history-page-heading p { margin: 0; color: var(--color-text-muted); font-size: var(--font-xs); line-height: 1.7; }
.backup-history-page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); }

.backup-history-block {
  display: grid;
  min-width: 0;
  gap: var(--space-3);
  margin-top: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-4);
}

.backup-history-block-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.backup-history-block-head strong { color: var(--color-text); font-size: var(--font-sm); }
.backup-history-block-head span { color: var(--color-text-muted); font-size: var(--font-xs); }
.backup-history-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.backup-history-table { min-width: 900px; table-layout: fixed; }
.backup-history-table th,
.backup-history-table td { min-height: 60px; padding: var(--space-3); text-align: center; vertical-align: middle; }
.backup-history-table td:first-child { text-align: start; }
.backup-history-table td strong,
.backup-history-table td small { display: block; min-width: 0; overflow-wrap: anywhere; }
.backup-history-table td small { margin-top: 2px; }
.backup-history-actions { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); white-space: nowrap; }
.backup-history-status {
  display: inline-flex;
  min-width: 72px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0 var(--space-2);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}
.backup-history-status.success { border-color: var(--success-border); background: var(--color-success-soft); color: var(--success-text); }
.backup-history-status.error { border-color: var(--danger-border); background: var(--color-danger-soft); color: var(--danger-text); }
.backup-history-status.verified { border-color: var(--success-border); background: var(--color-success-soft); color: var(--success-text); }
.backup-history-status.failed { border-color: var(--danger-border); background: var(--color-danger-soft); color: var(--danger-text); }
.backup-history-status.pending,
.backup-history-status.running,
.backup-history-status.uploaded,
.backup-history-status.verifying { border-color: var(--border-hover); background: var(--color-surface-muted); color: var(--color-secondary); }
.backup-history-status.expired,
.backup-history-status.deleted { border-color: var(--border-color); background: var(--color-surface-muted); color: var(--color-text-muted); }
.backup-reason-field { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.backup-reason-field span { color: var(--color-text); font-size: var(--font-sm); font-weight: var(--weight-bold); }
.auth-users-head > div { min-width: 0; }
.auth-users-head > button { flex: 0 0 auto; min-width: 156px; }
.auth-user-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.auth-user-actions .btn { min-width: 66px; }
.auth-user-actions .auth-delete { border-color: var(--danger-border); color: var(--color-danger); }
.auth-user-actions .auth-delete:hover:not(:disabled) { border-color: var(--color-danger); background: var(--color-danger-soft); color: var(--color-danger); }
.auth-users-table-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface); }
.auth-users-table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.auth-users-table th,
.auth-users-table td { min-height: 64px; border-bottom: 1px solid var(--border-color); padding: var(--space-3); text-align: center; vertical-align: middle; }
.auth-users-table th { background: var(--color-surface-muted); color: var(--color-text-muted); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.auth-users-table th:first-child,
.auth-users-table td:first-child { width: 32%; text-align: start; }
.auth-users-table th:last-child,
.auth-users-table td:last-child { width: 30%; }
.auth-users-table tbody tr:last-child td { border-bottom: 0; }
.auth-users-table tbody tr:hover td { background: var(--color-primary-soft); }
.auth-user-primary { display: grid; min-width: 0; gap: 2px; }
.auth-user-primary strong { overflow: hidden; color: var(--color-text); text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-sm); }
.auth-user-primary small { overflow-wrap: anywhere; color: var(--color-text-muted); font-size: var(--font-xs); }
.auth-role-badge,
.auth-status-badge { display: inline-flex; min-height: 28px; align-items: center; justify-content: center; border-radius: var(--radius-pill); padding: 0 10px; font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.auth-role-badge.owner { background: var(--color-primary-soft); color: var(--color-primary); }
.auth-role-badge.assistant { background: var(--color-surface-muted); color: var(--color-secondary); }
.auth-status-badge.active { background: var(--color-success-soft); color: var(--color-success); }
.auth-status-badge.disabled { background: var(--color-danger-soft); color: var(--color-danger); }
.auth-users-empty,
.auth-users-error { border: 1px dashed var(--border-color); border-radius: var(--radius-md); color: var(--color-text-muted); padding: var(--space-8) var(--space-4); text-align: center; }
.auth-users-error { background: var(--color-danger-soft); color: var(--color-danger); }

@media (max-width: 1199px) and (min-width: 992px) {
  .overview-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .overview-grid > .alerts-panel {
    grid-column: span 5;
    grid-row: 3;
  }
  .overview-grid > .monthly-finance-card,
  .overview-grid > .monthly-finance-snapshot {
    grid-column: span 7;
    grid-row: 3;
  }
  .overview-grid > .dashboard-day-pass-card {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 991px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .overview-grid > .alerts-panel,
  .overview-grid > .monthly-finance-card,
  .overview-grid > .monthly-finance-snapshot,
  .overview-grid > .dashboard-day-pass-card {
    grid-column: 1 / -1;
    grid-row: auto;
  }
  .snapshot-membership-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-hero-stats { order: 2; }
  .dashboard-hero-content { order: 3; }
  .dashboard-hero-visual { order: 3; }
  .monthly-finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .overview-grid { grid-template-columns: 1fr; }
  .overview-grid > .stats-grid,
  .monthly-finance-metrics,
  .snapshot-membership-stats,
  .monthly-finance-snapshot-metrics,
  .management-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monthly-finance-metrics { grid-template-columns: 1fr; }
  .dashboard-hero-content { padding: var(--space-3); }
  .dashboard-hero-stats { padding: var(--space-2); }
  .backup-management-panel,
  .backup-history-section-head,
  .auth-users-head { align-items: stretch; flex-direction: column; }

  .backup-history-block-head { align-items: flex-start; flex-direction: column; }
  .backup-history-actions { width: 100%; }
  .backup-history-actions > .btn { flex: 1 1 0; }
  .backup-history-page-actions { width: 100%; }
  .backup-history-page-actions > .btn { flex: 1 1 160px; }
}

/* Dashboard analytics: keep every chart inside its card and use the available width. */
.dashboard-analytics {
  display: grid;
  min-width: 0;
  gap: var(--space-5);
  overflow: hidden;
}

.dashboard-analytics-head,
.analytics-card-head,
.attendance-insights-head,
.attendance-insights-cardlet-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.dashboard-analytics-head {
  align-items: flex-start;
  flex-wrap: wrap;
  padding-bottom: var(--space-2);
}

.dashboard-analytics-title,
.attendance-insights-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}

.dashboard-analytics-title > div,
.attendance-insights-heading > div,
.analytics-card-head > div {
  min-width: 0;
}

.dashboard-analytics-icon,
.attendance-insights-heading-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.dashboard-analytics-icon .ui-icon,
.attendance-insights-heading-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.dashboard-analytics-eyebrow,
.analytics-card-head > div > span,
.attendance-insights-heading > div > span,
.attendance-insights-cardlet-head > div > span {
  display: block;
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.dashboard-analytics-title h2,
.analytics-card-head h3,
.attendance-insights-heading h3,
.attendance-insights-cardlet-head h4 {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--color-text);
  font-weight: var(--weight-extrabold);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-analytics-title h2 { font-size: var(--font-xl); }
.analytics-card-head h3 { font-size: var(--font-md); }
.attendance-insights-heading h3 { font-size: var(--font-lg); }
.attendance-insights-cardlet-head h4 { font-size: var(--font-md); }

.dashboard-analytics-title p,
.attendance-insights-heading p {
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.analytics-period-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: 3px;
}

.analytics-period-switch button {
  min-width: 60px;
  min-height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.analytics-period-switch button:hover,
.analytics-period-switch button[aria-selected="true"] {
  background: var(--color-primary);
  color: var(--text-on-primary);
}

.analytics-loading {
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-xs);
}

.analytics-smart-strip,
.analytics-kpis,
.analytics-main-grid,
.analytics-secondary-grid,
.attendance-insights-kpis,
.attendance-insights-grid {
  display: grid;
  min-width: 0;
  gap: var(--space-3);
}

.analytics-smart-strip {
  grid-template-columns: minmax(230px, 1.35fr) repeat(3, minmax(150px, 1fr));
}

.analytics-smart-health,
.analytics-smart-insight,
.analytics-kpi,
.attendance-insights-kpi,
.attendance-insights-cardlet {
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.analytics-smart-health {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.analytics-health-ring {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  place-items: center;
  border: 5px solid var(--color-primary-soft);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  color: var(--color-primary);
  text-align: center;
}

.analytics-health-ring strong {
  font-family: var(--font-latin);
  font-size: var(--font-md);
  line-height: 1;
  direction: ltr;
}

.analytics-health-ring span,
.analytics-smart-eyebrow,
.analytics-smart-insight > div > span {
  color: var(--color-text-muted);
  font-size: 10px;
}

.analytics-smart-health h3 {
  margin-top: 2px;
  color: var(--color-text);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.analytics-smart-health p,
.analytics-smart-insight small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-smart-insight {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.analytics-smart-insight-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.analytics-smart-insight.green .analytics-smart-insight-icon { background: var(--color-success-soft); color: var(--color-success); }
.analytics-smart-insight.rose .analytics-smart-insight-icon { background: var(--color-danger-soft); color: var(--color-danger); }

.analytics-smart-insight strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
  direction: ltr;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.analytics-kpi {
  display: flex;
  min-height: 108px;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
}

.analytics-kpi-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.analytics-kpi.green .analytics-kpi-icon { background: var(--color-success-soft); color: var(--color-success); }
.analytics-kpi.red .analytics-kpi-icon { background: var(--color-danger-soft); color: var(--color-danger); }
.analytics-kpi.amber .analytics-kpi-icon { background: var(--color-warning-soft); color: var(--color-warning); }
.analytics-kpi.teal .analytics-kpi-icon { background: var(--color-success-soft); color: var(--color-success); }
.analytics-kpi.rose .analytics-kpi-icon { background: var(--color-danger-soft); color: var(--color-danger); }
.analytics-kpi.indigo .analytics-kpi-icon { background: var(--color-info-soft); color: var(--color-info); }

.analytics-kpi > div {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 2px;
}

.analytics-kpi > div > span {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-kpi strong {
  overflow: hidden;
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
  direction: ltr;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-kpi small {
  overflow: hidden;
  color: var(--color-text-subtle);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-kpi-delta {
  display: inline-block;
  width: fit-content;
  border-radius: var(--radius-pill);
  background: var(--color-success-soft);
  color: var(--color-success);
  padding: 1px var(--space-2);
}

.analytics-kpi-delta.negative { background: var(--color-danger-soft); color: var(--color-danger); }

.analytics-main-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.85fr);
}

.analytics-secondary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analytics-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.analytics-card-head {
  align-items: flex-start;
}

.analytics-legend,
.analytics-activity-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.analytics-legend span,
.analytics-activity-legend span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}

.analytics-legend i,
.analytics-activity-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}

.analytics-legend i.expenses,
.analytics-activity-legend i.memberships { background: var(--color-danger); }
.analytics-activity-legend i.members { background: var(--color-primary); }

.analytics-trend-wrap {
  width: 100%;
  height: 285px;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
}

.analytics-trend-svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
}

.analytics-grid-line {
  stroke: var(--border-color);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.analytics-axis-label {
  fill: var(--color-text-subtle);
  font-family: var(--font-body);
  font-size: 11px;
}

.analytics-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.collected-line { stroke: var(--color-primary); }
.expenses-line { stroke: var(--color-danger); }
.collected-points { fill: var(--color-primary); }
.expenses-points { fill: var(--color-danger); }

.analytics-chart-empty,
.analytics-bars-empty,
.attendance-insights-empty,
.analytics-error {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  text-align: center;
}

.analytics-bars {
  display: grid;
  align-content: start;
  gap: var(--space-4);
  min-height: 220px;
}

.analytics-bar-row {
  display: grid;
  gap: var(--space-2);
}

.analytics-bar-label {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
}

.analytics-bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-bar-label strong {
  flex: 0 0 auto;
  color: var(--color-text);
  font-family: var(--font-latin);
  direction: ltr;
}

.analytics-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
}

.analytics-bar-track span {
  display: block;
  width: 65%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--primary-hover));
}

.analytics-activity-chart {
  display: grid;
  min-height: 220px;
  align-content: end;
  gap: var(--space-3);
  min-width: 0;
  overflow: hidden;
}

.analytics-column-chart {
  display: flex;
  height: 190px;
  min-width: 0;
  align-items: flex-end;
  gap: clamp(3px, 1vw, 8px);
  overflow: hidden;
  padding: var(--space-2) 0 var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

.analytics-column-group {
  display: grid;
  min-width: 0;
  flex: 1 1 0;
  align-items: end;
  gap: var(--space-1);
}

.analytics-column-pair {
  display: flex;
  height: 160px;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}

.analytics-column {
  display: block;
  width: clamp(4px, 1vw, 10px);
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-primary);
}

.analytics-column.memberships { background: var(--color-danger); }

.analytics-column-group small {
  min-height: 14px;
  overflow: hidden;
  color: var(--color-text-subtle);
  font-size: 9px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-insights-card {
  gap: var(--space-5);
}

.attendance-insights-head {
  align-items: flex-start;
}

.attendance-insights-heading p {
  max-width: 680px;
}

.attendance-insights-badge {
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-xs);
  white-space: nowrap;
}

.attendance-insights-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.attendance-insights-kpi {
  display: grid;
  min-height: 88px;
  align-content: start;
  gap: 2px;
  padding: var(--space-4);
}

.attendance-insights-kpi strong {
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
  direction: ltr;
}

.attendance-insights-kpi span {
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.attendance-insights-kpi small {
  color: var(--color-text-muted);
  font-size: 10px;
}

.attendance-insights-kpi.green strong { color: var(--color-success); }
.attendance-insights-kpi.amber strong { color: var(--color-warning); }
.attendance-insights-kpi.violet strong { color: var(--primary); }

.attendance-insights-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.attendance-insights-cardlet {
  display: grid;
  align-content: start;
  gap: var(--space-4);
  overflow: hidden;
  padding: var(--space-4);
}

.attendance-peak-list,
.attendance-member-list {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.attendance-peak-row {
  display: grid;
  gap: var(--space-2);
}

.attendance-peak-row > div:first-child,
.attendance-member-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.attendance-peak-row span,
.attendance-member-copy strong {
  overflow: hidden;
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-peak-row strong,
.attendance-member-stat {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: 11px;
  direction: ltr;
}

.attendance-peak-track {
  height: 7px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
}

.attendance-peak-track span {
  display: block;
  width: 68%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--primary-hover));
}

.attendance-member-row {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

.attendance-member-row:last-child { padding-bottom: 0; border-bottom: 0; }

.attendance-member-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.attendance-member-copy small {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1199px) {
  .analytics-smart-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-smart-health { grid-column: 1 / -1; }
  .analytics-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-main-grid { grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr); }
}

@media (max-width: 991px) {
  .analytics-main-grid,
  .analytics-secondary-grid { grid-template-columns: 1fr; }
  .attendance-insights-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .dashboard-analytics-head,
  .analytics-card-head,
  .attendance-insights-head { align-items: stretch; flex-direction: column; }
  .dashboard-analytics-title { width: 100%; max-width: 100%; }
  .dashboard-analytics-title h2 { white-space: normal; }
  .analytics-period-switch { width: 100%; }
  .analytics-period-switch button { flex: 1 1 0; }
  .analytics-smart-strip,
  .analytics-kpis,
  .attendance-insights-kpis,
  .attendance-insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-smart-health,
  .attendance-insights-grid > .attendance-insights-cardlet:last-child { grid-column: 1 / -1; }
  .analytics-trend-wrap { height: 230px; }
  .analytics-card { padding: var(--space-4); }
  .attendance-insights-heading p { max-width: none; }
}

@media (max-width: 430px) {
  .analytics-smart-strip,
  .analytics-kpis,
  .attendance-insights-kpis,
  .attendance-insights-grid { grid-template-columns: 1fr; }
  .analytics-smart-health,
  .attendance-insights-grid > .attendance-insights-cardlet:last-child { grid-column: auto; }
  .analytics-smart-health,
  .analytics-smart-insight,
  .analytics-kpi { min-height: 82px; }
  .analytics-trend-wrap { height: 210px; }
}

/* Daily passes dashboard card ----------------------------------------- */
.day-pass-dialog {
  width: min(920px, calc(100% - 28px));
  max-width: 920px;
  max-height: calc(100dvh - 28px);
}

#attendanceSection > #dayPassPanel { display: none; }
.day-pass-dialog > #dayPassPanel { display: grid; }

.day-pass-dialog > .day-pass-panel {
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  background: var(--color-surface);
  box-shadow: none;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.day-pass-dialog > .day-pass-panel::-webkit-scrollbar { width: 7px; }
.day-pass-dialog > .day-pass-panel::-webkit-scrollbar-thumb { border-radius: var(--radius-pill); background: var(--border-strong); }
.day-pass-dialog .day-pass-head {
  position: sticky;
  top: calc(var(--space-5) * -1);
  z-index: var(--z-content);
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--color-surface);
  padding: var(--space-5);
}
.day-pass-dialog-head-actions { display: flex; align-items: center; gap: var(--space-2); }
.day-pass-dialog-head-actions .btn { min-height: 40px; white-space: nowrap; }

.dashboard-day-pass-card {
  display: grid;
  min-width: 0;
  gap: var(--space-5);
  grid-column: 1 / -1;
  grid-row: 2;
}

.dashboard-day-pass-head,
.dashboard-day-pass-heading,
.dashboard-day-pass-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.dashboard-day-pass-head { justify-content: space-between; }
.dashboard-day-pass-heading { min-width: 0; }
.dashboard-day-pass-heading > div { display: grid; min-width: 0; gap: 2px; }
.dashboard-day-pass-heading > div > span { color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.dashboard-day-pass-heading h3 { color: var(--color-text); font-size: var(--font-xl); font-weight: var(--weight-extrabold); }
.dashboard-day-pass-heading p { color: var(--color-text-muted); font-size: var(--font-xs); }
.dashboard-day-pass-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 14px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.dashboard-day-pass-icon .ui-icon { width: 23px; height: 23px; }
.dashboard-day-pass-actions { flex-wrap: wrap; justify-content: flex-end; }
.dashboard-day-pass-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.dashboard-day-pass-kpi {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-4);
}
.dashboard-day-pass-kpi.amount { border-top-color: var(--color-success); }
.dashboard-day-pass-kpi span { color: var(--color-text-muted); font-size: var(--font-xs); }
.dashboard-day-pass-kpi strong { color: var(--color-text); font-family: var(--font-latin); font-size: 1.35rem; font-weight: var(--weight-extrabold); direction: ltr; }
.dashboard-day-pass-kpi.amount strong { color: var(--color-success); }
.dashboard-day-pass-table-wrap {
  min-width: 0;
  max-height: 390px;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}
.dashboard-day-pass-table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.dashboard-day-pass-table-wrap::-webkit-scrollbar-track { background: transparent; }
.dashboard-day-pass-table-wrap::-webkit-scrollbar-thumb { border-radius: var(--radius-pill); background: var(--border-strong); }
.dashboard-day-pass-table { width: 100%; min-width: 760px; table-layout: fixed; border-spacing: 0; }
.dashboard-day-pass-table th,
.dashboard-day-pass-table td { padding: var(--space-3) var(--space-4); text-align: center; vertical-align: middle; white-space: nowrap; }
.dashboard-day-pass-table th { position: sticky; top: 0; z-index: 1; background: var(--color-surface-muted); color: var(--color-text-soft); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.dashboard-day-pass-table tbody tr { min-height: 0; height: 48px; }
.dashboard-day-pass-table tbody td { height: 48px; }
.dashboard-day-pass-table tbody tr + tr td { border-top: 1px solid var(--border-color); }
.dashboard-day-pass-table tbody tr:hover td { background: var(--color-primary-soft); }
.dashboard-day-pass-table td:first-child { overflow: hidden; text-align: start; text-overflow: ellipsis; }
.dashboard-day-pass-table td strong,
.dashboard-day-pass-table td small {
  display: inline-block;
  max-width: 56%;
  overflow: hidden;
  margin-inline-start: 6px;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}
.dashboard-day-pass-table td strong {
  display: inline-block;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
  color: var(--color-text);
  font-size: var(--font-sm);
}
.dashboard-day-pass-table td small { color: var(--color-text-muted); font-family: var(--font-latin); font-size: var(--font-xs); }
.dashboard-day-pass-table .day-pass-actions { flex-wrap: nowrap; gap: 4px; }

/* Dashboard command-center hierarchy ----------------------------------- */
.dashboard-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.dashboard-section-heading-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.dashboard-section-eyebrow {
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .04em;
}

.dashboard-section-heading h2 {
  margin: 0;
  color: var(--color-text);
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.25;
}

.dashboard-section-heading p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

.dashboard-section-heading-meta {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 5px;
}

.dashboard-live-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success-text);
  padding: 6px 10px;
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.dashboard-live-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.dashboard-section-meta-note {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.dashboard-hero {
  position: relative;
  isolation: isolate;
  direction: rtl;
  border-color: var(--border-primary);
  box-shadow: var(--shadow-card);
}

.dashboard-initial-skeleton { display: none; }

#dashboardSection:not(.data-loading) .dashboard-initial-skeleton {
  display: none;
}

#dashboardSection.data-loading .dashboard-initial-skeleton {
  display: block;
  margin-top: var(--space-6);
}

#dashboardSection.data-loading > .dashboard-hero,
#dashboardSection.data-loading > .overview-grid {
  display: none;
}

.dashboard-hero::after {
  position: absolute;
  top: 0;
  right: 8%;
  left: 8%;
  z-index: -1;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  content: "";
  opacity: .8;
}

.dashboard-hero-visual,
.dashboard-hero-stats,
.dashboard-hero-content {
  min-width: 0;
}

.dashboard-hero-content {
  align-items: flex-start;
  justify-content: center;
  text-align: start;
}

.dashboard-hero-stats {
  border-inline: 1px solid var(--border-secondary);
}

.overview-grid {
  align-items: start;
  direction: rtl;
}

.overview-grid > .stats-grid {
  gap: var(--space-3);
}

.overview-grid > .alerts-panel,
.overview-grid > .monthly-finance-card,
.overview-grid > .monthly-finance-snapshot,
.dashboard-analytics,
.dashboard-store-summary {
  min-width: 0;
}

@media (max-width: 767px) {
  .dashboard-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .dashboard-section-heading-meta {
    width: 100%;
    align-items: start;
    justify-items: start;
  }

  .dashboard-hero-stats {
    border-inline: 0;
    border-block: 1px solid var(--border-secondary);
  }
}

@media (max-width: 600px) {
  .day-pass-dialog {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
  }
  .day-pass-dialog > .day-pass-panel { max-height: calc(100dvh - 20px); padding: var(--space-4); }
  .day-pass-dialog .day-pass-head {
    top: calc(var(--space-4) * -1);
    margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) 0;
    padding: var(--space-4);
  }
  .day-pass-dialog-head-actions { align-self: stretch; justify-content: space-between; }
  .dashboard-day-pass-head { align-items: stretch; flex-direction: column; }
  .dashboard-day-pass-actions { justify-content: stretch; }
  .dashboard-day-pass-actions .btn { flex: 1 1 0; }
  .dashboard-day-pass-kpis { grid-template-columns: 1fr; }
}

/* Keep the dashboard command center compact: alerts stay on the right,
   daily passes use the left column, and the monthly summary gets the full
   width below them. RTL grid lines start from the right side. */
@media (min-width: 1200px) {
  .overview-grid {
    column-gap: var(--space-4);
    row-gap: var(--space-4);
  }

  .overview-grid > .alerts-panel {
    grid-column: 1 / span 6;
    grid-row: 2;
  }

  .overview-grid > .dashboard-day-pass-card {
    grid-column: 7 / span 6;
    grid-row: 2;
  }

  .overview-grid > .monthly-finance-card,
  .overview-grid > .monthly-finance-snapshot {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .monthly-finance-card,
  .dashboard-day-pass-card,
  .alerts-panel {
    gap: var(--space-4);
  }

  .monthly-finance-metric,
  .dashboard-day-pass-kpi {
    padding: var(--space-3);
  }
}

@media (min-width: 1200px) {
  .overview-grid > .alerts-panel,
  .overview-grid > .dashboard-day-pass-card {
    align-self: stretch;
    min-height: 0;
  }

  .dashboard-day-pass-card {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .dashboard-day-pass-table-wrap {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .dashboard-day-pass-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .dashboard-day-pass-table th,
  .dashboard-day-pass-table td {
    padding: 9px 7px;
    font-size: var(--font-xs);
  }

  .dashboard-day-pass-table-wrap { max-height: 390px; }

  .dashboard-day-pass-table th:nth-child(1) { width: 30%; }
  .dashboard-day-pass-table th:nth-child(2) { width: 18%; }
  .dashboard-day-pass-table th:nth-child(3) { width: 17%; }
  .dashboard-day-pass-table th:nth-child(4) { width: 15%; }
  .dashboard-day-pass-table th:nth-child(5) { width: 20%; }

  .dashboard-day-pass-table td strong,
  .dashboard-day-pass-table td small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-day-pass-table .day-pass-type-badge {
    max-width: 100%;
    overflow: hidden;
    padding-inline: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-day-pass-table .day-pass-action-button.is-compact {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .dashboard-day-pass-table .day-pass-action-button.is-compact .ui-icon {
    width: 19px;
    height: 19px;
  }
}

/* The finance snapshot is a priority summary: keep it immediately before
   performance analytics instead of letting it disappear below the charts. */
.monthly-finance-snapshot {
  box-sizing: border-box;
  width: 100%;
  margin-top: var(--space-4);
}

.dashboard-analytics {
  margin-top: var(--space-4);
}

/* Logic Fit command center -------------------------------------------------
   The dashboard keeps the existing data hooks and feature boundaries, while
   presenting one clear SaaS-style entry point instead of duplicating KPI
   values inside the hero. */
.dashboard-hero {
  grid-template-columns: minmax(0, 1.45fr) minmax(250px, .72fr);
  min-height: 214px;
  gap: 0;
  background:
    radial-gradient(circle at 10% 15%, var(--primary-soft), transparent 34%),
    linear-gradient(125deg, var(--bg-card-hover), var(--bg-card) 58%, var(--bg-elevated));
}

.dashboard-hero-content {
  display: grid;
  align-content: center;
  gap: var(--space-4);
  min-width: 0;
  padding: clamp(var(--space-5), 3vw, var(--space-7));
}

.dashboard-hero-topline,
.dashboard-hero-meta,
.dashboard-hero-buttons {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2);
}

.dashboard-hero-topline { justify-content: space-between; }

.dashboard-hero-kicker {
  overflow: hidden;
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: 0.68rem;
  font-weight: var(--weight-extrabold);
  letter-spacing: .12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-hero-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-4);
}

.dashboard-hero-brand-mark {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--brand-image-radius);
  background: transparent;
  color: var(--color-primary);
  box-shadow: none;
  font-family: var(--font-latin);
  font-size: 1.55rem;
  font-weight: var(--weight-extrabold);
}

.dashboard-hero-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-hero-heading-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.dashboard-hero-eyebrow,
.dashboard-hero-action-copy span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.dashboard-hero-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--color-text);
  font-size: clamp(1.35rem, 2.5vw, 2.05rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.25;
}

.dashboard-hero-heading h2 strong { color: var(--color-primary); }

.dashboard-hero-heading-copy p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

.dashboard-hero-meta {
  flex-wrap: wrap;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.dashboard-hero-meta span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.dashboard-hero-meta span + span::before {
  width: 4px;
  height: 4px;
  margin-inline: 3px;
  border-radius: 50%;
  background: var(--border-hover);
  content: "";
}

.dashboard-hero-meta .ui-icon { width: 15px; height: 15px; color: var(--color-primary); }

.dashboard-hero-actions {
  display: grid;
  align-content: center;
  gap: var(--space-3);
  min-width: 0;
  border-inline-start: 1px solid var(--border-secondary);
  background: color-mix(in srgb, var(--bg-elevated) 68%, transparent);
  padding: var(--space-5);
}

.dashboard-hero-action-copy { display: grid; gap: 3px; }

.dashboard-hero-action-copy small {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.dashboard-hero-buttons { flex-wrap: wrap; }
.dashboard-hero-buttons .btn { flex: 1 1 150px; justify-content: center; min-height: 40px; }
.dashboard-hero-buttons .ui-icon { width: 16px; height: 16px; }

.overview-grid > .stats-grid { align-items: stretch; }

.overview-grid > .stats-grid .stat-card {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  border-color: var(--border-primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.overview-grid > .stats-grid .stat-card::before {
  position: absolute;
  top: 0;
  right: var(--space-4);
  left: var(--space-4);
  height: 3px;
  border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  background: var(--primary);
  content: "";
  opacity: .78;
}

.overview-grid > .stats-grid .stat-card.active::before { background: var(--success); }
.overview-grid > .stats-grid .stat-card.warning::before { background: var(--warning); }
.overview-grid > .stats-grid .stat-card.danger::before { background: var(--danger); }
.overview-grid > .stats-grid .stat-card.frozen::before { background: var(--info); }

.overview-grid > .stats-grid .stat-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.overview-grid > .stats-grid .stat-head { align-items: flex-start; }
.overview-grid > .stats-grid .stat-label { color: var(--color-text-soft); }
.overview-grid > .stats-grid .stat-value { text-align: start; }
.overview-grid > .stats-grid .stat-caption { text-align: start; }
.overview-grid > .stats-grid .stat-card.active .stat-icon { background: var(--success-soft); color: var(--success); }
.overview-grid > .stats-grid .stat-card.frozen .stat-icon { background: var(--info-soft); color: var(--info); }

@media (min-width: 992px) and (max-width: 1199px) {
  .overview-grid > .alerts-panel {
    grid-column: 1 / span 6;
    grid-row: 2;
  }

  .overview-grid > .dashboard-day-pass-card {
    grid-column: 7 / span 6;
    grid-row: 2;
  }

  .overview-grid > .monthly-finance-card,
  .overview-grid > .monthly-finance-snapshot {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

@media (max-width: 991px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .dashboard-hero-actions {
    border-top: 1px solid var(--border-secondary);
    border-inline-start: 0;
  }

  .overview-grid > .stats-grid .stat-card { min-height: 132px; }
}

@media (max-width: 600px) {
  .dashboard-hero-content { gap: var(--space-3); padding: var(--space-4); }
  .dashboard-hero-actions { padding: var(--space-4); }
  .dashboard-hero-topline { align-items: flex-start; flex-direction: column; }
  .dashboard-hero-heading { align-items: flex-start; gap: var(--space-3); }
  .dashboard-hero-brand-mark { width: 50px; height: 50px; flex-basis: 50px; border-radius: var(--brand-image-radius); }
  .dashboard-hero-heading h2 { font-size: 1.25rem; }
  .dashboard-hero-meta { display: grid; gap: 5px; }
  .dashboard-hero-meta span + span::before { display: none; }
  .dashboard-hero-buttons { display: grid; grid-template-columns: 1fr; }
  .dashboard-hero-buttons .btn { width: 100%; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/members.css */
#membersSection {
  display: grid;
  gap: var(--space-5);
}

.members-panel > .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.members-panel > .panel-header h3 {
  color: var(--color-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-extrabold);
}

.members-panel > .panel-header p {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Pricing and membership configuration lives in its own Owner-only tab. */
#topPricingButton,
#dashboardPrintPricingButton,
#pricingButton,
#membershipTypesButton {
  display: none;
}

.members-toolbar {
  align-items: flex-end;
  padding: var(--space-4) 0;
}

.members-toolbar-copy {
  display: flex;
  min-width: 190px;
  align-items: center;
  gap: var(--space-3);
}

.members-toolbar-copy > div {
  display: grid;
  gap: 1px;
}

.members-toolbar-copy strong {
  color: var(--color-text);
  font-size: var(--font-sm);
}

.members-toolbar-copy div span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.members-toolbar-controls {
  flex: 1;
}

.members-filter-field {
  display: grid;
  min-width: 150px;
  flex: 0 1 180px;
  gap: var(--space-1);
}

.members-filter-field > span {
  color: var(--color-text-muted);
  font-size: 10px;
}

.members-search-field {
  position: relative;
  display: block;
  min-width: 240px;
  flex: 1 1 280px;
}

.members-search-field > svg {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  width: 17px;
  height: 17px;
  color: var(--color-text-subtle);
  pointer-events: none;
  transform: translateY(-50%);
}

.members-search-field input {
  padding-inline-start: var(--space-3);
  padding-left: var(--space-9);
}

.members-list {
  min-width: 0;
}

.members-list > .loading,
.members-list > .empty {
  min-height: 180px;
}

.member-card,
.members-mobile-card,
.member-list-card {
  display: grid;
  gap: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
}

.member-card + .member-card,
.members-mobile-card + .members-mobile-card,
.member-list-card + .member-list-card { margin-top: var(--space-3); }

.member-card-head,
.member-summary,
.member-card-actions,
.member-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.member-action-row {
  justify-content: center;
  flex-wrap: nowrap;
  min-width: 0;
  margin-top: var(--space-2);
}

.member-quick-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-1);
}

.member-quick-actions .member-attendance-quick,
.member-quick-actions .member-attendance-status {
  width: 100px;
  min-width: 100px;
  flex: 0 0 100px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Attendance is a live row action, so its visual state must be immediately
   recognizable in both the desktop table and the responsive member card. */
.member-quick-actions .member-attendance-quick {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: var(--weight-bold);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.member-quick-actions .member-attendance-quick.check-in {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.member-quick-actions .member-attendance-quick.check-in:hover:not(:disabled) {
  border-color: var(--color-success);
  background: var(--color-success);
  color: var(--text-on-primary);
  transform: translateY(-1px);
}

.member-quick-actions .member-attendance-quick.checkout {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.member-quick-actions .member-attendance-quick.checkout:hover:not(:disabled) {
  border-color: var(--color-warning);
  background: var(--color-warning);
  color: var(--text-on-primary);
  transform: translateY(-1px);
}

.member-quick-actions .member-attendance-status {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  background: var(--color-info-soft);
  color: var(--color-info);
  font-weight: var(--weight-bold);
  padding: 0 var(--space-3);
}

.member-quick-actions .member-attendance-status.auto {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.member-quick-actions .member-attendance-status.unavailable {
  border-color: var(--border-color);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.member-action-row > .table-actions {
  flex: 0 0 auto;
  min-width: 0;
  margin-inline: 0;
}

.member-identity,
.member-info {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}

.member-avatar,
.member-card-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: var(--weight-bold);
}

.member-identity-copy,
.member-card-copy { display: grid; min-width: 0; gap: 1px; }
.member-identity-copy strong,
.member-card-copy strong { overflow: hidden; color: var(--color-text); font-size: var(--font-sm); text-overflow: ellipsis; white-space: nowrap; }
.member-identity-copy small,
.member-card-copy small { color: var(--color-text-muted); font-size: var(--font-xs); direction: ltr; text-align: right; }
.member-card-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.member-detail { display: grid; gap: 1px; }
.member-detail span { color: var(--color-text-muted); font-size: 10px; }
.member-detail strong { color: var(--color-text-soft); font-size: var(--font-sm); }

.members-table .member-cell { min-width: 220px; }
.members-table .actions-cell { width: 190px; }

.members-table {
  min-width: 1120px;
}

.membership-portal-code-card {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--bg-card-hover), var(--bg-surface));
}

.membership-portal-code-head,
.membership-portal-code-value,
.membership-portal-code-actions { display: flex; align-items: center; gap: var(--space-3); }
.membership-portal-code-head { justify-content: space-between; }
.membership-portal-code-kicker { display: block; margin-bottom: 2px; color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.membership-portal-code-head h4 { margin: 0; color: var(--color-text); font-size: var(--font-lg); }
.membership-portal-code-head p { margin: 3px 0 0; color: var(--color-text-muted); font-size: var(--font-xs); }
.membership-portal-code-status { padding: 5px 10px; border-radius: 999px; font-size: var(--font-xs); font-weight: var(--weight-bold); }
.membership-portal-code-status.active { background: var(--color-success-soft); color: var(--color-success); }
.membership-portal-code-status.inactive { background: var(--color-danger-soft); color: var(--color-danger); }
.membership-portal-code-value { justify-content: space-between; padding: var(--space-4); border: 1px dashed var(--border-focus); border-radius: var(--radius-md); background: var(--bg-card); }
.membership-portal-code-value code { color: var(--primary-active); font: 800 1.2rem/1.3 Inter, "Cairo", sans-serif; letter-spacing: .08em; }
.membership-portal-code-value span { color: var(--color-text-muted); font-size: var(--font-xs); }
.membership-portal-code-actions { flex-wrap: wrap; }
.membership-portal-code-actions .btn { min-height: 42px; }
.member-code-preview { display: block; color: var(--color-primary); }
.member-code-preview b { font-family: Inter, "Cairo", sans-serif; font-weight: var(--weight-bold); letter-spacing: .04em; }

@media (max-width: 640px) {
  .membership-portal-code-card { padding: var(--space-4); }
  .membership-portal-code-head { align-items: flex-start; }
  .membership-portal-code-value { align-items: flex-start; flex-direction: column; }
  .membership-portal-code-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .membership-portal-code-actions .btn:last-child { grid-column: 1 / -1; }
}

.members-table th,
.members-table td {
  white-space: nowrap;
}

.members-table th:nth-child(1) { width: 25%; }
.members-table th:nth-child(2) { width: 15%; }
.members-table th:nth-child(3) { width: 13%; }
.members-table th:nth-child(4) { width: 14%; }
.members-table th:nth-child(5) { width: 9%; }
.members-table th:nth-child(6) { width: 13%; }
.members-table th:nth-child(7) { width: 19%; }

.members-table th:last-child,
.members-table td:last-child {
  min-width: 320px;
}

.members-table .table-actions {
  justify-content: center;
  gap: var(--space-1);
  min-width: 304px;
  max-width: none;
  flex-wrap: nowrap;
}

.members-table .member-action-row {
  min-width: 304px;
}

.members-table .table-actions .btn {
  min-width: 34px;
  padding-inline: var(--space-2);
}

.members-table .table-actions .btn-primary {
  min-width: 116px;
  padding-inline: var(--space-3);
}

.members-table .table-actions .icon-action[data-action="freeze"],
.members-list .icon-action[data-action="freeze"] {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.members-table .table-actions .icon-action[data-action="payment"],
.members-list .icon-action[data-action="payment"] {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.members-table .table-actions .icon-action[data-action="qr"],
.members-list .icon-action[data-action="qr"] {
  border-color: var(--primary-border);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.members-table .table-actions .icon-action[data-action="freeze"]:hover:not(:disabled),
.members-list .icon-action[data-action="freeze"]:hover:not(:disabled) {
  border-color: var(--color-warning);
  background: var(--color-warning);
  color: var(--text-on-primary);
}

.members-table .table-actions .icon-action[data-action="payment"]:hover:not(:disabled),
.members-list .icon-action[data-action="payment"]:hover:not(:disabled) {
  border-color: var(--color-success);
  background: var(--color-success);
  color: var(--text-on-primary);
}

.members-table .table-actions .icon-action[data-action="qr"]:hover:not(:disabled),
.members-list .icon-action[data-action="qr"]:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--text-on-primary);
}

.members-table .table-actions .icon-action[data-action="refund"],
.members-list .icon-action[data-action="refund"],
.action-menu-item[data-action="refund"] .action-icon {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.members-table .table-actions .icon-action[data-action="refund"]:hover:not(:disabled),
.members-list .icon-action[data-action="refund"]:hover:not(:disabled),
.action-menu-item[data-action="refund"]:hover {
  border-color: var(--color-danger);
  background: var(--color-danger);
  color: var(--text-on-primary);
}

#actionDialog {
  width: min(560px, calc(100% - 32px));
}

#actionDialog #dialogTitle {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-extrabold);
}

#actionDialog #dialogDescription {
  margin: calc(var(--space-2) * -1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

#dialogFields {
  display: grid;
  gap: var(--space-4);
}

.refund-loading-note,
.refund-policy-note,
.refund-unavailable-note {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: var(--space-4);
  line-height: 1.8;
}

.refund-policy-note {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
  font-weight: var(--weight-semibold);
}

.refund-unavailable-note {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.refund-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.refund-summary-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-3);
}

.refund-summary-grid span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.refund-summary-grid strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-md);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refund-summary-grid .refund-highlight {
  color: var(--color-danger);
}

.refund-confirm-alert .swal2-title {
  color: var(--color-danger);
}

@media (max-width: 520px) {
  .refund-summary-grid {
    grid-template-columns: 1fr;
  }
}

.freeze-limit-note,
.payment-dialog-balance {
  display: grid;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-4);
}

.freeze-limit-note {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
}

.freeze-limit-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  color: var(--color-warning);
}

.freeze-limit-icon .action-icon {
  width: 21px;
  height: 21px;
}

.freeze-limit-note strong,
.payment-dialog-balance strong {
  color: var(--color-text);
  font-size: var(--font-md);
}

.freeze-limit-note div {
  display: grid;
  gap: var(--space-1);
}

.freeze-limit-note div span,
.payment-dialog-balance span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.payment-dialog-balance {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  text-align: center;
}

.payment-dialog-balance strong {
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
}

.payment-dialog-balance strong.has-debt {
  color: var(--color-danger);
}

.members-table .table-action-label {
  overflow: visible;
  white-space: nowrap;
}

.members-table .table-sub.has-debt {
  color: var(--color-danger);
  font-weight: var(--weight-semibold);
}

.members-table .table-sub.is-settled {
  color: var(--color-success);
}

@media (max-width: 991px) {
  .members-table {
    min-width: 1040px;
  }

  .members-table th,
  .members-table td {
    padding-inline: var(--space-3);
  }
}

@media (max-width: 767px) {
  .members-panel > .panel-header { align-items: stretch; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions > * { flex: 1 1 auto; }
  .members-toolbar-controls { width: 100%; }
  .members-filter-field { min-width: 0; flex: 1 1 calc(50% - var(--space-2)); }
  .members-search-field { flex-basis: 100%; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/trainees.css */
.coaching-section {
  min-width: 0;
}

.coaching-header,
.coaching-toolbar,
.coaching-heading,
.coaching-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.coaching-heading {
  justify-content: flex-start;
}

.coaching-heading-icon,
.library-heading-icon,
.attendance-heading-icon {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.coaching-heading-icon svg,
.library-heading-icon svg,
.attendance-heading-icon svg { width: 24px; height: 24px; }

.coaching-heading > div,
.library-heading > div,
.attendance-heading > div { display: grid; gap: var(--space-1); }

.coaching-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

.coaching-summary-card,
.coaching-stat,
.trainee-stat-card {
  display: grid;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-4);
}

.coaching-summary-card strong,
.coaching-stat strong,
.trainee-stat-card strong { color: var(--color-text); font-family: var(--font-latin); font-size: 1.5rem; direction: ltr; }
.coaching-summary-card span,
.coaching-stat span,
.trainee-stat-card span { color: var(--color-text-muted); font-size: var(--font-xs); }

.coaching-toolbar { padding-block: var(--space-2); }
.coaching-search { min-width: 220px; max-width: 520px; }
.coaching-result-badge { color: var(--color-text-muted); font-size: var(--font-xs); }
.coaching-message { margin-block: var(--space-2); }
.external-trainees-list { display: grid; gap: var(--space-3); }
.external-trainee-card { display: grid; gap: var(--space-4); border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-4); }
.external-trainee-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.external-trainee-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }

@media (max-width: 767px) {
  .coaching-header,
  .coaching-toolbar { align-items: stretch; flex-direction: column; }
  .coaching-toolbar-actions { justify-content: space-between; }
  .coaching-search { max-width: none; }
  .external-trainee-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/memberships.css */
.pricing-dialog,
.type-dialog,
.expense-dialog,
.member-dialog,
.details-dialog,
.library-dialog,
.library-details-dialog,
.coaching-small-dialog,
.auth-user-dialog,
.backup-restore-dialog {
  width: min(820px, calc(100% - 32px));
}

.details-dialog-head,
.pricing-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.details-dialog-head h3,
.pricing-section-head h4 {
  color: var(--color-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-extrabold);
}

.details-dialog-head p,
.pricing-section-head p {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.pricing-table-scroll,
.pricing-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.pricing-summary,
.type-preview {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

/* Pricing and membership types are separate workspaces. Keeping their
   visual language distinct prevents the two management tables from reading
   like one mixed data set. */
#managementSection .management-tab-header {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
  padding: var(--space-5);
}

#managementSection .management-shortcuts {
  position: relative;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-color: var(--border-secondary);
  background: var(--color-surface);
  padding-top: calc(var(--space-5) + var(--space-2));
}

#managementSection .management-shortcuts::before {
  position: absolute;
  top: var(--space-3);
  inset-inline-start: var(--space-5);
  color: var(--color-text-muted);
  content: 'إدارة الأسعار والعضويات';
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

#managementSection .management-shortcut {
  min-height: 96px;
  border-width: 1px;
  box-shadow: var(--shadow-xs);
}

#managementSection .management-shortcut:first-of-type {
  border-color: var(--primary-border);
  background: linear-gradient(135deg, var(--primary-soft), var(--color-surface));
}

#managementSection .management-shortcut:last-of-type {
  border-color: var(--success-border);
  background: linear-gradient(135deg, var(--success-soft), var(--color-surface));
}

#managementSection .management-shortcut:last-of-type .management-shortcut-icon {
  background: var(--color-success-soft);
  color: var(--color-success);
}

#pricingDialog,
#membershipTypesDialog {
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

#pricingDialog {
  width: min(1060px, calc(100% - 32px));
  border-color: var(--primary-border);
}

#membershipTypesDialog {
  width: min(940px, calc(100% - 32px));
  border-color: var(--success-border);
}

#pricingDialog > form.dialog-body,
#membershipTypesDialog > .dialog-body {
  gap: var(--space-5);
  padding: var(--space-6);
}

#pricingDialog .details-dialog-head,
#membershipTypesDialog .details-dialog-head {
  align-items: center;
  border-bottom: 0;
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

#pricingDialog .details-dialog-head {
  border: 1px solid var(--primary-border);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
}

#membershipTypesDialog .details-dialog-head {
  border: 1px solid var(--success-border);
  background: linear-gradient(135deg, var(--color-success-soft), var(--color-surface));
}

#pricingDialog .details-dialog-head::before,
#membershipTypesDialog .details-dialog-head::before {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-weight: var(--weight-extrabold);
}

#pricingDialog .details-dialog-head::before {
  background: var(--color-primary);
  color: var(--text-on-primary);
  content: '01';
}

#membershipTypesDialog .details-dialog-head::before {
  background: var(--color-success);
  color: var(--text-on-primary);
  content: '02';
}

#pricingDialog .pricing-section-head,
#membershipTypesDialog .pricing-section-head {
  align-items: center;
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

#pricingDialog .pricing-section-head {
  border: 1px solid var(--primary-border);
  border-inline-start: 4px solid var(--color-primary);
  background: var(--bg-card-hover);
}

#membershipTypesDialog .pricing-section-head {
  border: 1px solid var(--success-border);
  border-inline-start: 4px solid var(--color-success);
  background: var(--success-soft);
}

#pricingDialog .pricing-section-head h4,
#membershipTypesDialog .pricing-section-head h4 {
  margin: 0;
  font-size: var(--font-lg);
}

#pricingDialog .pricing-section-head p,
#membershipTypesDialog .pricing-section-head p {
  margin-top: var(--space-1);
  line-height: 1.7;
}

#pricingDialog .pricing-table-scroll,
#membershipTypesDialog .pricing-table-scroll {
  max-height: 212px;
  overflow-x: auto;
  overflow-y: auto;
  padding: 0;
  background: transparent;
}

#pricingDialog .pricing-table-scroll,
#membershipTypesDialog .pricing-table-scroll {
  border: 0;
  border-radius: 0;
}

#pricingDialog .pricing-table-scroll::-webkit-scrollbar,
#membershipTypesDialog .pricing-table-scroll::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

#pricingDialog .pricing-table-scroll::-webkit-scrollbar-thumb,
#membershipTypesDialog .pricing-table-scroll::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

#membershipTypesDialog #membershipTypesTableContainer {
  max-height: 360px;
}

#pricingDialog #dayPassPricingContainer {
  max-height: 240px;
}

#pricingDialog .pricing-table,
#membershipTypesDialog .membership-types-table {
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  table-layout: fixed;
}

#pricingDialog .pricing-table thead th,
#membershipTypesDialog .membership-types-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

#pricingDialog .pricing-table {
  min-width: 820px;
}

#pricingDialog .pricing-table th,
#pricingDialog .pricing-table td,
#membershipTypesDialog .membership-types-table th,
#membershipTypesDialog .membership-types-table td {
  padding: var(--space-3) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

#pricingDialog .pricing-table th {
  background: var(--info-soft);
  color: var(--info-text);
}

#pricingDialog .pricing-table th:nth-child(1) { width: 24%; text-align: start; }
#pricingDialog .pricing-table th:nth-child(2) { width: 17%; }
#pricingDialog .pricing-table th:nth-child(n + 3) { width: 19.66%; }

#pricingDialog .pricing-table td:first-child {
  background: var(--bg-card-hover);
  text-align: start;
}

#pricingDialog .pricing-table tbody tr:hover td { background: var(--color-primary-soft); }

#pricingDialog .pricing-table input[type='text'],
#pricingDialog .pricing-table input:not([type]) {
  width: 100%;
  min-height: 42px;
  text-align: start;
}

#pricingDialog .pricing-table input[type='number'] {
  width: 100%;
  min-height: 42px;
  direction: ltr;
  text-align: center;
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
}

.pricing-column-hint {
  display: block;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: var(--weight-regular);
}

#membershipTypesDialog .membership-types-table {
  min-width: 700px;
}

#membershipTypesDialog .membership-types-table th {
  background: var(--success-soft);
  color: var(--success-text);
}

#membershipTypesDialog .membership-types-table th:nth-child(1) { width: 29%; text-align: start; }
#membershipTypesDialog .membership-types-table th:nth-child(2) { width: 18%; }
#membershipTypesDialog .membership-types-table th:nth-child(3) { width: 20%; }
#membershipTypesDialog .membership-types-table th:nth-child(4) { width: 17%; }
#membershipTypesDialog .membership-types-table th:nth-child(5) { width: 16%; }

#membershipTypesDialog .membership-types-table td:first-child { text-align: start; }
#membershipTypesDialog .membership-types-table tbody tr:hover td { background: var(--color-primary-soft); }

.type-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-pill);
  background: var(--color-success-soft);
  color: var(--success-text);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.type-status.off {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--warning-text);
}

.type-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

#membershipTypesDialog .type-actions .btn {
  min-width: 82px;
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--success-text);
}

#membershipTypesDialog .type-actions .btn:hover:not(:disabled) {
  background: var(--color-success);
  color: var(--text-on-primary);
}

/* Pricing management dialogs use three independent zones: the header and
   footer stay in place while only the content region scrolls. This prevents
   sticky layers from covering fields or table rows when the catalog grows. */
#pricingDialog,
#membershipTypesDialog {
  height: min(820px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  padding: 0;
}

#pricingDialog > form.dialog-body,
#membershipTypesDialog > .dialog-body {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  height: 100%;
  max-height: none;
  overflow: hidden;
  padding: 0;
}

.management-dialog-header {
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
  background: var(--color-surface);
}

.management-dialog-heading {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.management-dialog-eyebrow {
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.management-dialog-heading h3 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-extrabold);
}

.management-dialog-heading p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.management-dialog-mark {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--color-primary-hover);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-weight: var(--weight-extrabold);
}

.management-dialog-mark-success {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

.dialog-scroll-content {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: var(--space-5);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-5) var(--space-6);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.dialog-scroll-content::-webkit-scrollbar { width: 7px; }
.dialog-scroll-content::-webkit-scrollbar-track { background: transparent; }
.dialog-scroll-content::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

#pricingDialog .dialog-scroll-content .day-pass-pricing-section {
  margin-top: 0;
}

#pricingDialog .dialog-footer,
#membershipTypesDialog .dialog-footer {
  position: static;
  z-index: auto;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  margin: 0;
  border-top: 1px solid var(--border-color);
  background: var(--color-surface);
  box-shadow: none;
  padding: var(--space-4) var(--space-6);
}

#pricingDialog .dialog-footer .btn,
#membershipTypesDialog .dialog-footer .btn {
  min-width: 112px;
}

@media (max-width: 600px) {
  #pricingDialog,
  #membershipTypesDialog {
    width: calc(100% - 20px);
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .management-dialog-header {
    padding: var(--space-4);
  }

  .dialog-scroll-content {
    gap: var(--space-4);
    padding: var(--space-4);
  }

  #pricingDialog .dialog-footer,
  #membershipTypesDialog .dialog-footer {
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
  }

  #pricingDialog .dialog-footer .btn,
  #membershipTypesDialog .dialog-footer .btn {
    flex: 1 1 150px;
  }
}

.auth-form-grid,
.expense-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.auth-form-grid .full,
.expense-notes-field { grid-column: 1 / -1; }
.auth-helper { color: var(--color-text-muted); font-size: var(--font-xs); }
.backup-validation-box { margin-top: var(--space-4); }

@media (max-width: 600px) {
  .auth-form-grid,
  .expense-form-grid { grid-template-columns: 1fr; }
  .auth-form-grid .full,
  .expense-notes-field { grid-column: auto; }
  .details-dialog-head,
  .pricing-section-head { align-items: stretch; flex-direction: column; }

  #pricingDialog > form.dialog-body,
  #membershipTypesDialog > .dialog-body { padding: var(--space-4); }

  #pricingDialog .details-dialog-head,
  #membershipTypesDialog .details-dialog-head,
  #pricingDialog .pricing-section-head,
  #membershipTypesDialog .pricing-section-head { align-items: stretch; }

  #pricingDialog .details-dialog-head::before,
  #membershipTypesDialog .details-dialog-head::before { align-self: flex-start; }

  #pricingDialog .pricing-section-head .btn,
  #membershipTypesDialog .pricing-section-head .btn { width: 100%; }
}

@media (max-width: 767px) {
  #pricingDialog,
  #membershipTypesDialog { width: calc(100% - 20px); }

  #managementSection .management-shortcuts { grid-template-columns: 1fr; }
  #managementSection .management-shortcut { min-height: 82px; }
}

.day-pass-pricing-section {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-lg);
  background: var(--color-info-soft);
  padding: var(--space-4);
}
.day-pass-pricing-note { color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.day-pass-pricing-actions { display: flex; justify-content: flex-start; }
.day-pass-pricing-table { width: 100%; min-width: 500px; }
.day-pass-pricing-table th,
.day-pass-pricing-table td { padding: var(--space-3); text-align: center; vertical-align: middle; }
.day-pass-pricing-table th { background: var(--table-header-bg); color: var(--color-text-soft); font-size: var(--font-xs); }
.day-pass-pricing-table td { border-top: 1px solid var(--border-color); }
.day-pass-pricing-table td:first-child { text-align: start; }
.day-pass-pricing-table strong,
.day-pass-pricing-table small { display: block; }
.day-pass-pricing-table small { color: var(--color-text-muted); font-family: var(--font-latin); font-size: var(--font-xs); }
.day-pass-pricing-table input { max-width: 150px; direction: ltr; text-align: center; }
.day-pass-type-status { display: inline-flex; min-height: 26px; align-items: center; border-radius: var(--radius-pill); background: var(--color-success-soft); color: var(--color-success); padding: 0 var(--space-3); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.day-pass-type-status.inactive { background: var(--color-warning-soft); color: var(--color-warning); }

/* Member details is a workspace, not a narrow alert. The content is built
   dynamically by app.js, so the visual contract lives here and applies to
   every member without changing the data flow. */
.details-dialog,
.coaching-profile-dialog,
.coaching-builder-dialog {
  width: min(1180px, calc(100% - 32px));
}

.coaching-builder-dialog {
  width: min(1080px, calc(100% - 32px));
  max-width: 1080px;
  max-height: calc(100vh - 32px);
}

/* The member form has its own shell (header outside the form). Keep the
   header and action footer visible while only the form fields scroll. */
.member-dialog {
  max-height: calc(100vh - 32px);
  overflow: hidden;
  padding: 0;
}

.member-dialog > .form-panel {
  display: grid;
  width: 100%;
  max-height: inherit;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  margin: 0;
  border: 0;
  border-radius: inherit;
  box-shadow: none;
}

.member-dialog .section-heading {
  position: relative;
  z-index: var(--z-content);
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-6);
}

.member-dialog .section-heading h3 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-xl);
}

.member-dialog .dialog-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.member-dialog .form-body {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.member-dialog .form-body::-webkit-scrollbar {
  width: 8px;
}

.member-dialog .form-body::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

.member-dialog .section-label {
  margin-top: var(--space-2);
  border-bottom: 1px solid var(--border-color);
  color: var(--color-primary);
  padding-bottom: var(--space-2);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.member-dialog .field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.member-dialog .form-actions {
  position: sticky;
  bottom: calc(var(--space-6) * -1);
  z-index: var(--z-content);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: auto calc(var(--space-6) * -1) calc(var(--space-6) * -1);
  border-top: 1px solid var(--border-color);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-6);
}

.member-dialog .form-actions .btn {
  min-width: 130px;
}

.details-dialog .dialog-body,
.coaching-profile-dialog .dialog-body,
.coaching-builder-dialog .dialog-body {
  padding: var(--space-6);
}

.details-dialog-head {
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-5);
}

.details-dialog-head > div:first-child {
  min-width: 0;
}

.details-dialog-head h3 {
  margin: 0;
  line-height: 1.35;
}

.details-dialog-head p {
  margin-top: var(--space-2);
  line-height: 1.7;
}

#detailsContent,
#coachingProfileContent {
  display: grid;
  gap: var(--space-5);
}

.details-summary,
.financial-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.details-summary-card,
.financial-summary-card {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-4);
  text-align: center;
}

.details-summary-card span,
.financial-summary-card span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.details-summary-card strong,
.financial-summary-card strong {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-variant-numeric: tabular-nums;
}

.details-summary-card .table-sub {
  color: var(--color-success);
}

.financial-summary-card.paid strong {
  color: var(--color-success);
}

.financial-summary-card.remaining {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
}

.financial-summary-card.remaining strong {
  color: var(--color-danger);
}

.details-section {
  display: grid;
  gap: var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.details-section > h4 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.details-section .history-scroll {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.details-section .history-table {
  min-width: 820px;
}

.event-list {
  display: grid;
  gap: var(--space-2);
}

.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-3) var(--space-4);
}

.event-item > div {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.event-item strong {
  color: var(--color-text);
  font-size: var(--font-sm);
}

.event-item > div > span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.event-date {
  flex: 0 0 auto;
  color: var(--color-text-subtle);
  direction: ltr;
  font-size: var(--font-xs);
  white-space: nowrap;
}

.history-empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: var(--space-6);
  text-align: center;
}

@media (max-width: 767px) {
  .member-dialog {
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
  }

  .member-dialog .section-heading {
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    padding: var(--space-4);
  }

  .member-dialog .dialog-heading-actions {
    width: 100%;
  }

  .member-dialog .dialog-heading-actions .btn {
    flex: 1 1 120px;
  }

  .member-dialog .form-body {
    padding: var(--space-4);
  }

  .member-dialog .field-grid {
    grid-template-columns: 1fr;
  }

  .member-dialog .form-actions {
    bottom: calc(var(--space-4) * -1);
    margin-inline: calc(var(--space-4) * -1);
    margin-bottom: calc(var(--space-4) * -1);
    padding: var(--space-3) var(--space-4);
  }

  .member-dialog .form-actions .btn {
    flex: 1 1 140px;
  }

  .details-dialog,
  .coaching-profile-dialog,
  .coaching-builder-dialog {
    width: calc(100% - 20px);
  }

  .details-dialog .dialog-body,
  .coaching-profile-dialog .dialog-body,
  .coaching-builder-dialog .dialog-body {
    padding: var(--space-4);
  }

  .details-summary,
  .financial-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .details-section {
    padding: var(--space-4);
  }

  .event-item {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-2);
  }

  .event-date {
    align-self: flex-start;
  }
}

/* Member details card ---------------------------------------------------- */
#detailsDialog {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--color-border-soft);
  border-radius: 24px;
  background: var(--color-page);
}

#detailsDialog > .dialog-body {
  gap: var(--space-5);
  max-height: calc(100dvh - 32px);
  background: var(--color-page);
  padding: 28px;
}

#detailsDialog > .dialog-body > .member-details-head {
  top: -28px;
  min-height: 100px;
  align-items: center;
  margin: -28px -28px 0;
  border-bottom: 1px solid var(--color-border-soft);
  background: var(--color-surface);
  padding: 20px 28px;
}

#detailsDialog .member-details-head-content,
#detailsDialog .member-profile-identity,
#detailsDialog .member-profile-name-row {
  display: flex;
  min-width: 0;
  align-items: center;
}

#detailsDialog .member-profile-identity {
  gap: var(--space-4);
}

#detailsDialog .member-profile-avatar {
  display: grid;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  background: var(--color-pale-blue);
  color: var(--color-primary);
  font-size: var(--font-xl);
  font-weight: var(--weight-extrabold);
}

#detailsDialog .member-profile-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

#detailsDialog .member-profile-name-row {
  flex-wrap: wrap;
  gap: var(--space-3);
}

#detailsDialog .member-profile-name-row h3 {
  min-width: 0;
  color: var(--color-navy);
  font-size: 24px;
  font-weight: var(--weight-extrabold);
  line-height: 1.35;
}

#detailsDialog .member-profile-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-primary);
  padding: 0 12px;
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

#detailsDialog .member-profile-phone {
  direction: ltr;
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: var(--font-sm);
  text-align: start;
  unicode-bidi: isolate;
}

#detailsDialog .member-profile-registration {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

#detailsDialog .member-details-head > #detailsClose {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 42px;
}

#detailsDialog .print-dialog-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-2);
}

#detailsDialog .member-expiry-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--warning-border);
  border-radius: 16px;
  background: var(--color-warning-surface);
  padding: 18px 20px;
  color: var(--color-warning-strong);
}

#detailsDialog .member-expiry-banner[data-tone="danger"] {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--color-outstanding);
}

#detailsDialog .member-expiry-banner[data-tone="info"] {
  border-color: var(--info-border);
  background: var(--color-pale-blue);
  color: var(--color-primary);
}

#detailsDialog .member-expiry-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--warning-soft);
}

#detailsDialog .member-expiry-banner[data-tone="danger"] .member-expiry-icon {
  background: var(--danger-soft);
}

#detailsDialog .member-expiry-banner[data-tone="info"] .member-expiry-icon {
  background: var(--info-soft);
}

#detailsDialog .member-expiry-banner > span:last-child {
  display: grid;
  gap: 2px;
}

#detailsDialog .member-expiry-banner strong {
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

#detailsDialog .member-expiry-banner small {
  color: inherit;
  font-size: var(--font-sm);
}

#detailsDialog .member-details-overview {
  display: grid;
  gap: var(--space-5);
}

#detailsDialog .member-details-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

#detailsDialog .member-detail-stat {
  display: flex;
  min-width: 0;
  min-height: 140px;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--color-border-soft);
  border-radius: 16px;
  background: var(--color-surface);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
}

#detailsDialog .member-detail-stat.has-outstanding {
  border-color: var(--danger-border);
}

#detailsDialog .member-detail-stat-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--color-pale-blue);
  color: var(--color-primary);
}

#detailsDialog .member-detail-stat-icon .ui-icon {
  width: 22px;
  height: 22px;
}

#detailsDialog .member-detail-stat-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

#detailsDialog .member-detail-stat-copy small {
  color: var(--color-text-muted);
  font-size: 15px;
}

#detailsDialog .member-detail-stat-copy strong {
  overflow-wrap: anywhere;
  color: var(--color-navy);
  font-size: 24px;
  font-weight: var(--weight-extrabold);
  line-height: 1.25;
}

#detailsDialog .member-detail-stat-copy em {
  color: var(--color-text-muted);
  font-size: 14px;
  font-style: normal;
}

#detailsDialog .member-detail-stat-copy .member-ltr-value {
  direction: ltr;
  text-align: start;
  unicode-bidi: isolate;
}

#detailsDialog .member-detail-stat-copy .outstanding-text {
  color: var(--color-outstanding);
  font-weight: var(--weight-bold);
}

#detailsDialog .member-details-actions {
  display: grid;
  gap: var(--space-3);
  border-top: 1px solid var(--color-border-soft);
  padding-top: var(--space-5);
}

#detailsDialog .member-details-actions h4 {
  margin: 0;
  color: var(--color-navy);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

#detailsDialog .member-details-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 56px;
  gap: var(--space-2);
}

#detailsDialog .member-details-action {
  display: inline-flex;
  min-width: 0;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--primary-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-primary);
  padding: 0 var(--space-3);
  font-family: var(--font-body);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

#detailsDialog .member-details-action:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-pale-blue);
  transform: translateY(-1px);
}

#detailsDialog .member-details-action:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

#detailsDialog .member-details-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#detailsDialog .member-details-action .ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

#detailsDialog .member-details-action-primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--text-on-primary);
}

#detailsDialog .member-details-action-primary:hover:not(:disabled) {
  border-color: var(--primary-active);
  background: var(--primary-active);
  color: var(--text-on-primary);
}

#detailsDialog .member-details-action-more {
  width: 56px;
  padding: 0;
}

#detailsDialog .member-details-more {
  position: relative;
  display: block;
}

#detailsDialog .member-details-more-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: var(--z-dropdown);
  display: grid;
  min-width: 180px;
  gap: 2px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-2);
  box-shadow: var(--shadow-md);
}

#detailsDialog .member-details-more-menu[hidden] {
  display: none;
}

#detailsDialog .member-details-more-menu button {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-soft);
  padding: 0 var(--space-3);
  font-family: var(--font-body);
  font-size: var(--font-xs);
  text-align: start;
}

#detailsDialog .member-details-more-menu button:hover,
#detailsDialog .member-details-more-menu button:focus-visible {
  background: var(--color-pale-blue);
  color: var(--color-primary);
  outline: 0;
}

#detailsDialog .member-details-more-menu button[data-member-detail-action="refund"] {
  color: var(--color-danger);
}

#detailsDialog .member-details-more-menu button[data-member-detail-action="refund"]:hover,
#detailsDialog .member-details-more-menu button[data-member-detail-action="refund"]:focus-visible {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

#detailsDialog .member-details-more-menu .ui-icon {
  width: 18px;
  height: 18px;
}

#detailsDialog .details-section {
  border-color: var(--color-border-soft);
  border-radius: 16px;
  background: var(--color-surface);
}

#detailsDialog .member-store-purchases {
  gap: var(--space-3);
  border-color: var(--info-border);
  background: var(--bg-card-hover);
}

#detailsDialog .member-store-purchases-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

#detailsDialog .member-store-purchases-head h4,
#detailsDialog .member-store-purchases-head p {
  margin: 0;
}

#detailsDialog .member-store-purchases-head p {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

#detailsDialog .member-store-purchases-head > strong {
  flex: 0 0 auto;
  color: var(--color-primary);
  font-size: var(--font-sm);
  white-space: nowrap;
}

#detailsDialog .member-store-purchases-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

#detailsDialog .member-store-purchases-table {
  min-width: 760px;
}

#detailsDialog .member-store-purchases-table td:nth-child(2) {
  max-width: 300px;
  white-space: normal;
  line-height: 1.7;
}

#detailsDialog .history-table th,
#detailsDialog .history-table td {
  text-align: center;
  vertical-align: middle;
}

@media (max-width: 600px) {
  #detailsDialog {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 20px;
  }

  #detailsDialog > .dialog-body {
    max-height: calc(100dvh - 24px);
    padding: 18px;
  }

  #detailsDialog > .dialog-body > .member-details-head {
    top: -18px;
    min-height: 82px;
    margin: -18px -18px 0;
    padding: 14px 18px;
  }

  #detailsDialog .member-profile-identity {
    gap: var(--space-3);
  }

  #detailsDialog .member-profile-avatar {
    width: 56px;
    height: 56px;
    font-size: var(--font-lg);
  }

  #detailsDialog .member-profile-name-row h3 {
    font-size: 20px;
  }

  #detailsDialog .member-profile-badge {
    min-height: 24px;
    padding-inline: 9px;
  }

  #detailsDialog .member-profile-phone,
  #detailsDialog .member-profile-registration {
    font-size: 11px;
  }

  #detailsDialog .member-details-head > #detailsClose {
    min-width: 42px;
    width: 42px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  #detailsDialog .member-details-head > #detailsClose::before {
    content: "×";
    font-size: 25px;
    line-height: 1;
  }

  #detailsDialog .member-details-stats {
    grid-template-columns: 1fr;
  }

  #detailsDialog .member-detail-stat {
    min-height: 116px;
  }

  #detailsDialog .member-details-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #detailsDialog .member-details-action-renew {
    grid-column: 1 / -1;
  }

  #detailsDialog .member-details-action-more {
    width: 100%;
  }

  #detailsDialog .member-details-more-menu {
    right: 0;
    left: auto;
  }

  #detailsDialog .member-store-purchases-head {
    flex-direction: column;
  }
}

@media print {
#detailsDialog .member-details-actions,
#detailsDialog .member-expiry-banner,
#detailsDialog #detailsClose,
#detailsDialog .print-dialog-actions {
    display: none;
  }
}

/* Compact management workspace ----------------------------------------- */
#managementSection {
  gap: var(--space-3);
  padding: var(--space-4);
}

#managementSection .management-tab-header {
  padding: var(--space-4);
}

#managementSection .management-tab-header h3 {
  font-size: var(--font-lg);
}

#managementSection .management-tab-header p {
  margin-top: 4px;
  line-height: 1.55;
}

#managementSection .management-shortcuts {
  gap: var(--space-3);
  padding: calc(var(--space-4) + 18px) var(--space-4) var(--space-4);
}

#managementSection .management-shortcut {
  min-height: 70px;
  gap: var(--space-2);
  padding: var(--space-3);
}

#managementSection .management-shortcut-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

#managementSection .management-shortcut-icon .ui-icon {
  width: 17px;
  height: 17px;
}

#managementSection .management-shortcut-arrow { width: 16px; }

/* Both management dialogs share the same width and scroll contract. The
   content area owns vertical scrolling, while wide tables can scroll only
   horizontally inside their own wrapper when the viewport is narrow. */
#pricingDialog,
#membershipTypesDialog {
  width: min(1060px, calc(100% - 32px));
}

#pricingDialog .pricing-table-scroll,
#membershipTypesDialog .pricing-table-scroll {
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
}

#pricingDialog .pricing-table,
#membershipTypesDialog .membership-types-table {
  margin: 0;
}

@media (max-width: 767px) {
  #managementSection .management-shortcut { min-height: 82px; }
}

/* Pricing catalogs are edited as cards so every price keeps a readable label
   and a comfortable input width without forcing the dialog into a wide table. */
#pricingDialog .pricing-table-scroll,
#membershipTypesDialog .pricing-table-scroll {
  max-height: none;
  overflow: visible;
}

#pricingDialog #pricingTableContainer,
#pricingDialog #dayPassPricingContainer,
#membershipTypesDialog #membershipTypesTableContainer {
  width: 100%;
  min-width: 0;
}

.pricing-plan-grid,
.membership-type-card-grid,
.day-pass-pricing-card-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: var(--space-4);
}

.pricing-plan-grid {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.membership-type-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.day-pass-pricing-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.pricing-plan-card,
.membership-type-card,
.day-pass-pricing-card {
  display: grid;
  min-width: 0;
  gap: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.pricing-plan-card:hover,
.membership-type-card:hover,
.day-pass-pricing-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.pricing-plan-card-header,
.membership-type-card-header,
.day-pass-pricing-card-header,
.pricing-card-section-heading,
.membership-type-card-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.pricing-plan-card-header,
.membership-type-card-header,
.day-pass-pricing-card-header {
  border-bottom: 1px solid var(--border-secondary);
  padding-bottom: var(--space-3);
}

.pricing-plan-card-heading,
.membership-type-card-heading,
.day-pass-pricing-card-heading {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.pricing-card-eyebrow {
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.pricing-plan-card-code,
.membership-type-card-heading strong,
.day-pass-pricing-card-heading strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-md);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.membership-type-card-heading strong,
.day-pass-pricing-card-heading strong {
  font-size: var(--font-lg);
}

.membership-type-card-code,
.day-pass-pricing-card-code {
  color: var(--color-text-muted);
  direction: ltr;
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  text-align: start;
}

.pricing-card-index {
  display: inline-grid;
  min-width: 34px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--color-primary);
  direction: ltr;
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.pricing-card-base-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(170px, .75fr);
  gap: var(--space-3);
}

.pricing-card-field {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 7px;
  color: var(--color-text);
  text-align: start;
}

.pricing-card-field-label {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.pricing-card-field-hint {
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: var(--weight-regular);
  white-space: nowrap;
}

.pricing-card-input,
.pricing-card-input-shell {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 46px;
}

.pricing-card-input {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--color-text);
  padding: 0 var(--space-3);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.pricing-card-input:hover {
  border-color: var(--border-hover);
}

.pricing-card-input:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.pricing-card-input[type='number'] {
  direction: ltr;
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
  text-align: start;
}

.pricing-card-input-shell {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  direction: ltr;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.pricing-card-input-shell:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.pricing-card-input-shell .pricing-card-input {
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pricing-card-currency {
  display: inline-flex;
  min-width: 48px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-inline-start: 1px solid var(--border-secondary);
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.pricing-card-duration-section {
  display: grid;
  min-width: 0;
  gap: var(--space-3);
  border-top: 1px solid var(--border-secondary);
  padding-top: var(--space-3);
}

.pricing-plan-card-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-top: 1px solid var(--border-secondary);
  padding-top: var(--space-3);
}

.pricing-plan-card-actions .pricing-card-action {
  min-width: 96px;
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--color-primary);
}

.pricing-plan-card-actions .pricing-card-action:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--text-on-primary);
}

.pricing-card-section-heading strong {
  color: var(--color-text);
  font-size: var(--font-sm);
}

.pricing-card-section-heading > span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.pricing-duration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

.pricing-cards-muted,
.pricing-cards-empty {
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  line-height: 1.7;
}

.pricing-cards-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  grid-column: 1 / -1;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-5);
  text-align: center;
}

.membership-type-card-header .type-status,
.day-pass-pricing-card-header .day-pass-type-status {
  flex: 0 0 auto;
}

.membership-type-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.membership-type-info {
  display: grid;
  min-width: 0;
  gap: 5px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-3);
}

.membership-type-info-emphasis {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.membership-type-info-label {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.membership-type-info-value {
  overflow: hidden;
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-md);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.membership-type-card-actions {
  border-top: 1px solid var(--border-secondary);
  padding-top: var(--space-3);
}

.membership-type-card-actions .pricing-card-action {
  min-width: 96px;
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--success-text);
}

.membership-type-card-actions .pricing-card-action:hover:not(:disabled) {
  border-color: var(--color-success);
  background: var(--color-success);
  color: var(--text-on-primary);
}

.day-pass-pricing-card {
  align-content: start;
}

.day-pass-pricing-card .pricing-card-field {
  gap: 8px;
}

.day-pass-pricing-card .pricing-card-index {
  justify-self: start;
}

@media (max-width: 700px) {
  .pricing-plan-grid,
  .membership-type-card-grid,
  .day-pass-pricing-card-grid {
    grid-template-columns: 1fr;
  }

  .pricing-card-base-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .pricing-plan-card,
  .membership-type-card,
  .day-pass-pricing-card {
    padding: var(--space-3);
  }

  .pricing-duration-grid,
  .membership-type-info-grid {
    grid-template-columns: 1fr;
  }

  .pricing-card-field-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/attendance.css */
.attendance-section {
  gap: var(--space-5);
}

.attendance-header,
.attendance-heading,
.attendance-mode-actions,
.attendance-entry-head,
.attendance-input-row,
.attendance-list-head,
.attendance-list-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.attendance-heading { justify-content: flex-start; }
.attendance-heading > div { display: grid; gap: var(--space-1); }
.attendance-report-hint,
.attendance-entry-hint { color: var(--color-text-muted); font-size: var(--font-xs); }
.attendance-control-panel { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.9fr); gap: var(--space-4); align-items: stretch; }
.attendance-entry-card { display: grid; gap: var(--space-4); border: 1px solid var(--border-primary); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--bg-card-hover), var(--color-surface)); padding: var(--space-5); box-shadow: var(--shadow-xs); }
.attendance-entry-head h4,
.attendance-list-head h4 { color: var(--color-text); font-size: var(--font-lg); font-weight: var(--weight-bold); }
.attendance-entry-head p,
.attendance-list-head p { color: var(--color-text-muted); font-size: var(--font-xs); }
.attendance-segmented-control { display: inline-flex; gap: var(--space-1); border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface); padding: var(--space-1); }
.attendance-segmented-control button { border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-muted); padding: var(--space-2) var(--space-3); font-size: var(--font-xs); }
.attendance-segmented-control button.active,
.attendance-segmented-control button[aria-selected="true"] { background: var(--color-primary); color: var(--text-on-primary); }
.attendance-input-wrap { position: relative; display: block; min-width: 0; flex: 1 1 280px; }
.attendance-input-wrap svg { position: absolute; top: 50%; inset-inline-start: 14px; width: 18px; height: 18px; color: var(--color-text-subtle); pointer-events: none; transform: translateY(-50%); }
.attendance-input-wrap input {
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 44px 0 14px;
}
.attendance-action-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.btn-check-in { background: var(--color-success); color: var(--text-on-primary); }
.btn-check-in:hover:not(:disabled) { background: var(--color-success); filter: brightness(.92); }
.btn-check-out { background: var(--color-warning); color: var(--text-on-primary); }
.btn-check-out:hover:not(:disabled) { background: var(--color-warning); filter: brightness(.92); }
.attendance-member-preview { border: 1px solid var(--info-border); border-radius: var(--radius-md); background: var(--color-info-soft); padding: var(--space-4); }
.attendance-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); align-items: stretch; }
.attendance-summary-card { display: grid; min-height: 132px; justify-items: center; align-content: center; gap: var(--space-1); border: 1px solid var(--border-color); border-top: 3px solid var(--color-primary); border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-4); text-align: center; box-shadow: var(--shadow-xs); }
.summary-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: var(--color-primary-soft); color: var(--color-primary); }
.attendance-summary-card strong { font-family: var(--font-latin); font-size: 1.6rem; direction: ltr; }
.attendance-summary-card > span:last-child { color: var(--color-text-muted); font-size: var(--font-xs); }
.attendance-summary-card.checked-in { border-top-color: var(--color-success); }
.attendance-summary-card.checked-in .summary-icon { background: var(--color-success-soft); color: var(--color-success); }
.attendance-summary-card.checked-out { border-top-color: var(--color-warning); }
.attendance-summary-card.checked-out .summary-icon { background: var(--color-warning-soft); color: var(--color-warning); }
.attendance-list-actions { flex: 0 1 680px; flex-wrap: wrap; }
.attendance-status-filter { min-width: 150px; }
.attendance-list-head { margin-top: var(--space-2); border: 1px solid var(--border-color); border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--color-surface); padding: var(--space-4) var(--space-5); }
.attendance-search-wrap { min-width: 240px; }
.attendance-table-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--border-color); border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: var(--color-surface); }
.attendance-table { min-width: 1020px; table-layout: fixed; }
.attendance-table th,
.attendance-table td { padding: var(--space-3) var(--space-4); text-align: center; vertical-align: middle; }
.attendance-table th { background: var(--table-header-bg); color: var(--color-text-soft); }
.attendance-table th:nth-child(1) { width: 19%; text-align: start; }
.attendance-table th:nth-child(2) { width: 14%; }
.attendance-table th:nth-child(3),
.attendance-table th:nth-child(4) { width: 11%; }
.attendance-table th:nth-child(5) { width: 13%; }
.attendance-table th:nth-child(6) { width: 12%; }
.attendance-table th:nth-child(7) { width: 11%; }
.attendance-table th:nth-child(8) { width: 13%; }
.attendance-table tbody tr:hover td { background: var(--color-primary-soft); }
.attendance-member-name { display: block; color: var(--color-text); font-weight: var(--weight-bold); text-align: start; }
.attendance-member-phone { display: block; color: var(--color-text-muted); direction: ltr; font-family: var(--font-latin); font-size: var(--font-xs); text-align: start; }
.attendance-time { direction: ltr; font-family: var(--font-latin); font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); }
.attendance-source,
.attendance-status { display: inline-flex; min-height: 28px; align-items: center; justify-content: center; border: 1px solid var(--border-color); border-radius: var(--radius-pill); padding: 0 var(--space-3); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.attendance-source.phone { border-color: var(--primary-border); background: var(--color-primary-soft); color: var(--color-primary); }
.attendance-source.qr { border-color: var(--primary-border); background: var(--color-primary-soft); color: var(--text-primary-soft); }
.attendance-status { border-color: var(--warning-border); background: var(--color-warning-soft); color: var(--warning-text); }
.attendance-status.complete { border-color: var(--success-border); background: var(--color-success-soft); color: var(--success-text); }
.attendance-row-actions {
  min-width: 132px;
  white-space: nowrap;
}
.attendance-row-actions .btn,
.attendance-action-done {
  min-width: 118px;
  white-space: nowrap;
}
.attendance-action-done {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-pill);
  background: var(--color-success-soft);
  color: var(--success-text);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}
.attendance-action-done.auto {
  border-color: var(--primary-border);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.attendance-member-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border-bottom: 1px solid var(--border-color); padding: var(--space-3); }
.attendance-member-copy { display: grid; gap: 1px; }
.attendance-member-copy strong { color: var(--color-text); font-size: var(--font-sm); }
.attendance-member-copy small { color: var(--color-text-muted); font-size: var(--font-xs); }

.attendance-table-wrap:has(.attendance-empty) {
  display: grid;
  min-height: 180px;
  place-items: center;
}

.attendance-empty {
  display: grid;
  width: 100%;
  min-height: 180px;
  box-sizing: border-box;
  place-items: center;
  color: var(--color-text-muted);
  padding: var(--space-8) var(--space-5);
  text-align: center;
}

/* QR dialogs ------------------------------------------------------------- */
.qr-reader-dialog,
.member-qr-dialog {
  width: min(560px, calc(100% - 32px));
}

.member-qr-dialog {
  width: min(520px, calc(100% - 32px));
}

.member-qr-dialog .dialog-body,
.qr-reader-dialog .dialog-body {
  align-items: stretch;
}

.member-qr-card {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--color-primary-soft), var(--color-surface));
  padding: var(--space-5);
  text-align: center;
}

.member-qr-card canvas {
  display: block;
  width: min(250px, 100%);
  height: auto;
  aspect-ratio: 1;
  border: 8px solid var(--qr-paper);
  border-radius: var(--radius-md);
  background: var(--qr-paper);
  box-shadow: var(--shadow-sm);
  image-rendering: pixelated;
}

.member-qr-card strong {
  max-width: 100%;
  color: var(--color-text);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
  overflow-wrap: anywhere;
}

.member-qr-card span {
  direction: ltr;
  color: var(--color-text-muted);
  font-family: var(--font-latin);
  font-size: var(--font-sm);
  font-variant-numeric: tabular-nums;
}

.member-qr-dialog .dialog-actions {
  justify-content: center;
}

.member-qr-dialog .dialog-actions .btn {
  min-width: 190px;
}

#qrReader {
  display: grid;
  width: min(390px, 100%);
  min-height: 300px;
  align-self: center;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-bg-subtle);
}

#qrReader video,
#qrReader canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: auto !important;
  border-radius: calc(var(--radius-lg) - 2px);
}

.qr-reader-note {
  max-width: 48ch;
  align-self: center;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
  text-align: center;
}

/* The QR scan confirmation is a data card, not a loose text block. Keep the
   identity, operation and membership facts in a predictable reading order so
   the same dialog remains clear in both themes and on small screens. */
body .swal2-popup.qr-member-preview-alert {
  width: min(560px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 24px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-5) 0 0;
}

.qr-member-preview-alert .swal2-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto var(--space-2);
  font-size: 1.65rem;
}

.qr-member-preview-alert .swal2-title {
  margin: 0;
  padding-inline: var(--space-5);
  font-size: var(--font-lg);
}

.qr-member-preview-alert .swal2-html-container {
  width: auto;
  margin: var(--space-4) 0 0;
  padding: 0 var(--space-5);
  overflow: visible;
  text-align: start;
}

.qr-member-preview {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  direction: rtl;
  text-align: start;
}

.qr-member-preview-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
}

.qr-member-preview-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: 14px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: var(--font-md);
  font-weight: var(--weight-extrabold);
  direction: ltr;
}

.qr-member-preview-identity-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.qr-member-preview-identity-copy strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-member-preview-identity-copy span {
  color: var(--color-text-muted);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-variant-numeric: tabular-nums;
}

.qr-member-preview-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.qr-member-preview-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
}

.qr-member-preview-status.active,
.qr-member-preview-status.expiring_soon {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--success-text);
}

.qr-member-preview-status.expired {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--danger-text);
}

.qr-member-preview-status.frozen {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--warning-text);
}

.qr-member-preview-context {
  display: grid;
  gap: 1px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--primary-border);
  border-inline-start: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
}

.qr-member-preview-kicker {
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.qr-member-preview-context strong {
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}

.qr-member-preview-context small {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.qr-member-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.qr-member-preview-field {
  display: grid;
  min-width: 0;
  min-height: 58px;
  align-content: center;
  gap: 2px;
  padding: var(--space-3);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.qr-member-preview-field span {
  color: var(--color-text-muted);
  font-size: 10px;
}

.qr-member-preview-field strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-member-preview-field.qr-member-preview-balance {
  grid-column: 1 / -1;
  border-color: var(--success-border);
  background: var(--color-success-soft);
}

.qr-member-preview-balance strong {
  color: var(--success-text);
  direction: ltr;
  text-align: start;
}

.qr-member-preview-alert .swal2-actions {
  width: auto;
  margin: var(--space-5) 0 0;
  padding: 0 var(--space-5) var(--space-5);
}

body .swal2-popup.qr-member-preview-alert .swal2-actions > button.qr-member-preview-confirm,
body .swal2-popup.qr-member-preview-alert .swal2-actions > button.qr-member-preview-cancel {
  min-width: 138px;
  min-height: 42px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

body .swal2-popup.qr-member-preview-alert .swal2-actions > button.qr-member-preview-confirm {
  border: 1px solid var(--primary) !important;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover)) !important;
  color: var(--text-on-primary) !important;
  box-shadow: var(--shadow-primary);
}

body .swal2-popup.qr-member-preview-alert .swal2-actions > button.qr-member-preview-confirm:hover:not(:disabled) {
  border-color: var(--color-primary-hover) !important;
  background: var(--color-primary-hover) !important;
  box-shadow: var(--shadow-primary-strong);
  transform: translateY(-1px);
}

body .swal2-popup.qr-member-preview-alert .swal2-actions > button.qr-member-preview-cancel {
  border: 1px solid var(--border-primary) !important;
  background: var(--color-surface-muted) !important;
  color: var(--color-text-soft) !important;
}

body .swal2-popup.qr-member-preview-alert .swal2-actions > button.qr-member-preview-cancel:hover:not(:disabled) {
  border-color: var(--primary-border) !important;
  background: var(--color-primary-soft) !important;
  color: var(--color-primary) !important;
  transform: translateY(-1px);
}

@media (max-width: 991px) {
  .attendance-control-panel { grid-template-columns: 1fr; }
  .attendance-list-actions { flex-basis: 100%; }
}

@media (max-width: 767px) {
  .attendance-header,
  .attendance-mode-actions,
  .attendance-entry-head,
  .attendance-input-row,
  .attendance-list-head { align-items: stretch; flex-direction: column; }
  .attendance-action-buttons > * { flex: 1 1 auto; }
  .attendance-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attendance-list-actions { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
  .attendance-list-actions > * { min-width: 0; flex: none; }
  .attendance-list-actions .attendance-search-wrap { grid-column: 1 / -1; }
  .attendance-list-actions .attendance-status-filter { min-width: 0; }
  .attendance-list-actions > .btn { min-width: 104px; }
  .attendance-list-head { padding: var(--space-4); }
  .attendance-search-wrap { min-width: 0; }

  .qr-reader-dialog,
  .member-qr-dialog { width: calc(100% - 24px); }

  #qrReader { min-height: min(300px, 68vw); }
  .member-qr-card { padding: var(--space-4); }
  .member-qr-dialog .dialog-actions .btn { width: 100%; }
  body .swal2-popup.qr-member-preview-alert {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 16px);
    padding-top: var(--space-4);
  }
  .qr-member-preview-alert .swal2-title,
  .qr-member-preview-alert .swal2-html-container,
  .qr-member-preview-alert .swal2-actions { padding-inline: var(--space-4); }
  .qr-member-preview-grid { grid-template-columns: 1fr; }
  .qr-member-preview-field.qr-member-preview-balance { grid-column: auto; }
  .qr-member-preview-alert .swal2-actions > button { flex: 1 1 140px; }
}

/* Day passes ------------------------------------------------------------ */
.day-pass-panel {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--bg-card-hover), var(--color-surface));
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.day-pass-head,
.day-pass-heading,
.day-pass-list-head,
.day-pass-form-actions,
.day-pass-actions { display: flex; align-items: center; gap: var(--space-3); }
.day-pass-head,
.day-pass-list-head { justify-content: space-between; }
.day-pass-heading { justify-content: flex-start; min-width: 0; }
.day-pass-heading > div { display: grid; min-width: 0; gap: 2px; }
.day-pass-heading > div > span { color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.day-pass-heading h3 { color: var(--color-text); font-size: var(--font-xl); font-weight: var(--weight-extrabold); }
.day-pass-heading p,
.day-pass-list-head p { color: var(--color-text-muted); font-size: var(--font-xs); }
.day-pass-icon { display: grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; border-radius: 14px; background: var(--color-primary-soft); color: var(--color-primary); }
.day-pass-icon .ui-icon { width: 25px; height: 25px; }
.day-pass-today-badge { display: inline-flex; min-height: 34px; align-items: center; border-radius: var(--radius-pill); background: var(--color-info-soft); color: var(--color-primary); padding: 0 var(--space-3); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.day-pass-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: var(--space-3); border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface); padding: var(--space-4); }
.day-pass-price-box { display: grid; min-height: 48px; align-content: center; gap: 2px; border-radius: var(--radius-md); background: var(--color-success-soft); color: var(--color-success); padding: 0 var(--space-3); }
.day-pass-price-box span { font-size: var(--font-xs); }
.day-pass-price-box strong { direction: ltr; font-family: var(--font-latin); font-size: var(--font-lg); }
.day-pass-whatsapp-option { align-self: center; grid-column: span 1; }
.day-pass-form-actions { justify-content: flex-end; grid-column: span 2; flex-wrap: nowrap; }
.day-pass-form-actions .btn { min-height: 46px; }
.day-pass-list-head { padding-top: var(--space-2); }
.day-pass-list-head h4 { color: var(--color-text); font-size: var(--font-lg); font-weight: var(--weight-bold); }
.day-pass-search { min-width: min(320px, 100%); }
.day-pass-search input { min-height: 42px; }
.day-pass-table-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface); }
.day-pass-table { width: 100%; min-width: 960px; table-layout: fixed; }
.day-pass-table th:nth-child(1) { width: 25%; }
.day-pass-table th:nth-child(2) { width: 18%; }
.day-pass-table th:nth-child(3) { width: 12%; }
.day-pass-table th:nth-child(4) { width: 14%; }
.day-pass-table th:nth-child(5) { width: 12%; }
.day-pass-table th:nth-child(6) { width: 19%; }
.day-pass-table th,
.day-pass-table td { padding: var(--space-3) var(--space-4); text-align: center; vertical-align: middle; }
.day-pass-table th { background: var(--color-surface-muted); color: var(--color-text-soft); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.day-pass-table tbody tr + tr td { border-top: 1px solid var(--border-color); }
.day-pass-table tbody tr:hover td { background: var(--color-primary-soft); }
.day-pass-table td:first-child { text-align: start; }
.day-pass-table td strong,
.day-pass-table td small { display: block; }
.day-pass-table td strong { color: var(--color-text); font-size: var(--font-sm); }
.day-pass-table td small { color: var(--color-text-muted); direction: ltr; font-family: var(--font-latin); font-size: var(--font-xs); }
.day-pass-table td small.day-pass-reference { color: var(--color-primary); font-size: 10px; font-weight: var(--weight-bold); }
.day-pass-type-badge { display: inline-flex; min-height: 28px; align-items: center; border-radius: var(--radius-pill); background: var(--color-primary-soft); color: var(--color-primary); padding: 0 var(--space-3); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.day-pass-type-badge.day_gym_cardio { background: var(--color-warning-soft); color: var(--color-warning); }
.day-pass-amount { direction: ltr; color: var(--color-success); font-family: var(--font-latin); font-weight: var(--weight-bold); }
.day-pass-actions { min-width: max-content; justify-content: center; flex-wrap: nowrap; }
.day-pass-actions .btn { min-height: 36px; }
.day-pass-action-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.day-pass-action-button .ui-icon { width: 16px; height: 16px; }
.day-pass-action-button.is-compact { width: 40px; min-width: 40px; min-height: 40px; padding-inline: 0; }
.day-pass-action-button.is-compact .ui-icon { width: 19px; height: 19px; }
.day-pass-no-phone { display: inline-flex; align-items: center; min-height: 30px; border-radius: var(--radius-pill); background: var(--color-surface-muted); color: var(--color-text-muted); padding-inline: var(--space-2); font-size: 10px; white-space: nowrap; }
.day-pass-delete-button { color: var(--color-danger); }
.day-pass-void-button { color: var(--color-danger); }
.day-pass-empty { color: var(--color-text-muted); padding: var(--space-8); text-align: center; }
.field-optional { color: var(--color-text-muted); font-size: 11px; font-weight: var(--weight-regular); }

/* Attendance workspace refinement ---------------------------------------
   Keep the page operationally dense without flattening the hierarchy. The
   controls remain the same DOM/IDs so attendance handlers and permissions are
   unchanged; this layer only improves grouping, contrast and touch clarity. */
.attendance-section {
  overflow: hidden;
}

.attendance-header {
  align-items: flex-start;
  gap: var(--space-6);
}

.attendance-heading {
  min-width: 0;
  align-items: flex-start;
}

.attendance-heading > div {
  min-width: 0;
}

.attendance-kicker {
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .02em;
}

.attendance-heading h3 {
  color: var(--text-primary);
  font-size: clamp(var(--font-xl), 2.3vw, var(--font-2xl));
  line-height: 1.35;
}

.attendance-heading p,
.attendance-entry-head p,
.attendance-list-head p,
.attendance-report-hint,
.attendance-entry-hint {
  color: var(--text-secondary);
  line-height: 1.65;
}

.attendance-header-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-content: end;
  gap: var(--space-3);
  min-width: min(100%, 440px);
  margin-inline-start: auto;
}

.attendance-date-badge {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  padding-inline: var(--space-4);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.attendance-date-badge .ui-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.attendance-mode-actions {
  min-width: 0;
  justify-content: flex-end;
  gap: var(--space-3);
}

.attendance-mode-actions .btn {
  min-height: 40px;
  flex: 0 0 auto;
  border-color: var(--border-primary);
  font-weight: var(--weight-bold);
}

.attendance-report-hint {
  max-width: 25ch;
  font-size: var(--font-xs);
  text-align: end;
}

.attendance-control-panel {
  gap: var(--space-5);
}

.attendance-entry-card {
  gap: var(--space-5);
  padding: clamp(var(--space-4), 2.2vw, var(--space-6));
  box-shadow: var(--shadow-sm);
}

.attendance-entry-head {
  align-items: flex-start;
}

.attendance-entry-head > div:first-child {
  min-width: 0;
}

.attendance-entry-head h4,
.attendance-list-head h4 {
  line-height: 1.45;
}

.attendance-entry-mode {
  flex: 0 0 auto;
}

.attendance-segmented-control {
  gap: 3px;
  border-color: var(--border-primary);
  background: var(--color-surface-muted);
  padding: 3px;
}

.attendance-segmented-control > button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding-inline: var(--space-4);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.attendance-segmented-control > button:not(.active):not([aria-selected="true"]) {
  border-color: var(--border-secondary);
  background: var(--color-surface);
  color: var(--text-secondary);
}

.attendance-segmented-control > button:not(.active):not([aria-selected="true"]):hover {
  border-color: var(--border-hover);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.attendance-segmented-control > button.active,
.attendance-segmented-control > button[aria-selected="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}

.attendance-segmented-control .ui-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.attendance-input-row {
  align-items: stretch;
}

.attendance-section .attendance-input-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 48px;
  padding-block: 0;
  padding-inline: 44px 14px;
  line-height: 1.4;
}

.attendance-input-wrap input::placeholder,
.attendance-search::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.attendance-action-buttons {
  gap: var(--space-3);
}

.attendance-action-buttons > .btn {
  min-width: 154px;
  min-height: 48px;
  border: 1px solid transparent;
  font-weight: var(--weight-bold);
  box-shadow: var(--shadow-sm);
}

.attendance-action-buttons > .btn-check-in {
  border-color: var(--success);
  background: var(--success);
}

.attendance-action-buttons > .btn-check-out {
  border-color: var(--warning);
  background: var(--warning);
}

.attendance-action-buttons > .btn-check-in:hover:not(:disabled),
.attendance-action-buttons > .btn-check-out:hover:not(:disabled) {
  filter: brightness(.94);
  transform: translateY(-1px);
}

.attendance-summary {
  gap: var(--space-3);
}

.attendance-summary-card {
  position: relative;
  min-height: 148px;
  gap: var(--space-2);
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.attendance-summary-card::after {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  content: "";
  opacity: .7;
}

.attendance-summary-card.checked-in::after { background: var(--success); }
.attendance-summary-card.checked-out::after { background: var(--warning); }

.summary-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.summary-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.attendance-summary-card strong {
  display: block;
  min-height: 2.65rem;
  color: var(--text-primary);
  font-size: clamp(1.85rem, 3vw, 2.35rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.attendance-summary-card > span:last-child {
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.attendance-list-head {
  align-items: flex-start;
  gap: var(--space-5);
}

.attendance-list-head > div:first-child {
  min-width: 0;
}

.attendance-list-actions {
  align-items: center;
  gap: var(--space-2);
}

.attendance-search-wrap {
  position: relative;
  min-width: 240px;
}

.attendance-search-wrap svg {
  right: auto;
  left: auto;
  inset-inline-start: var(--space-3);
  color: var(--text-muted);
}

.attendance-section .attendance-search-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 46px;
  padding-block: 0;
  padding-inline: var(--space-9) var(--space-3);
  line-height: 1.4;
}

.attendance-status-filter,
.attendance-list-actions > .btn {
  min-height: 46px;
}

@media (max-width: 767px) {
  .attendance-header {
    gap: var(--space-4);
  }

  .attendance-header-actions {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    margin-inline-start: 0;
  }

  .attendance-date-badge {
    justify-self: start;
  }

  body .attendance-header-actions > .attendance-mode-actions {
    width: 100%;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .attendance-report-hint {
    max-width: 28ch;
  }

  .attendance-entry-head {
    gap: var(--space-3);
  }

  .attendance-entry-mode,
  .attendance-segmented-control {
    width: 100%;
  }

  .attendance-segmented-control > button {
    flex: 1 1 0;
  }

  .attendance-action-buttons > .btn {
    min-width: 0;
  }

  .attendance-summary-card {
    min-height: 132px;
    padding: var(--space-3) var(--space-2);
  }

  .summary-icon {
    width: 36px;
    height: 36px;
  }

  .summary-icon .ui-icon {
    width: 18px;
    height: 18px;
  }

  .attendance-summary-card strong {
    font-size: 1.7rem;
  }

  .attendance-search-wrap {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .attendance-action-buttons > .btn-check-in:hover:not(:disabled),
  .attendance-action-buttons > .btn-check-out:hover:not(:disabled) {
    transform: none;
  }
}

@media (max-width: 991px) {
  .day-pass-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-pass-whatsapp-option { grid-column: span 1; }
  .day-pass-form-actions { grid-column: span 2; }
}
@media (max-width: 600px) {
  .day-pass-panel { padding: var(--space-4); }
  .day-pass-head,
  .day-pass-list-head { align-items: stretch; flex-direction: column; }
  .day-pass-today-badge { align-self: flex-start; }
  .day-pass-form { grid-template-columns: 1fr; }
  .day-pass-whatsapp-option,
  .day-pass-form-actions { grid-column: auto; }
  .day-pass-form-actions { align-items: stretch; flex-direction: column; }
  .day-pass-form-actions .btn { width: 100%; }
  .day-pass-search { width: 100%; min-width: 0; }
}

/* Final attendance alignment pass --------------------------------------
   Keep heading/actions in one predictable RTL header and force icons to the
   inline-start (the right side in Arabic) even when dashboard search rules
   are loaded before this page stylesheet. */
.attendance-section {
  overflow: visible;
}

.attendance-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-6);
}

.attendance-header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-inline-start: 0;
}

.attendance-mode-actions {
  display: flex !important;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.attendance-report-hint {
  max-width: 24ch;
  text-align: start;
}

.attendance-input-wrap svg,
.attendance-search-wrap svg {
  right: auto !important;
  left: auto !important;
  inset-inline-start: 14px;
  inset-inline-end: auto;
}

.attendance-section .attendance-input-wrap > input:not([type="checkbox"]):not([type="radio"]),
.attendance-section .attendance-search-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  padding-inline-start: 44px;
  padding-inline-end: 14px;
}

.attendance-summary-card strong {
  display: block !important;
  visibility: visible !important;
  min-width: 2ch;
  min-height: 2.65rem;
  color: var(--text-primary) !important;
  font-family: var(--font-latin);
  font-size: clamp(2rem, 3.2vw, 2.65rem) !important;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-extrabold);
  line-height: 1.1;
  text-align: center;
}

.attendance-segmented-control > #attendanceScanButton {
  border-color: var(--border-secondary);
  background: var(--color-surface);
  color: var(--text-secondary);
}

.attendance-segmented-control > #attendanceScanButton:hover:not(:disabled),
.attendance-segmented-control > #attendanceScanButton:focus-visible {
  border-color: var(--primary-border);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.attendance-action-buttons > .btn-check-in,
.attendance-action-buttons > .btn-check-out {
  min-height: 50px;
  font-weight: var(--weight-bold);
}

.attendance-action-buttons > .btn-check-in {
  border-color: var(--success);
  background: var(--success);
  color: var(--text-on-primary);
}

.attendance-action-buttons > .btn-check-out {
  border-color: var(--warning);
  background: var(--warning);
  color: var(--text-on-primary);
}

@media (max-width: 767px) {
  .attendance-header {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: var(--space-4);
  }

  .attendance-header-actions {
    width: 100%;
    align-items: stretch;
    justify-content: stretch;
  }

  .attendance-mode-actions {
    width: 100%;
    justify-content: space-between;
  }

  .attendance-report-hint {
    max-width: 30ch;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/expenses.css */
.workspace {
  gap: var(--space-5);
}

.expenses-section,
.finance-section,
.monthly-finance-card {
  min-width: 0;
}

.expenses-header,
.expense-toolbar,
.expense-summary,
.expense-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.expense-summary {
  flex-wrap: wrap;
}

.expense-summary-card {
  display: grid;
  min-width: 160px;
  flex: 1;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-4);
}

.expense-summary-card span { color: var(--color-text-muted); font-size: var(--font-xs); }
.expense-summary-card strong { color: var(--color-text); font-family: var(--font-latin); font-size: 1.4rem; direction: ltr; }
.expense-list { display: grid; gap: var(--space-3); }
.expense-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border-bottom: 1px solid var(--border-color); padding: var(--space-3) 0; }
.expense-row-copy { display: grid; gap: 1px; }
.expense-row-copy strong { color: var(--color-text); font-size: var(--font-sm); }
.expense-row-copy small { color: var(--color-text-muted); font-size: var(--font-xs); }
.expense-amount { color: var(--color-danger); font-family: var(--font-latin); font-weight: var(--weight-bold); direction: ltr; }

/* Expenses workspace ---------------------------------------------------- */
.expenses-tab-panel {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
}

.expenses-tab-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--danger-soft), var(--color-surface));
  padding: var(--space-5);
}

.expenses-tab-heading-copy {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.expenses-tab-heading-copy > span {
  color: var(--color-danger);
  font-size: 10px;
  font-weight: var(--weight-bold);
}

.expenses-tab-heading-copy h3 {
  color: var(--color-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-extrabold);
}

.expenses-tab-heading-copy p {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.expenses-tab-add-button {
  flex: 0 0 auto;
}

.expenses-tab-panel #expensesTabHost {
  display: grid;
  min-width: 0;
}

.expenses-tab-panel .monthly-finance-card {
  gap: var(--space-5);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.expenses-tab-panel .monthly-finance-head {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-color);
}

.expenses-tab-panel .monthly-finance-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.expenses-tab-panel .monthly-finance-metric {
  min-height: 112px;
  align-content: start;
  padding: var(--space-4);
}

.expenses-tab-panel .monthly-finance-metric.expenses {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.expenses-tab-panel .monthly-finance-metric.expenses .monthly-finance-value,
.expenses-tab-panel .monthly-expense-amount {
  color: var(--color-danger);
}
.monthly-finance-metric.day-passes {
  border-color: var(--info-border);
  background: var(--color-info-soft);
}
.monthly-finance-metric.day-passes .monthly-finance-value {
  color: var(--color-primary);
}

.expenses-tab-panel .monthly-finance-metric.net .monthly-finance-value.negative {
  color: var(--color-danger);
}

.expenses-tab-panel .monthly-expenses-list {
  display: grid;
  max-height: 430px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: 0 var(--space-4);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.expenses-tab-panel .monthly-expenses-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border-strong);
  padding: var(--space-3) 0;
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.expenses-tab-panel .monthly-expenses-list-head span {
  color: var(--color-text-soft);
  white-space: nowrap;
}

.expenses-tab-panel .monthly-expenses-list-head span:nth-child(2),
.expenses-tab-panel .monthly-expenses-list-head span:nth-child(3) {
  text-align: center;
}

.expenses-tab-panel .monthly-expense-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-3) 0;
}

.expenses-tab-panel .monthly-expense-item:last-child {
  border-bottom: 0;
}

.expenses-tab-panel .monthly-expense-item:hover {
  background: var(--danger-soft);
}

.expenses-tab-panel .monthly-expense-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.expenses-tab-panel .monthly-expense-copy strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expenses-tab-panel .monthly-expense-copy span {
  color: var(--color-text-muted);
  direction: ltr;
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  text-align: start;
}

.expenses-tab-panel .monthly-expense-amount {
  direction: ltr;
  font-family: var(--font-latin);
  font-size: var(--font-md);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-extrabold);
  white-space: nowrap;
}

.expenses-tab-panel .monthly-expense-actions {
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-2);
}

.expenses-tab-panel .monthly-expense-action {
  display: inline-grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: 0;
}

.expenses-tab-panel .monthly-expense-action svg {
  width: 17px;
  height: 17px;
}

.expenses-tab-panel .monthly-expense-action.edit:hover {
  border-color: var(--primary-border);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.expenses-tab-panel .monthly-expense-action.delete:hover {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.expenses-tab-panel .monthly-expenses-empty {
  display: block;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-muted);
  text-align: center;
}

#expenseDialog {
  width: min(720px, calc(100% - 32px));
  border-color: var(--danger-border);
}

#expenseDialog .details-dialog-head {
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--danger-soft), var(--color-surface));
  padding: var(--space-4) var(--space-5);
}

#expenseDialog .expense-form-grid {
  margin-top: 0;
}

@media (max-width: 767px) {
  .expenses-header,
  .expense-toolbar,
  .expenses-tab-heading { align-items: stretch; flex-direction: column; }

  .expenses-tab-add-button { width: 100%; }
  .expenses-tab-panel .monthly-finance-card { padding: var(--space-4); }
  .expenses-tab-panel .monthly-finance-metrics { grid-template-columns: 1fr; }
  .expenses-tab-panel .monthly-expenses-list-head { grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-2); }
  .expenses-tab-panel .monthly-expense-item { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); }
  .expenses-tab-panel .monthly-expense-actions { grid-column: 1 / -1; justify-content: flex-start; }
  #expenseDialog { width: calc(100% - 20px); }
}

@media (max-width: 991px) and (min-width: 768px) {
  .expenses-tab-panel .monthly-finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/coaching.css */
.coaching-profile-content,
.coaching-builder-content,
.program-details,
.workout-program,
.diet-plan {
  display: grid;
  gap: var(--space-5);
}

.coaching-builder-ai-tools {
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
  gap: var(--space-3);
  align-items: center;
  margin: var(--space-4) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-soft), var(--bg-card));
}

.coaching-builder-ai-tools > div:first-child span,
.coaching-builder-ai-tools > div:first-child small {
  display: block;
}

.coaching-builder-ai-tools > div:first-child span {
  color: var(--primary-active);
  font-size: .82rem;
  font-weight: 800;
}

.coaching-builder-ai-tools > div:first-child small {
  margin-top: .25rem;
  color: var(--color-text-muted);
  font-size: .72rem;
  line-height: 1.6;
}

.coaching-builder-ai-controls {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.coaching-builder-ai-controls textarea {
  min-height: 2.6rem;
  flex: 1 1 auto;
  resize: vertical;
}

@media (max-width: 720px) {
  .coaching-builder-ai-tools { grid-template-columns: 1fr; }
  .coaching-builder-ai-controls { flex-direction: column; }
}

/* External trainees ---------------------------------------------------- */
.external-trainees-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.external-trainees-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.external-trainees-table th,
.external-trainees-table td {
  min-width: 0;
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-3) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

.external-trainees-table th {
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.external-trainees-table tbody tr {
  min-height: 78px;
  transition: background-color var(--transition-fast);
}

.external-trainees-table tbody tr:hover { background: var(--color-primary-soft); }
.external-trainees-table tbody tr:last-child td { border-bottom: 0; }
.external-trainees-table th:nth-child(1) { width: 23%; }
.external-trainees-table th:nth-child(2) { width: 9%; }
.external-trainees-table th:nth-child(3) { width: 28%; }
.external-trainees-table th:nth-child(4) { width: 14%; }
.external-trainees-table th:nth-child(5) { width: 12%; }
.external-trainees-table th:nth-child(6) { width: 14%; }

.external-trainee-primary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
  text-align: start;
}

.external-trainee-primary > div:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.external-trainee-primary strong,
.external-trainee-primary a,
.external-trainee-primary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-trainee-primary strong {
  color: var(--color-text);
  font-size: var(--font-sm);
}

.external-trainee-primary a {
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
}

.external-trainee-primary small {
  color: var(--color-text-muted);
  font-family: var(--font-latin);
  font-size: 11px;
}

.trainee-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: var(--weight-bold);
}

.trainee-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.external-trainee-systems,
.external-trainee-counts,
.external-trainee-system-list {
  display: grid;
  gap: var(--space-2);
}

.external-trainee-counts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.external-trainee-count {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: var(--space-2);
  font-size: 11px;
  white-space: nowrap;
}

.external-trainee-count b {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-sm);
}

.external-trainee-count.workout .external-trainee-count-icon { color: var(--color-primary); }
.external-trainee-count.diet .external-trainee-count-icon { color: var(--color-success); }
.external-trainee-count-icon .coaching-inline-icon { width: 16px; height: 16px; }
.external-trainee-no-diet {
  display: block;
  overflow: hidden;
  color: var(--color-text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-trainee-no-diet { color: var(--color-text-subtle); }

.external-trainee-system-item {
  display: grid;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-2);
}

.external-trainee-system-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.external-trainee-system-copy .system-type {
  min-height: 22px;
  padding-inline: var(--space-2);
  font-size: 10px;
}

.external-trainee-system-copy strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-trainee-system-copy small {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-trainee-system-actions,
.member-training-system-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.external-trainee-system-actions .btn,
.member-training-system-actions .btn {
  min-height: 34px;
  padding-inline: var(--space-2);
  font-size: 10px;
}

.external-trainee-compact-metric {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--color-text-soft);
}

.external-trainee-compact-metric .coaching-inline-icon {
  color: var(--color-primary);
}

.external-trainee-last-activity {
  color: var(--color-text-soft);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  white-space: nowrap;
}

.external-trainee-actions-cell { min-width: 0; }

.trainee-actions {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: nowrap;
  white-space: nowrap;
}

.coaching-icon-action {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
}

.coaching-icon-action .coaching-inline-icon { width: 18px; height: 18px; }
.coaching-action-workout { border-color: var(--primary-border); background: var(--color-primary-soft); color: var(--color-primary); }
.coaching-action-profile { border-color: var(--border-color); background: var(--color-surface-muted); color: var(--color-text-soft); }
.coaching-action-diet { border-color: var(--success-border); background: var(--color-success-soft); color: var(--color-success); }
.coaching-action-more { border-color: var(--border-color); background: var(--color-surface); color: var(--color-text-muted); }
.coaching-action-workout:hover:not(:disabled) { background: var(--color-primary); color: var(--text-on-primary); }
.coaching-action-profile:hover:not(:disabled) { border-color: var(--border-focus); background: var(--color-primary-soft); color: var(--color-primary); }
.coaching-action-diet:hover:not(:disabled) { background: var(--color-success); color: var(--text-on-primary); }
.coaching-action-more:hover:not(:disabled) { border-color: var(--border-focus); background: var(--color-primary-soft); color: var(--color-primary); }

.trainee-more {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.trainee-more-menu {
  top: calc(100% + var(--space-2));
  inset-inline-end: 0;
  min-width: 210px;
  text-align: start;
}

.trainee-more-menu .trainee-diet-delete {
  justify-content: flex-start;
  text-align: start;
}

/*
 * On wide screens the action column participates in the table layout. The
 * shared table stylesheet keeps action columns sticky for narrow scrollable
 * tables, but that behavior makes this already-visible column look like a
 * second layer over the rows on desktop.
 */
@media (min-width: 768px) {
  .external-trainees-table th:last-child,
  .external-trainees-table td:last-child {
    position: static;
    inset-inline-end: auto;
    z-index: auto;
    width: 248px;
    min-width: 248px;
    background: transparent;
    box-shadow: none;
  }

  .external-trainees-table thead th:last-child {
    background: var(--color-surface-muted);
  }

  .external-trainees-table tbody tr:nth-child(even) td:last-child,
  .external-trainees-table tbody tr:hover td:last-child {
    background: transparent;
  }

  .external-trainees-table .trainee-actions {
    gap: var(--space-1);
  }
}

@media (min-width: 1200px) {
  .external-trainees-table-wrap {
    overflow-x: visible;
    overflow-y: visible;
  }

  .external-trainees-table .trainee-more-menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    inset-inline-end: 0;
    z-index: var(--z-dropdown);
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .external-trainees-table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
  }
}

/* External trainee dashboard -------------------------------------------- */
.coaching-summary-card {
  position: relative;
  min-height: 112px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.coaching-summary-card::after {
  position: absolute;
  inset-inline-end: -24px;
  bottom: -30px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: currentColor;
  content: '';
  opacity: 0.06;
}

.coaching-summary-icon {
  position: relative;
  display: inline-grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-primary);
  isolation: isolate;
}

.coaching-summary-icon::before {
  position: absolute;
  inset: 0;
  width: 48px;
  height: 48px;
  border-radius: inherit;
  background: var(--color-primary-soft);
  content: '';
  z-index: 0;
}

.coaching-summary-icon .coaching-inline-icon {
  position: relative;
  width: 23px;
  height: 23px;
  z-index: 1;
}

.coaching-summary-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.coaching-summary-copy > span {
  overflow: hidden;
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coaching-summary-copy strong {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.coaching-summary-copy small {
  color: var(--color-text-muted);
  font-size: 11px;
}

.coaching-summary-card.users { color: var(--color-primary); }
.coaching-summary-card.workout { color: var(--primary); }
.coaching-summary-card.diet { color: var(--color-success); }
.coaching-summary-card.progress { color: var(--warning); }

.coaching-summary-card.workout .coaching-summary-icon::before { background: var(--primary-soft); }
.coaching-summary-card.diet .coaching-summary-icon::before { background: var(--color-success-soft); }
.coaching-summary-card.progress .coaching-summary-icon::before { background: var(--color-warning-soft); }

/* The action column stays readable even when a table has long names. */
.external-trainees-table-wrap {
  overflow-y: visible;
}

.external-trainee-actions-cell,
.trainee-actions {
  overflow: visible;
}

.coaching-icon-action {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  border-radius: var(--radius-md);
  line-height: 0;
}

.coaching-icon-action .coaching-inline-icon {
  width: 23px;
  height: 23px;
  max-width: none;
}

.trainee-more-menu.is-floating {
  position: fixed;
  z-index: var(--z-dropdown);
  max-height: min(360px, calc(100vh - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Member details training/nutrition extension --------------------------- */
.member-training-panel {
  display: grid;
  gap: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-4);
}

.member-training-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
  padding: var(--space-4);
}

.member-training-head > div:first-child {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.member-training-head > div:first-child > span {
  color: var(--color-primary);
  font-size: 11px;
  font-weight: var(--weight-bold);
}

.member-training-head h4 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
}

.member-training-head small {
  max-width: 62ch;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.member-training-head > div:last-child {
  display: flex;
  max-width: 52%;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.member-training-head > div:last-child .btn {
  min-height: 38px;
}

.member-training-systems {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.member-training-systems > div:not(.profile-empty) {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-4);
}

.member-training-systems > div > strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-training-systems > div > small {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.member-training-systems > div > .btn {
  justify-self: start;
  margin-top: var(--space-1);
}

.member-training-systems > div > .member-training-system-actions {
  display: flex;
  justify-self: stretch;
  margin-top: var(--space-1);
}

.system-type,
.system-status {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-2);
  font-size: 11px;
  font-weight: var(--weight-bold);
}

.system-type.workout { border-color: var(--primary-border); background: var(--color-primary-soft); color: var(--color-primary); }
.system-type.diet { border-color: var(--success-border); background: var(--color-success-soft); color: var(--color-success); }

.member-progress-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.member-progress-line > span {
  display: grid;
  gap: 2px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: var(--space-3);
  font-size: 11px;
  text-align: center;
}

.member-progress-line b {
  color: var(--color-primary);
  font-family: var(--font-latin);
  font-size: var(--font-md);
  font-variant-numeric: tabular-nums;
}

/* Coaching profile dialog ----------------------------------------------- */
.coaching-profile-dialog {
  width: min(1060px, calc(100% - 32px));
}

.coaching-profile-content {
  min-width: 0;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
  padding: var(--space-4);
}

.trainee-avatar.large {
  width: 58px;
  height: 58px;
  border-color: var(--border-hover);
  background: var(--color-primary);
  color: var(--text-on-primary);
  font-size: var(--font-lg);
}

.profile-hero > div:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.profile-hero > div:nth-child(2) strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--font-lg);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-hero > div:nth-child(2) span,
.profile-hero > div:nth-child(2) small {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.profile-hero > div:nth-child(2) span { direction: ltr; text-align: start; }

.profile-stats,
.profile-progress-dashboard,
.profile-execution-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.profile-stats > article,
.profile-progress-card {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-4);
  text-align: center;
}

.profile-stats > article span,
.profile-progress-card .profile-section-head span {
  color: var(--color-text-muted);
  font-size: 11px;
}

.profile-stats > article strong {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-variant-numeric: tabular-nums;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-3);
}

.profile-actions .btn { min-height: 42px; }

.profile-section {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.profile-section-head h4 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.profile-section-head > span,
.profile-section-description {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.profile-system-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-3) var(--space-4);
}

.profile-system-card > div:first-child {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.profile-system-card strong {
  overflow: hidden;
  color: var(--color-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-system-card small { color: var(--color-text-muted); font-size: var(--font-xs); }
.profile-system-card > div:last-child { display: flex; flex: 0 0 auto; align-items: center; gap: var(--space-2); }

.system-status.active { border-color: var(--success-border); background: var(--color-success-soft); color: var(--color-success); }
.system-status.paused,
.system-status.draft { border-color: var(--warning-border); background: var(--color-warning-soft); color: var(--warning-text); }
.system-status.completed { border-color: var(--primary-border); background: var(--color-primary-soft); color: var(--color-primary); }

.profile-table-wrap { border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.profile-table { width: 100%; min-width: 540px; }
.profile-table th,
.profile-table td { padding: var(--space-3); text-align: center; vertical-align: middle; }
.profile-table td small { display: block; color: var(--color-text-muted); font-size: 11px; }

.profile-empty,
.coaching-empty {
  display: grid;
  min-height: 100px;
  place-items: center;
  gap: var(--space-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: var(--space-5);
  text-align: center;
}

.profile-empty { grid-column: 1 / -1; }
.profile-empty strong,
.coaching-empty strong { color: var(--color-text-soft); }

.profile-progress-dashboard,
.profile-execution-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-progress-card { text-align: start; }
.profile-progress-card .profile-section-head { align-items: flex-start; }

.profile-progress-meters { display: grid; gap: var(--space-3); }
.profile-progress-meters > div { display: grid; grid-template-columns: 1fr auto; gap: var(--space-1) var(--space-3); align-items: center; }
.profile-progress-meters > div > span { color: var(--color-text-soft); font-size: var(--font-xs); }
.profile-progress-meters > div > b { color: var(--color-primary); font-family: var(--font-latin); font-variant-numeric: tabular-nums; }
.profile-progress-meters > div > i { grid-column: 1 / -1; height: 8px; overflow: hidden; border-radius: var(--radius-pill); background: var(--color-bg-subtle); }
.profile-progress-meters > div > i em { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--color-primary); }
.profile-progress-meters > div:nth-child(2) > i em { background: var(--color-success); }

/* Builder stages are intentionally in normal flow below the sticky heading.
   This prevents the step buttons/progress labels from being painted under it. */
.coaching-builder-dialog > form.dialog-body {
  gap: 0;
  padding: 0;
  scroll-padding-block: var(--space-6);
}

.coaching-builder-dialog > form.dialog-body > .details-dialog-head {
  top: 0;
  margin: 0;
  padding: var(--space-5) var(--space-6) var(--space-4);
}

.coaching-builder-dialog > form.dialog-body > #coachingBuilderStepper,
.coaching-builder-dialog > form.dialog-body > #coachingBuilderProgress,
.coaching-builder-dialog > form.dialog-body > #coachingBuilderContent {
  position: relative;
  z-index: 0;
  margin-inline: var(--space-6);
}

.coaching-builder-dialog > form.dialog-body > #coachingBuilderStepper,
.coaching-builder-dialog > form.dialog-body > #coachingBuilderProgress {
  flex: 0 0 auto;
}

.coaching-builder-dialog > form.dialog-body > #coachingBuilderStepper {
  min-height: 46px;
  margin-top: var(--space-4);
}
.coaching-builder-dialog > form.dialog-body > #coachingBuilderContent { margin-top: var(--space-4); padding-bottom: var(--space-5); }

.coaching-builder-dialog > form.dialog-body > .builder-dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: var(--z-content);
  margin: 0;
}

@media (max-width: 767px) {
  .external-trainees-table {
    min-width: 900px;
  }

  .external-trainees-table th,
  .external-trainees-table td {
    padding-inline: var(--space-3);
  }
}

.builder-stepper {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) var(--space-1) var(--space-2);
  scrollbar-width: thin;
}

.builder-step {
  display: inline-flex;
  min-width: 150px;
  min-height: 34px;
  align-items: center;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.builder-step > span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
}

.builder-step:hover:not(:disabled) {
  border-color: var(--border-focus);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.builder-step.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}

.builder-step.active > span,
.builder-step.complete > span {
  background: var(--primary-soft);
  color: inherit;
}

.builder-step.complete {
  border-color: var(--color-success);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.builder-step:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* The renderer supplies a labelled progress track. The old five-pixel bar
   clipped these labels, which made the workflow stages appear missing. */
.builder-progress {
  min-height: 52px;
  height: auto;
  overflow: visible;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-3) var(--space-4);
}

.builder-progress-track {
  display: grid;
  grid-template-columns: auto minmax(28px, 1fr) auto minmax(28px, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
}

.builder-progress-track > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  text-align: center;
}

.builder-progress-track > span.complete,
.builder-progress-track > span.active {
  color: var(--color-primary);
}

.builder-progress-track > span.complete { color: var(--color-success); }

.builder-progress-track > span b {
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-progress-track > i {
  display: block;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

.builder-progress-track > i.complete { background: var(--color-success); }

.builder-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width var(--transition-normal);
}
.builder-dialog-actions { position: sticky; bottom: calc(var(--space-5) * -1); z-index: var(--z-content); margin-inline: calc(var(--space-5) * -1); margin-bottom: calc(var(--space-5) * -1); background: var(--color-surface); }
.exercise-selector,
.meal-selector,
.program-day-card,
.meal-card { border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface-muted); padding: var(--space-4); }
.exercise-image,
.exercise-thumb,
.food-image { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-md); background: var(--color-bg-subtle); }
.exercise-list,
.meal-list,
.program-days,
.diet-meals { display: grid; gap: var(--space-3); }

/* Coaching builders ----------------------------------------------------- */
.builder-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  border-top: 1px solid var(--border-color);
  padding: var(--space-4) var(--space-5);
}

.builder-dialog-actions > button {
  min-width: 110px;
}

.builder-switch,
.builder-builder-head,
.builder-structure-head,
.builder-stage-heading,
.builder-card-head,
.builder-section-title,
.builder-day-panel-head,
.builder-meal-row-head,
.review-block-head,
.review-identity,
.nutrition-summary-head,
.nutrition-summary-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.builder-switch,
.builder-stage-heading,
.builder-builder-head,
.builder-structure-head {
  align-items: flex-start;
}

.builder-switch > span:first-child,
.builder-stage-heading > div > span,
.builder-builder-head > div > span,
.builder-section-title > div > span {
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.builder-stage-heading h4,
.builder-builder-head h4,
.builder-structure-head h4,
.builder-section-title h4 {
  margin: var(--space-1) 0 0;
  color: var(--color-text);
  font-size: var(--font-lg);
  line-height: 1.45;
}

.builder-stage-heading p,
.builder-builder-head p,
.builder-structure-head small,
.builder-section-title small {
  display: block;
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.builder-chip,
.builder-lock-chip,
.builder-ready-chip,
.builder-formula-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.builder-lock-chip {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.builder-ready-chip {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.builder-formula-chip {
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  direction: ltr;
}

.builder-stage,
.builder-calculator,
.builder-target-panel,
.builder-routine,
.builder-meal,
.builder-meal-row,
.builder-day-panel,
.review-block {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-5);
}

.builder-stage {
  background: var(--color-surface-muted);
}

.builder-basic-grid,
.calculator-grid,
.target-grid,
.builder-inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.builder-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.builder-basic-grid > label,
.calculator-grid > label,
.target-grid > label,
.builder-inline-fields > label,
.builder-mini-grid > label,
.builder-wide-label,
.builder-row-note,
.builder-food-row > label,
.builder-day-panel-head label,
.meal-time-field {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.builder-basic-grid input,
.builder-basic-grid select,
.builder-wide-label textarea,
.builder-wide-label input,
.builder-inline-fields input,
.builder-inline-fields select,
.builder-mini-grid input,
.builder-mini-grid select,
.calculator-grid input,
.calculator-grid select,
.target-grid input,
.target-grid select,
.builder-row-note input,
.builder-day-panel-head input,
.builder-day-panel-head select,
.builder-food-row input,
.builder-food-row select,
.meal-time-field input {
  width: 100%;
}

.builder-wide-label {
  grid-column: 1 / -1;
}

.builder-basic-grid small,
.calculator-grid small {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: var(--weight-regular);
  line-height: 1.5;
}

.builder-routines,
.builder-meals,
.builder-meals-list,
.builder-day-panels,
.builder-exercises,
.builder-foods,
.review-blocks {
  display: grid;
  gap: var(--space-4);
}

.builder-card-head,
.builder-day-panel-head,
.builder-meal-row-head,
.review-block-head {
  align-items: flex-start;
}

.builder-card-head > div,
.builder-meal-title,
.review-block-head {
  min-width: 0;
}

.builder-card-head span,
.builder-meal-title small,
.review-block-head span,
.review-identity span {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.builder-card-head strong,
.builder-meal-title strong,
.review-block-head strong,
.review-identity strong {
  display: block;
  margin-top: var(--space-1);
  color: var(--color-text);
  font-size: var(--font-md);
}

.builder-exercises,
.builder-foods {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-4);
}

.builder-exercise,
.builder-food,
.builder-exercise-row,
.builder-food-row {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-4);
}

.builder-exercise-head,
.builder-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
}

.builder-exercise-head {
  justify-content: space-between;
}

.builder-add-item {
  justify-self: start;
}

.builder-empty,
.builder-search-empty,
.builder-reference-muted {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: var(--space-5);
  text-align: center;
}

.builder-calculator,
.builder-target-panel {
  background: var(--color-surface-muted);
}

.calculator-results,
.review-summary-grid,
.builder-workout-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.calculator-results > div,
.review-summary-grid > div,
.builder-workout-metrics > article {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-3);
  text-align: center;
}

.calculator-results span,
.calculator-results small,
.review-summary-grid span,
.builder-workout-metrics span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.calculator-results strong,
.review-summary-grid strong,
.builder-workout-metrics strong {
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-variant-numeric: tabular-nums;
}

.calculator-results small {
  font-size: 11px;
}

.calculator-results .btn {
  align-self: center;
  min-height: 44px;
}

.diet-live-summary,
.nutrition-summary-head,
.nutrition-summary-foot,
.nutrition-macro-grid {
  display: grid;
  gap: var(--space-3);
}

.diet-live-summary {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-primary-soft);
  padding: var(--space-4);
}

.nutrition-summary-head {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.nutrition-summary-head span,
.nutrition-summary-foot span,
.nutrition-macro-grid span {
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.nutrition-summary-head strong,
.nutrition-macro-grid strong {
  display: block;
  color: var(--color-text);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-variant-numeric: tabular-nums;
}

.nutrition-summary-head b {
  color: var(--color-primary);
  font-family: var(--font-latin);
}

.nutrition-total-progress,
.nutrition-macro-grid i,
.muscle-bar b {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
}

.nutrition-total-progress i,
.nutrition-macro-grid i b,
.muscle-bar b i {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
}

.nutrition-macro-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nutrition-macro-grid > div {
  display: grid;
  gap: var(--space-1);
}

.nutrition-macro-grid i b {
  width: 62%;
  background: var(--color-success);
}

.nutrition-summary-foot {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-top: var(--space-2);
}

.builder-exercise-table,
.builder-food-table,
.builder-review-table {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.builder-exercise-table-head,
.builder-food-table-head {
  display: grid;
  min-width: 920px;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  padding: var(--space-3);
  font-size: 11px;
  font-weight: var(--weight-bold);
  text-align: center;
}

.builder-exercise-table-head { grid-template-columns: 36px minmax(220px, 2fr) repeat(6, minmax(76px, 1fr)) 74px; }
.builder-food-table-head { grid-template-columns: minmax(180px, 2fr) repeat(6, minmax(82px, 1fr)) 74px; }

.builder-exercise-row,
.builder-food-row {
  min-width: 920px;
  border: 0;
  border-top: 1px solid var(--border-color);
  border-radius: 0;
  background: var(--color-surface);
  padding: var(--space-3);
}

.builder-exercise-row { grid-template-columns: 36px minmax(220px, 2fr) repeat(6, minmax(76px, 1fr)) 74px; align-items: end; }
.builder-food-row { grid-template-columns: minmax(180px, 2fr) repeat(6, minmax(82px, 1fr)) 74px; align-items: end; }

.builder-exercise-row > label,
.builder-food-row > label {
  min-width: 0;
}

.builder-exercise-row label span,
.builder-food-row label span {
  color: var(--color-text-muted);
  font-size: 10px;
}

.exercise-row-number,
.food-live-value {
  color: var(--color-text-soft);
  font-family: var(--font-latin);
  font-size: var(--font-sm);
  text-align: center;
}

.food-live-value {
  display: grid;
  gap: 2px;
}

.food-live-value b { color: var(--color-text); }
.food-live-value small { color: var(--color-text-muted); font-size: 10px; }

.exercise-row-notes {
  display: grid;
  grid-column: 2 / -1;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.builder-reference-copy {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
}

.builder-exercise-reference {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-3);
}

.exercise-media-builder,
.builder-reference-muscle-image {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
}

.builder-reference-muscle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.builder-reference-muscle-image { width: 28px; height: 28px; border-radius: var(--radius-sm); }

.builder-reference-copy details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  padding: var(--space-2) var(--space-3);
}

.builder-reference-copy summary {
  cursor: pointer;
  color: var(--color-primary);
  font-weight: var(--weight-semibold);
}

.builder-reference-copy details p {
  margin: var(--space-2) 0 0;
  line-height: 1.7;
}

.builder-day-tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-1);
}

.builder-day-tab {
  display: grid;
  min-width: 150px;
  gap: 2px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: var(--space-3);
  text-align: start;
}

.builder-day-tab.active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.builder-day-tab b { color: var(--color-text); font-size: var(--font-sm); }
.builder-day-tab small { color: var(--color-text-muted); font-size: 11px; }

.builder-meal-row-head { align-items: flex-start; }
.builder-meal-title { display: flex; align-items: center; gap: var(--space-3); }
.builder-meal-title > span { display: inline-grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); font-family: var(--font-latin); font-weight: var(--weight-bold); }
.builder-meal-row-summary { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.builder-meal-row-summary span,
.review-muscles span { border: 1px solid var(--border-color); border-radius: var(--radius-pill); background: var(--color-surface-muted); color: var(--color-text-soft); padding: var(--space-1) var(--space-3); font-size: var(--font-xs); }

.review-identity {
  justify-content: flex-start;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-3);
}

.review-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.review-note { border-radius: var(--radius-md); background: var(--color-primary-soft); color: var(--color-text-soft); padding: var(--space-3) var(--space-4); line-height: 1.8; }
.review-muscles { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.builder-review-table table { min-width: 760px; }
.builder-review-table th,
.builder-review-table td { text-align: center; }
.builder-review-exercise { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); }

.builder-search-select { position: relative; min-width: 0; }
.builder-search-trigger { width: 100%; min-height: 42px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); padding: 0 var(--space-3); text-align: start; }
.builder-search-trigger[aria-expanded="true"] { border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.builder-search-popover { position: absolute; inset-inline: 0; top: calc(100% + var(--space-2)); z-index: var(--z-dropdown); display: grid; gap: var(--space-2); min-width: 260px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface); padding: var(--space-2); box-shadow: var(--shadow-md); }
.builder-search-input-wrap { display: block; }
.builder-search-options { display: grid; max-height: 240px; gap: 2px; overflow-y: auto; }
.builder-search-option { display: grid; gap: 2px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text); padding: var(--space-2) var(--space-3); text-align: start; }
.builder-search-option:hover,
.builder-search-option[aria-selected="true"] { background: var(--color-primary-soft); color: var(--color-primary); }
.builder-search-native { display: none; }

@media (max-width: 767px) {
  .builder-stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
    overflow: visible;
  }

  .builder-step {
    min-width: 0;
    min-height: 68px;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--radius-md);
    padding: var(--space-2);
    text-align: center;
    white-space: normal;
  }

  .builder-step strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.35;
  }

  .builder-progress-track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-1);
  }

  .builder-progress-track > i { display: none; }

  .builder-progress-track > span {
    min-height: 32px;
    flex-direction: column;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    padding: var(--space-1);
    line-height: 1.25;
  }

  .builder-progress-track > span b {
    max-width: 100%;
    white-space: normal;
  }

  .builder-dialog-actions { padding: var(--space-3) var(--space-4); }
  .builder-stage,
  .builder-calculator,
  .builder-target-panel,
  .builder-routine,
  .builder-meal,
  .builder-meal-row,
  .builder-day-panel,
  .review-block { padding: var(--space-4); }
  .builder-stage-heading,
  .builder-builder-head,
  .builder-structure-head,
  .builder-card-head,
  .builder-day-panel-head,
  .builder-meal-row-head,
  .review-block-head { flex-direction: column; align-items: stretch; }
  .builder-basic-grid,
  .calculator-grid,
  .target-grid,
  .builder-inline-fields,
  .builder-mini-grid { grid-template-columns: 1fr; }
  .builder-wide-label { grid-column: auto; }
  .calculator-results,
  .review-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nutrition-summary-head,
  .nutrition-summary-foot { grid-template-columns: 1fr; }
  .nutrition-macro-grid { grid-template-columns: 1fr; }
  .builder-exercise-reference { align-items: flex-start; }
  .builder-meal-row-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder-dialog-actions > button { flex: 1 1 140px; }

  .coaching-summary-card { min-height: 100px; padding: var(--space-3); }
  .coaching-summary-icon { width: 42px; height: 42px; }
  .coaching-summary-icon::before { width: 42px; height: 42px; }
  .coaching-summary-icon .coaching-inline-icon { width: 20px; height: 20px; }
  .coaching-summary-copy strong { font-size: 1.45rem; }

  .member-training-head,
  .profile-hero,
  .profile-system-card { align-items: stretch; flex-direction: column; }
  .member-training-head > div:last-child { max-width: none; justify-content: stretch; }
  .member-training-head > div:last-child .btn { flex: 1 1 130px; }
  .member-training-systems { grid-template-columns: 1fr; }
  .member-progress-line { grid-template-columns: 1fr; }
  .profile-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .profile-hero > .btn { grid-column: 1 / -1; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-actions .btn { flex: 1 1 140px; }
  .profile-system-card > div:last-child { justify-content: space-between; }
  .profile-progress-dashboard,
  .profile-execution-grid { grid-template-columns: 1fr; }
  .coaching-builder-dialog > form.dialog-body > .details-dialog-head { padding: var(--space-4) var(--space-4) var(--space-3); }
  .coaching-builder-dialog > form.dialog-body > #coachingBuilderStepper,
  .coaching-builder-dialog > form.dialog-body > #coachingBuilderProgress,
  .coaching-builder-dialog > form.dialog-body > #coachingBuilderContent { margin-inline: var(--space-4); }
  .coaching-builder-dialog > form.dialog-body > #coachingBuilderStepper { min-height: 90px; margin-top: var(--space-3); }
  .coaching-builder-dialog > form.dialog-body > #coachingBuilderContent { margin-top: var(--space-3); }
}

/* Builder clarity layer --------------------------------------------------
   Keep the workflow compact and give each plan type its own visual language. */
.coaching-builder-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-width: 1080px;
  max-height: calc(100vh - 24px);
}

.coaching-builder-dialog > form.dialog-body {
  overflow-x: hidden;
}

.coaching-builder-dialog.builder-mode-workout {
  --builder-accent: var(--builder-workout-accent);
  --builder-accent-strong: var(--builder-workout-accent-strong);
  --builder-soft: var(--builder-workout-soft);
  --builder-border: var(--builder-workout-border);
  --builder-stage-bg: var(--builder-workout-stage-bg);
}

.coaching-builder-dialog.builder-mode-diet > form.dialog-body > .details-dialog-head {
  border-bottom: 3px solid var(--builder-accent);
  background: linear-gradient(135deg, var(--builder-stage-bg), var(--bg-card) 68%);
}

.coaching-builder-dialog.builder-mode-workout > form.dialog-body > .details-dialog-head {
  border-bottom: 3px solid var(--builder-accent);
  background: linear-gradient(135deg, var(--builder-stage-bg), var(--bg-card) 68%);
}

.builder-mode-diet .builder-step.active,
.builder-mode-diet .builder-step:hover:not(:disabled) {
  border-color: var(--builder-accent);
  background: var(--builder-accent);
  color: var(--text-on-primary);
}

.builder-mode-workout .builder-step.active,
.builder-mode-workout .builder-step:hover:not(:disabled) {
  border-color: var(--builder-accent);
  background: var(--builder-accent);
  color: var(--text-on-primary);
}

.builder-mode-diet .builder-step.complete,
.builder-mode-diet .builder-progress-track > span.active,
.builder-mode-diet .builder-progress-track > span.complete,
.builder-mode-diet .builder-switch > span:first-child,
.builder-mode-diet .builder-stage-heading > div > span,
.builder-mode-diet .builder-builder-head > div > span,
.builder-mode-diet .builder-section-title > div > span {
  color: var(--builder-accent);
}

.builder-mode-workout .builder-step.complete,
.builder-mode-workout .builder-progress-track > span.active,
.builder-mode-workout .builder-progress-track > span.complete,
.builder-mode-workout .builder-switch > span:first-child,
.builder-mode-workout .builder-stage-heading > div > span,
.builder-mode-workout .builder-builder-head > div > span,
.builder-mode-workout .builder-section-title > div > span {
  color: var(--builder-accent);
}

.builder-mode-diet .builder-progress-track > i.complete,
.builder-mode-workout .builder-progress-track > i.complete {
  background: var(--builder-accent);
}

.builder-mode-diet .builder-stage,
.builder-mode-workout .builder-stage {
  border-color: var(--builder-border);
  background: var(--builder-stage-bg);
}

.builder-mode-diet .builder-stage-heading,
.builder-mode-diet .builder-builder-head,
.builder-mode-diet .builder-calculator,
.builder-mode-diet .builder-target-panel,
.builder-mode-diet .builder-meal-row {
  border-inline-start: 4px solid var(--builder-accent);
}

.builder-mode-workout .builder-stage-heading,
.builder-mode-workout .builder-builder-head,
.builder-mode-workout .builder-day-panel {
  border-inline-start: 4px solid var(--builder-accent);
}

.builder-mode-diet .builder-calculator,
.builder-mode-diet .builder-target-panel,
.builder-mode-diet .diet-live-summary {
  border-color: var(--builder-border);
  background: var(--builder-soft);
}

.builder-mode-workout .builder-workout-metrics,
.builder-mode-workout .builder-day-tabs {
  border-color: var(--builder-border);
}

.builder-mode-diet .builder-meal-title > span,
.builder-mode-diet .builder-meal-row-summary span {
  background: var(--builder-soft);
  color: var(--builder-accent);
  border-color: var(--builder-border);
}

.builder-mode-workout .builder-day-tab.active {
  border-color: var(--builder-accent);
  background: var(--builder-soft);
  color: var(--builder-accent);
  box-shadow: var(--shadow-primary);
}

.builder-mode-workout .builder-day-tab.active b {
  color: var(--builder-accent);
}

.builder-mode-diet .nutrition-total-progress i,
.builder-mode-diet .nutrition-macro-grid i b {
  background: var(--builder-accent);
}

.builder-mode-workout .builder-workout-metrics > article {
  border-color: var(--builder-border);
  background: var(--builder-soft);
}

.builder-mode-workout .builder-workout-metrics strong,
.builder-mode-diet .nutrition-summary-head b {
  color: var(--builder-accent);
}

.builder-basic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.builder-basic-grid .builder-client-field {
  grid-column: 1 / -1;
}

.calculator-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.target-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.builder-dialog-actions {
  align-items: center;
  background: var(--color-surface);
}

.builder-dialog-actions::before {
  flex: 1 1 240px;
  color: var(--color-text-muted);
  content: attr(data-builder-action-hint);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.5;
}

.builder-dialog-actions #coachingBuilderBack,
.builder-dialog-actions #coachingBuilderPreview,
.builder-dialog-actions #coachingBuilderPrint,
.builder-dialog-actions #coachingBuilderPdf {
  border-color: var(--builder-border, var(--border-color));
}

.builder-dialog-actions #coachingBuilderNext,
.builder-dialog-actions #coachingBuilderSave {
  min-width: 210px;
  background: var(--builder-accent, var(--color-primary));
  border-color: var(--builder-accent, var(--color-primary));
}

.builder-dialog-actions #coachingBuilderNext:hover,
.builder-dialog-actions #coachingBuilderSave:hover {
  background: var(--builder-accent-strong, var(--color-primary));
  border-color: var(--builder-accent-strong, var(--color-primary));
}

.builder-exercise-table-head,
.builder-exercise-row {
  min-width: 850px;
}

.builder-exercise-table-head {
  grid-template-columns: 28px minmax(170px, 2fr) repeat(9, minmax(54px, 1fr)) 60px;
}

.builder-exercise-row {
  grid-template-columns: 28px minmax(170px, 2fr) repeat(9, minmax(54px, 1fr)) 60px;
}

.builder-food-table-head,
.builder-food-row {
  min-width: 700px;
}

.builder-food-table-head {
  grid-template-columns: minmax(170px, 2fr) repeat(6, minmax(58px, 1fr)) 60px;
}

.builder-food-row {
  grid-template-columns: minmax(170px, 2fr) repeat(6, minmax(58px, 1fr)) 60px;
}

.builder-review-table table {
  min-width: 680px;
}

@media (max-width: 767px) {
  .coaching-builder-dialog {
    width: calc(100vw - 20px);
    max-width: none;
  }

  .builder-basic-grid,
  .calculator-grid,
  .target-grid {
    grid-template-columns: 1fr;
  }

  .builder-basic-grid .builder-client-field {
    grid-column: auto;
  }

  .builder-dialog-actions::before {
    flex-basis: 100%;
    order: -1;
  }

  .builder-dialog-actions #coachingBuilderNext,
  .builder-dialog-actions #coachingBuilderSave {
    min-width: 0;
  }

  .builder-exercise-table-head,
  .builder-food-table-head {
    display: none;
  }

  .builder-exercise-row,
  .builder-food-row {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .builder-exercise-row .exercise-row-number,
  .builder-exercise-row .exercise-select-field,
  .builder-exercise-row .exercise-row-notes,
  .builder-food-row > label:first-child {
    grid-column: 1 / -1;
  }

  .builder-exercise-row .row-delete-button,
  .builder-food-row .row-delete-button {
    justify-self: start;
  }

  .exercise-row-notes {
    padding-top: var(--space-2);
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/nutrition.css */
.nutrition-section,
.diet-section,
.meal-plan-section,
.nutrition-grid {
  display: grid;
  gap: var(--space-5);
}

.nutrition-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.nutrition-card,
.meal-plan-card,
.food-card { display: grid; gap: var(--space-3); border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-4); }
.nutrition-card-head,
.meal-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.nutrition-card h4,
.meal-plan-card h4,
.food-card h4 { color: var(--color-text); font-size: var(--font-md); font-weight: var(--weight-bold); }
.nutrition-card p,
.meal-plan-card p,
.food-card p { color: var(--color-text-muted); font-size: var(--font-xs); }
.nutrition-macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.nutrition-macro { display: grid; gap: 1px; border-radius: var(--radius-sm); background: var(--color-surface-muted); padding: var(--space-2); text-align: center; }
.nutrition-macro strong { color: var(--color-text); font-family: var(--font-latin); font-size: var(--font-sm); direction: ltr; }
.nutrition-macro span { color: var(--color-text-muted); font-size: 10px; }

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/library.css */
.library-section {
  min-width: 0;
  padding: clamp(var(--space-5), 2.5vw, var(--space-8));
}

.library-header,
.library-heading,
.library-toolbar,
.library-toolbar-actions,
.library-type-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.library-header {
  justify-content: space-between;
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-color);
}

.library-heading {
  min-width: 0;
  justify-content: flex-start;
  flex: 1;
}

.library-heading > div {
  min-width: 0;
}

.library-heading h3 {
  margin: 0;
  color: var(--color-text);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.25;
}

.library-heading p {
  max-width: 760px;
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
  line-height: 1.7;
}

.library-kicker {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
}

.library-add-button {
  flex: 0 0 auto;
  min-height: 44px;
  white-space: nowrap;
}

.library-add-button > span:first-child {
  font-size: 1.15rem;
  font-weight: var(--weight-bold);
  line-height: 1;
}

.library-type-tabs {
  justify-content: stretch;
  width: 100%;
  margin-top: var(--space-6);
  padding: var(--space-2);
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  scrollbar-width: thin;
}

.library-type-tab {
  display: inline-flex;
  min-width: 0;
  min-height: 58px;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-soft);
  font: inherit;
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.library-type-tab:hover {
  border-color: var(--border-color);
  background: var(--color-surface);
  color: var(--color-primary);
}

.library-type-tab:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

.library-type-tab.active,
.library-type-tab[aria-selected="true"] {
  border-color: var(--primary-border);
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-xs);
}

.library-type-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  font-size: 1.05rem;
}

.library-type-tab strong {
  display: inline-grid;
  min-width: 32px;
  min-height: 24px;
  padding-inline: var(--space-2);
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.library-type-tab.active strong,
.library-type-tab[aria-selected="true"] strong {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.library-toolbar {
  align-items: stretch;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.library-search {
  position: relative;
  display: flex;
  min-width: min(100%, 300px);
  min-height: 48px;
  flex: 1 1 360px;
  align-items: center;
}

.library-search .ui-icon {
  position: absolute;
  inset-inline-start: var(--space-4);
  width: 19px;
  height: 19px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.library-search input,
.library-filter {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.library-search input {
  padding: 0 var(--space-4) 0 44px;
}

.library-search input::placeholder {
  color: var(--color-text-subtle);
}

.library-search input:hover,
.library-filter:hover {
  border-color: var(--border-strong);
}

.library-search input:focus,
.library-filter:focus {
  border-color: var(--border-focus);
  outline: 0;
  box-shadow: var(--focus-ring);
}

.library-filters {
  display: grid;
  min-width: min(100%, 280px);
  flex: 2 1 560px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-2);
}

.library-filters.single-filter {
  flex: 0 1 220px;
}

.library-filter {
  padding: 0 var(--space-3);
  cursor: pointer;
}

.library-refresh-button {
  min-width: 92px;
  min-height: 48px;
  white-space: nowrap;
}

.library-message {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  font-size: var(--font-sm);
}

.library-message.success {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.library-message.error {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.library-list {
  min-width: 0;
  margin-top: var(--space-4);
}

.library-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
  scrollbar-width: thin;
}

.library-data-table {
  width: 100%;
  min-width: 940px;
  table-layout: fixed;
  color: var(--color-text-soft);
  font-size: var(--font-sm);
}

.library-data-table.foods {
  min-width: 1160px;
}

.library-data-table.exercises {
  min-width: 1080px;
}

.library-data-table.muscles {
  min-width: 860px;
}

.library-data-table th,
.library-data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: center;
  vertical-align: middle;
}

.library-data-table thead th {
  height: 56px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.library-data-table tbody tr {
  min-height: 76px;
  background: var(--color-surface);
  transition: background-color var(--transition-fast);
}

.library-data-table tbody tr:nth-child(even) {
  background: var(--color-surface-muted);
}

.library-data-table tbody tr:hover {
  background: var(--color-primary-soft);
}

.library-data-table tbody td {
  height: 76px;
  border-bottom: 1px solid var(--border-color);
  line-height: 1.45;
}

.library-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.library-data-table th:first-child,
.library-data-table td:first-child {
  width: 26%;
  text-align: start;
}

.library-data-table th:last-child,
.library-data-table td:last-child {
  width: 180px;
}

.library-data-table.exercises th:nth-child(2),
.library-data-table.exercises td:nth-child(2) { width: 16%; }

.library-data-table.exercises th:nth-child(3),
.library-data-table.exercises td:nth-child(3),
.library-data-table.exercises th:nth-child(4),
.library-data-table.exercises td:nth-child(4),
.library-data-table.exercises th:nth-child(5),
.library-data-table.exercises td:nth-child(5) { width: 12%; }

.library-data-table.exercises th:nth-child(6),
.library-data-table.exercises td:nth-child(6) { width: 13%; }

.library-data-table.foods th:nth-child(2),
.library-data-table.foods td:nth-child(2) { width: 14%; }

.library-data-table.foods th:nth-child(3),
.library-data-table.foods td:nth-child(3),
.library-data-table.foods th:nth-child(4),
.library-data-table.foods td:nth-child(4),
.library-data-table.foods th:nth-child(5),
.library-data-table.foods td:nth-child(5),
.library-data-table.foods th:nth-child(6),
.library-data-table.foods td:nth-child(6) { width: 10%; }

.library-data-table.foods th:nth-child(7),
.library-data-table.foods td:nth-child(7) { width: 12%; }

.library-data-table.muscles th:nth-child(2),
.library-data-table.muscles td:nth-child(2) { width: 17%; }

.library-data-table.muscles th:nth-child(3),
.library-data-table.muscles td:nth-child(3) { width: 16%; }

.library-data-table.muscles th:nth-child(4),
.library-data-table.muscles td:nth-child(4) { width: 12%; }

.library-table-primary {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  text-align: start;
}

.library-table-primary > div {
  min-width: 0;
}

.library-table-primary strong,
.library-table-primary small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.library-table-primary strong {
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  line-height: 1.45;
}

.library-table-primary small {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  direction: ltr;
  unicode-bidi: plaintext;
}

.library-table-icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  color: var(--color-primary);
  font-size: 1.1rem;
}

.library-table-icon .exercise-media,
.library-table-icon .muscle-media,
.library-table-icon .food-media,
.library-table-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-table-icon .exercise-media-fallback,
.library-table-icon .muscle-media-fallback,
.library-table-icon .food-media-fallback {
  display: grid;
  place-items: center;
}

.library-table-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: var(--space-1) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
  color: var(--color-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  white-space: nowrap;
}

.library-table-badge.muscles,
.library-table-badge.exercises {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text-primary-soft);
}

.library-table-badge.foods,
.library-table-badge.positive {
  border-color: var(--success-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.library-table-badge.warning {
  border-color: var(--warning-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.library-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: max-content;
  white-space: nowrap;
}

.library-row-actions .btn {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 0;
}

.library-action-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke-width: 1.9;
}

.library-row-actions .library-action-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.library-row-actions .library-delete {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.library-row-actions .library-delete:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--color-danger);
  color: var(--text-on-primary);
}

/* Details dialogs ------------------------------------------------------- */
.library-details-dialog .dialog-body {
  min-height: 0;
  overflow-y: auto;
}

.library-details-dialog #libraryDetailsContent {
  display: grid;
  min-width: 0;
  gap: var(--space-4);
  overflow-wrap: anywhere;
}

.library-detail-hero {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface));
  padding: var(--space-4);
}

.library-detail-hero-icon {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 1.55rem;
}

.library-detail-hero-icon .exercise-media-gallery,
.library-detail-hero-icon img { width: 100%; height: 100%; object-fit: cover; }
.library-detail-hero h4 { min-width: 0; color: var(--color-text); font-size: var(--font-lg); font-weight: var(--weight-extrabold); overflow-wrap: anywhere; }
.library-detail-hero p { margin-top: var(--space-1); color: var(--color-text-muted); direction: auto; line-height: 1.6; overflow-wrap: anywhere; }

.library-detail-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.library-detail-item {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  padding: var(--space-3) var(--space-4);
  text-align: start;
}

.library-detail-item.full { grid-column: 1 / -1; }
.library-detail-item > span { color: var(--color-text-muted); font-size: var(--font-xs); font-weight: var(--weight-semibold); }
.library-detail-item > strong {
  display: block;
  min-width: 0;
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  line-height: 1.7;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

.library-detail-list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding-inline-start: var(--space-5);
  color: var(--color-text);
  font-size: var(--font-sm);
  line-height: 1.7;
  text-align: start;
}

.library-detail-list li::marker { color: var(--color-primary); font-weight: var(--weight-bold); }

.muscle-detail-visual {
  display: grid;
  min-width: 0;
  gap: var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-4);
}

.muscle-media-gallery,
.exercise-media-gallery {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

.muscle-media-gallery figure,
.exercise-media-gallery figure {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-xs);
  text-align: center;
}

.muscle-media-detail,
.exercise-media-detail {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.muscle-detail-source-note {
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.65;
}

.exercise-detail-gallery {
  min-width: 0;
  grid-column: 1 / -1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: var(--space-3);
}

.exercise-detail-gallery .exercise-media-detail { height: 210px; object-fit: cover; }

.library-row-actions .library-delete {
  border-color: var(--danger-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.library-row-actions .library-delete:hover {
  border-color: var(--color-danger);
  background: var(--color-danger);
  color: var(--text-on-primary);
}

.library-empty,
.library-list > .loading {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: var(--space-8);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  text-align: center;
}

.library-pagination {
  margin-top: var(--space-3);
}

.library-dialog,
.library-details-dialog {
  width: min(920px, calc(100vw - 32px));
}

@media (max-width: 900px) {
  .library-header {
    align-items: flex-start;
  }

  .library-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .library-search,
  .library-filters {
    min-width: 0;
    grid-column: 1 / -1;
  }

  .library-refresh-button {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 767px) {
  .library-section {
    padding: var(--space-4);
  }

  .library-header {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-4);
  }

  .library-heading {
    align-items: flex-start;
  }

  .library-add-button {
    width: 100%;
  }

  .library-type-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .library-type-tab {
    min-height: 72px;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2);
    font-size: var(--font-xs);
  }

  .library-type-icon {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
  }

  .library-type-tab strong {
    min-height: 20px;
    font-size: 0.68rem;
  }

  .library-toolbar {
    display: flex;
    flex-direction: column;
  }

  .library-search,
  .library-filters,
  .library-filters.single-filter,
  .library-refresh-button {
    width: 100%;
    flex: 1 1 auto;
  }

  .library-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-refresh-button {
    min-width: 0;
  }

  .library-data-table {
    min-width: 920px;
  }

  .library-data-table.foods {
    min-width: 1080px;
  }

  .library-data-table.exercises {
    min-width: 1020px;
  }

  .library-detail-grid { grid-template-columns: 1fr; }
  .library-detail-item.full { grid-column: auto; }
  .muscle-media-detail,
  .exercise-media-detail { height: 160px; }

  .library-table-primary {
    gap: var(--space-2);
  }

  .library-table-icon {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 390px) {
  .library-type-tabs {
    gap: var(--space-1);
    padding: var(--space-1);
  }

  .library-type-tab {
    min-height: 68px;
  }

  .library-filters {
    grid-template-columns: 1fr;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/reports.css */
.reports-section {
  width: 100%;
  min-width: 0;
  gap: var(--space-5);
}

.day-pass-report-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.day-pass-report-summary article {
  display: grid;
  gap: var(--space-1);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-lg);
  background: var(--color-info-soft);
  padding: var(--space-4);
}
.day-pass-report-summary span { color: var(--color-text-muted); font-size: var(--font-xs); }
.day-pass-report-summary strong { color: var(--color-primary); font-family: var(--font-latin); font-size: var(--font-xl); }
.day-pass-report-card .reports-table td:first-child strong,
.day-pass-report-card .reports-table td:first-child small { display: block; }
.day-pass-report-card .reports-table td:first-child small { color: var(--color-text-muted); font-family: var(--font-latin); font-size: var(--font-xs); }
.day-pass-report-card .reports-table td:first-child small.day-pass-reference { color: var(--color-primary); font-size: 10px; font-weight: var(--weight-bold); }
.day-pass-report-table .alert-whatsapp-button { width: 36px; height: 36px; }
.reports-no-whatsapp { color: var(--color-text-muted); font-size: var(--font-xs); white-space: nowrap; }

@media (max-width: 600px) {
  .day-pass-report-summary { grid-template-columns: 1fr; }
}

.reports-section[hidden],
.reports-view[hidden] { display: none; }

.reports-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--color-surface-elevated), var(--color-primary-soft));
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
}

.reports-heading { display: flex; min-width: 0; align-items: center; gap: var(--space-4); }
.reports-heading > div { min-width: 0; }
.reports-icon { display: grid; width: 56px; height: 56px; flex: 0 0 56px; place-items: center; border: 1px solid var(--border-focus); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-xs); }
.reports-icon .ui-icon { width: 27px; height: 27px; }
.reports-eyebrow,
.report-card-head > div > span:first-child { display: block; color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); letter-spacing: .02em; }
.reports-heading h2 { margin-top: 2px; color: var(--color-text); font-size: clamp(1.35rem, 2.4vw, 2rem); font-weight: var(--weight-extrabold); line-height: 1.25; }
.reports-heading p { max-width: 720px; margin-top: var(--space-1); color: var(--color-text-muted); font-size: var(--font-sm); }

.reports-actions,
.reports-debtor-actions,
.reports-coaching-actions { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2); min-width: 188px; }
.reports-coaching-actions .btn { min-width: 54px; }
.reports-actions { flex: 0 0 auto; }
.reports-button-icon { display: inline-flex; }
.reports-button-icon .ui-icon { width: 17px; height: 17px; }

.reports-tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); min-width: 0; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface-muted); padding: var(--space-2); }
.reports-tab { display: flex; min-width: 0; min-height: 68px; align-items: center; justify-content: center; gap: var(--space-2); border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--color-text-muted); padding: var(--space-2) var(--space-3); font-size: var(--font-xs); font-weight: var(--weight-bold); line-height: 1.35; text-align: center; transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast); }
.reports-tab:hover,
.reports-tab:focus-visible { border-color: var(--border-focus); background: var(--color-surface); color: var(--color-primary); transform: translateY(-1px); }
.reports-tab.active,
.reports-tab[aria-selected="true"] { border-color: var(--color-primary); background: var(--color-primary); color: var(--text-on-primary); box-shadow: var(--shadow-primary); }
.reports-tab-icon { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: var(--radius-sm); background: var(--color-primary-soft); color: var(--color-primary); }
.reports-tab.active .reports-tab-icon,
.reports-tab[aria-selected="true"] .reports-tab-icon { background: var(--primary-soft); color: var(--text-on-primary); }
.reports-tab-icon .ui-icon { width: 18px; height: 18px; }

.reports-filters { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-4); border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-4); box-shadow: var(--shadow-xs); }
.reports-filter-heading { display: grid; flex: 0 1 180px; gap: 2px; min-width: 150px; align-self: center; }
.reports-filter-heading span { color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.reports-filter-heading strong { color: var(--color-text); font-size: var(--font-md); }
.reports-date-fields { display: grid; flex: 1 1 380px; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: var(--space-3); min-width: 320px; }
.reports-extra-filters { display: flex; flex: 1 1 440px; flex-wrap: wrap; align-items: end; gap: var(--space-3); min-width: 280px; }
.reports-extra-filters > label { flex: 1 1 150px; }
.reports-filters label { display: grid; gap: var(--space-1); min-width: 0; }
.reports-filters label > span { color: var(--color-text-soft); font-size: var(--font-xs); font-weight: var(--weight-semibold); }
.reports-filter-note { display: flex; min-height: 44px; align-items: center; color: var(--color-text-muted); font-size: var(--font-xs); }
.reports-filters label.reports-check-field { display: flex; min-height: 44px; align-items: center; gap: var(--space-2); }
.reports-check-field input { width: 18px; min-height: 18px; }
.reports-submit-button { flex: 0 0 auto; min-height: 46px; white-space: nowrap; }

.reports-view { display: grid; gap: var(--space-5); min-width: 0; }
.reports-kpis,
.report-summary-strip,
.reports-grid,
.reports-detail-grid { display: grid; gap: var(--space-4); min-width: 0; }
.reports-kpis,
.report-summary-strip { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.reports-grid { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr); }
.reports-detail-grid { grid-template-columns: minmax(0, 1fr); }

.report-kpi { display: grid; min-width: 0; gap: var(--space-2); border: 1px solid var(--border-color); border-top: 3px solid var(--color-primary); border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-4); box-shadow: var(--shadow-xs); transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast); }
.report-kpi:hover { border-color: var(--border-focus); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.report-kpi-top { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: var(--space-2); }
.report-kpi-label { min-width: 0; overflow: hidden; color: var(--color-text-muted); font-size: var(--font-xs); font-weight: var(--weight-semibold); text-overflow: ellipsis; white-space: nowrap; }
.report-kpi-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: var(--radius-md); background: var(--color-primary-soft); color: var(--color-primary); }
.report-kpi-icon .ui-icon { width: 19px; height: 19px; }
.report-kpi strong,
.report-summary-chip strong { min-width: 0; color: var(--color-text); font-family: var(--font-latin); font-size: clamp(1.25rem, 2.2vw, 1.7rem); font-weight: var(--weight-extrabold); font-variant-numeric: tabular-nums; direction: ltr; overflow-wrap: anywhere; }
.report-kpi small,
.report-summary-chip small { color: var(--color-text-subtle); font-size: 10px; }
.report-kpi.green { border-top-color: var(--color-success); }
.report-kpi.green .report-kpi-icon { background: var(--color-success-soft); color: var(--color-success); }
.report-kpi.amber { border-top-color: var(--color-warning); }
.report-kpi.amber .report-kpi-icon { background: var(--color-warning-soft); color: var(--color-warning); }
.report-kpi.red { border-top-color: var(--color-danger); }
.report-kpi.red .report-kpi-icon { background: var(--color-danger-soft); color: var(--color-danger); }
.report-kpi.teal .report-kpi-icon { background: var(--color-success-soft); color: var(--color-success); }
.report-kpi.purple .report-kpi-icon { background: var(--color-primary-soft); color: var(--color-primary); }

.report-card { width: 100%; min-width: 0; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-5); box-shadow: var(--shadow-xs); }
.report-card-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.report-card-head > div { min-width: 0; }
.report-card-head h3 { margin-top: 2px; color: var(--color-text); font-size: var(--font-lg); font-weight: var(--weight-bold); }
.reports-members-count { flex: 0 0 auto; color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.report-summary-chip { display: grid; min-width: 0; gap: var(--space-1); border: 1px solid var(--border-color); border-inline-start: 3px solid var(--color-primary); border-radius: var(--radius-md); background: var(--color-surface-muted); padding: var(--space-3) var(--space-4); }
.report-summary-chip span { color: var(--color-text-muted); font-size: var(--font-xs); }
.report-summary-chip.total { border-inline-start-color: var(--color-success); }

.reports-table-wrap { width: 100%; max-width: 100%; max-height: 330px; overflow: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); direction: ltr; overscroll-behavior: contain; scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
.reports-table-wrap::-webkit-scrollbar { width: 7px; height: 7px; }
.reports-table-wrap::-webkit-scrollbar-thumb { border-radius: var(--radius-pill); background: var(--border-strong); }
.reports-table { width: 100%; min-width: 760px; table-layout: auto; direction: rtl; }
.reports-table thead th { position: sticky; top: 0; z-index: 2; background: var(--color-surface-muted); color: var(--color-text-soft); white-space: nowrap; }
.reports-table th,
.reports-table td { min-height: 62px; padding: var(--space-3) var(--space-4); text-align: center; vertical-align: middle; }
.reports-table tbody tr:nth-child(even) { background: var(--color-surface-muted); }
.reports-table tbody tr:hover { background: var(--color-primary-soft); }
.reports-table td:first-child { text-align: right; }
.reports-table td strong,
.reports-table td small { display: block; min-width: 0; }
.reports-table td strong { color: var(--color-text); font-weight: var(--weight-bold); }
.reports-table td small { margin-top: 3px; color: var(--color-text-muted); font-size: var(--font-xs); overflow-wrap: anywhere; }
.reports-table .has-debt { color: var(--color-danger); font-family: var(--font-latin); font-weight: var(--weight-bold); direction: ltr; }
.reports-table .paid { color: var(--color-success); font-family: var(--font-latin); font-weight: var(--weight-bold); direction: ltr; }

.reports-status-badge { display: inline-flex; min-height: 28px; align-items: center; justify-content: center; border: 1px solid var(--border-color); border-radius: var(--radius-pill); background: var(--color-surface-muted); color: var(--color-text-muted); padding: 0 var(--space-3); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.reports-status-badge.active,
.reports-status-badge.success,
.reports-status-badge.completed,
.reports-status-badge.paid { border-color: var(--success-border); background: var(--color-success-soft); color: var(--color-success); }
.reports-status-badge.expiring_soon,
.reports-status-badge.pending,
.reports-status-badge.draft { border-color: var(--warning-border); background: var(--color-warning-soft); color: var(--color-warning); }
.reports-status-badge.expired,
.reports-status-badge.failed,
.reports-status-badge.archived { border-color: var(--danger-border); background: var(--color-danger-soft); color: var(--color-danger); }
.reports-status-badge.frozen,
.reports-status-badge.paused { border-color: var(--info-border); background: var(--color-info-soft); color: var(--color-info); }
.reports-status-badge.transaction-badge { border-color: var(--border-focus); background: var(--color-primary-soft); color: var(--color-primary); }

.reports-debtors-table { min-width: 900px; table-layout: fixed; }
.reports-debtors-table th:nth-child(1) { width: 27%; }
.reports-debtors-table th:nth-child(2) { width: 20%; }
.reports-debtors-table th:nth-child(3) { width: 18%; }
.reports-debtors-table th:nth-child(4) { width: 35%; }
.reports-debtors-table td:last-child,
.reports-debtor-actions,
.reports-coaching-actions { white-space: nowrap; }
.reports-debtor-actions { display: inline-flex; min-width: max-content; align-items: center; justify-content: center; gap: var(--space-2); flex-wrap: nowrap; }
.reports-debtor-actions .alert-whatsapp-button { width: 38px; min-width: 38px; height: 38px; min-height: 38px; }
.reports-whatsapp-button { border-color: var(--success-border); background: var(--color-success-soft); color: var(--color-success); }
.reports-whatsapp-button:hover,
.reports-whatsapp-button:focus-visible { border-color: var(--color-success); background: var(--color-success-soft); }
.reports-no-action { color: var(--color-text-subtle); font-size: var(--font-sm); }

.reports-empty-state,
.reports-loading,
.reports-error { display: grid; min-height: 150px; place-items: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); color: var(--color-text-muted); font-size: var(--font-sm); text-align: center; }
.reports-loading { color: var(--color-primary); background: var(--color-primary-soft); }
.reports-error { border-color: var(--danger-border); background: var(--color-danger-soft); color: var(--color-danger); }

.reports-breakdown { display: grid; gap: var(--space-4); }
.breakdown-group { display: grid; gap: var(--space-2); border-bottom: 1px solid var(--border-color); padding-bottom: var(--space-3); }
.breakdown-group:last-child { border-bottom: 0; padding-bottom: 0; }
.breakdown-group h4 { color: var(--color-text); font-size: var(--font-sm); }
.breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); color: var(--color-text-muted); font-size: var(--font-sm); }
.breakdown-row strong { color: var(--color-text); font-family: var(--font-latin); direction: ltr; }
.breakdown-row small { color: var(--color-text-muted); font-size: 10px; }

.reports-timeline-wrap { display: grid; gap: var(--space-3); }
.reports-mini-chart { display: flex; min-height: 220px; align-items: end; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--border-color); padding: var(--space-3) var(--space-2) 0; direction: ltr; }
.reports-day { display: grid; min-width: 30px; height: 205px; align-items: end; justify-items: center; gap: 4px; color: var(--color-text-muted); font-size: 10px; }
.reports-day b { color: var(--color-text); font-family: var(--font-latin); font-size: 10px; }
.reports-day-bars { display: flex; width: 24px; height: 165px; align-items: end; justify-content: center; gap: 3px; }
.reports-day-bars span { display: block; width: 9px; min-height: 2px; border-radius: 5px 5px 0 0; }
.reports-day-bars .collected { height: 2%; background: var(--color-success); }
.reports-day-bars .expenses { height: 2%; background: var(--color-danger); }
.reports-chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-3); color: var(--color-text-muted); font-size: var(--font-xs); }
.reports-chart-legend span { display: inline-flex; align-items: center; gap: var(--space-1); }
.reports-chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--color-success); }
.reports-chart-legend i.expenses { background: var(--color-danger); }

@media (max-width: 1199px) {
  .reports-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .reports-filter-heading { flex-basis: 150px; }
  .reports-date-fields { flex-basis: 320px; }
  .reports-extra-filters { flex-basis: 360px; }
}

@media (max-width: 991px) {
  .reports-header { align-items: flex-start; flex-direction: column; }
  .reports-actions { width: 100%; justify-content: flex-start; }
  .reports-grid { grid-template-columns: 1fr; }
  .reports-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .reports-filter-heading,
  .reports-date-fields,
  .reports-extra-filters { grid-column: 1 / -1; }
  .reports-submit-button { grid-column: 2; }
}

@media (max-width: 767px) {
  .reports-header,
  .report-card { padding: var(--space-4); }
  .reports-heading { align-items: flex-start; }
  .reports-icon { width: 46px; height: 46px; flex-basis: 46px; }
  .reports-icon .ui-icon { width: 22px; height: 22px; }
  .reports-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-tab { min-height: 62px; flex-direction: column; gap: 4px; padding: var(--space-2); }
  .reports-tab-icon { width: 28px; height: 28px; flex-basis: 28px; }
  .reports-tab-icon .ui-icon { width: 16px; height: 16px; }
  .reports-filters { grid-template-columns: 1fr; }
  .reports-filter-heading,
  .reports-date-fields,
  .reports-extra-filters,
  .reports-submit-button { grid-column: 1; }
  .reports-submit-button { width: 100%; }
  .reports-date-fields { min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-extra-filters { display: grid; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-table-wrap { max-height: 300px; }
  .reports-table { min-width: 720px; }
  .reports-actions .btn { flex: 1 1 160px; }
}

@media (max-width: 479px) {
  .reports-date-fields,
  .reports-extra-filters { grid-template-columns: 1fr; }
  .reports-heading h2 { font-size: 1.35rem; }
  .reports-heading p { font-size: 11px; }
  .reports-tab { font-size: 11px; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/member-portal.css */
.member-portal-page {
  position: relative;
  min-height: 100dvh;
  margin: 0;
  background-color: var(--bg-app);
  background-image: linear-gradient(180deg, var(--overlay), var(--overlay)), url("/assets/gym-background.webp");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text-primary);
  font-family: var(--font-body, "Cairo", "Tahoma", sans-serif);
}

.member-portal-page .portal-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  padding: clamp(28px, 6vw, 72px) 0 48px;
}

.portal-utility-bar {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.portal-login {
  position: relative;
  overflow: hidden;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: clamp(32px, 5vw, 42px) clamp(24px, 5vw, 42px) clamp(28px, 4vw, 36px);
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 22px;
  box-shadow: var(--shadow-popup);
}

.portal-login::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  content: '';
}

.portal-login::after {
  position: absolute;
  top: -120px;
  left: -100px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: var(--primary-soft);
  content: '';
  opacity: .34;
  pointer-events: none;
}

.portal-login > * {
  position: relative;
  z-index: 1;
}

.portal-brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 16px;
  background: var(--primary);
  color: var(--text-on-primary);
  font: 800 24px/1 Inter, Arial, sans-serif;
  direction: ltr;
  box-shadow: 0 10px 22px var(--primary-soft);
}

.portal-eyebrow { margin: 0 0 4px; color: var(--primary); font: 800 13px/1.4 Inter, Arial, sans-serif; letter-spacing: .14em; direction: ltr; }
.portal-login h1, .portal-result h2 { margin: 0; color: var(--text-primary); font-size: clamp(1.8rem, 4vw, 2.3rem); font-weight: 800; }
.portal-intro { margin: 10px auto 22px; max-width: 420px; color: var(--text-muted); line-height: 1.8; }
.portal-lookup-form { display: grid; gap: 10px; text-align: right; }
.portal-lookup-form label { color: var(--text-primary); font-size: 14px; font-weight: 700; }
.portal-lookup-form input { width: 100%; height: 58px; padding: 0 18px; border: 1px solid var(--border-primary); border-radius: 13px; background: var(--bg-card); color: var(--text-primary); font: 800 18px/1 Cairo, Tahoma, sans-serif; letter-spacing: .08em; text-align: left; direction: ltr; }
.portal-lookup-form input:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px var(--primary-soft); }
.portal-security-note { display: flex; align-items: flex-start; gap: 10px; margin: 2px 0 8px; padding: 12px 14px; border: 1px solid var(--border-secondary); border-radius: 12px; background: var(--bg-card-hover); color: var(--text-secondary); text-align: right; }
.portal-security-icon { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.portal-security-icon .ui-icon { width: 18px; height: 18px; }
.portal-security-note strong, .portal-security-note small { display: block; }
.portal-security-note strong { color: var(--primary-hover); font-size: 12px; }
.portal-security-note small { margin-top: 2px; color: var(--text-muted); font-size: 11px; line-height: 1.65; }
.portal-submit { min-height: 56px; justify-content: center; gap: 10px; border: 0; border-radius: 12px; background: var(--primary); box-shadow: 0 10px 22px var(--primary-soft); font-size: 16px; font-weight: 800; }
.portal-submit:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 12px 24px var(--primary-border); transform: translateY(-1px); }
.portal-submit:active:not(:disabled) { background: var(--primary-active); transform: translateY(0); }
.portal-submit[aria-busy="true"] { cursor: wait; opacity: .82; }
.portal-spinner { display: none; width: 17px; height: 17px; border: 2px solid var(--border-secondary); border-top-color: var(--text-on-primary); border-radius: 50%; animation: portal-spin .7s linear infinite; }
.portal-submit[aria-busy="true"] .portal-spinner { display: inline-block; }
.portal-error { margin: 4px 0 0; color: var(--danger-text); font-size: 13px; font-weight: 700; }
.portal-result { padding: 32px; background: var(--bg-card); border: 1px solid var(--border-primary); border-radius: 24px; box-shadow: var(--shadow-card); }
.portal-result-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border-secondary); }
.portal-result-header h2 { margin-top: 5px; font-size: 2rem; }
.portal-result-header p:last-child { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; }
.portal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.portal-actions .btn { min-height: 44px; white-space: nowrap; }
.portal-home-view { display: block; }
.portal-occupancy-card {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) auto auto;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--border-primary);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--bg-card-hover), var(--bg-card));
  box-shadow: var(--shadow-card);
}
.portal-occupancy-summary { display: flex; min-width: 0; align-items: center; gap: 12px; }
.portal-occupancy-summary > div { min-width: 0; }
.portal-occupancy-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}
.portal-occupancy-icon .ui-icon { width: 24px; height: 24px; }
.portal-occupancy-summary h3 { margin: 3px 0 3px; color: var(--text-primary); font-size: 1.05rem; }
.portal-occupancy-summary p { margin: 0; color: var(--text-muted); font-size: 11px; line-height: 1.7; }
.portal-occupancy-reading { display: grid; min-width: 125px; gap: 2px; text-align: center; }
.portal-occupancy-reading strong { color: var(--text-primary); font-size: clamp(1.65rem, 4vw, 2.2rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.portal-occupancy-reading span { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.portal-occupancy-status { display: flex; min-width: 132px; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--border-secondary); border-radius: 12px; background: var(--bg-elevated); }
.portal-occupancy-status > div { display: grid; gap: 2px; min-width: 0; }
.portal-occupancy-status strong { color: currentColor; font-size: 12px; white-space: nowrap; }
.portal-occupancy-status small { color: var(--text-muted); font-size: 10px; line-height: 1.5; white-space: nowrap; }
.portal-occupancy-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent); }
.portal-occupancy-status.quiet { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.portal-occupancy-status.moderate { border-color: var(--warning-border); background: var(--warning-soft); color: var(--warning-text); }
.portal-occupancy-status.busy, .portal-occupancy-status.very_busy { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.portal-occupancy-status.is-loading { color: var(--text-muted); }
.portal-occupancy-status.error { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.portal-occupancy-meta { display: grid; min-width: 136px; justify-items: end; gap: 7px; }
.portal-occupancy-meta > span { color: var(--text-muted); font-size: 10px; line-height: 1.5; text-align: end; }
.portal-occupancy-refresh { min-height: 34px; padding-inline: 11px; font-size: 11px; white-space: nowrap; }
.portal-occupancy-refresh[aria-busy="true"] { cursor: wait; opacity: .7; }
.portal-occupancy-note { grid-column: 1 / -1; margin: -4px 0 0; color: var(--text-disabled); font-size: 10px; line-height: 1.6; }
.portal-view-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  background: var(--bg-card-hover);
}
.portal-view-toolbar h3 { margin: 3px 0 2px; color: var(--text-primary); font-size: 1.25rem; }
.portal-view-toolbar p:last-child { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.portal-view-toolbar .portal-eyebrow { margin-bottom: 2px; font-size: 10px; }
.portal-back-button { min-height: 44px; gap: 7px; white-space: nowrap; }
.portal-back-button > span { font-weight: 800; }
.portal-report-content { display: grid; gap: 20px; padding-top: 24px; }
.portal-member-identity { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--border-primary); border-radius: 16px; background: var(--bg-card-hover); }
.portal-member-avatar { display: grid; width: 60px; height: 60px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 22px; font-weight: 800; }
.portal-member-identity h3 { margin: 0 0 5px; font-size: 1.35rem; }
.portal-member-identity p { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }
.portal-ltr { direction: ltr; unicode-bidi: isolate; text-align: right; }
.portal-status { margin-inline-start: auto; padding: 7px 12px; border-radius: 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.portal-status.active { background: var(--success-soft); color: var(--success-text); }
.portal-status.expiring_soon { background: var(--warning-soft); color: var(--warning-text); }
.portal-status.expired { background: var(--danger-soft); color: var(--danger-text); }
.portal-status.frozen { background: var(--primary-soft); color: var(--primary-hover); }
.portal-section { display: grid; gap: 12px; }
.portal-section h3 { margin: 0; color: var(--text-primary); font-size: 1.05rem; }
.portal-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.portal-stat { min-width: 0; padding: 16px; border: 1px solid var(--border-primary); border-radius: 14px; background: var(--bg-card); }
.portal-stat small, .portal-stat span { display: block; color: var(--text-muted); font-size: 12px; }
.portal-stat strong { display: block; margin: 7px 0 4px; color: var(--text-primary); font-size: 1.1rem; overflow-wrap: anywhere; }
.portal-stat .portal-outstanding { color: var(--danger); }
.portal-table-wrap { overflow-x: auto; border: 1px solid var(--border-primary); border-radius: 14px; }
.portal-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.portal-table th, .portal-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-secondary); text-align: center; vertical-align: middle; }
.portal-table th { background: var(--bg-elevated); color: var(--text-secondary); font-size: 12px; font-weight: 800; white-space: nowrap; }
.portal-table td { color: var(--text-secondary); }
.portal-table tr:last-child td { border-bottom: 0; }
.portal-table .portal-money { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; font-weight: 800; }
.portal-table .portal-debt { color: var(--danger); }
.portal-empty { padding: 24px; border: 1px dashed var(--text-disabled); border-radius: 14px; color: var(--text-muted); text-align: center; }
.portal-report-signatures { display: grid; gap: 18px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-primary); color: var(--text-secondary); text-align: center; }
.portal-report-signatures p { margin: 0; font-weight: 700; }
.portal-ui-footer { padding-top: 18px; color: var(--text-muted); font-size: 12px; text-align: center; }

.portal-feedback {
  display: grid;
  gap: 22px;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border-primary);
  border-radius: 18px;
  background: var(--bg-card-hover);
}
.portal-feedback-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-feedback-head h3 { margin: 4px 0 4px; color: var(--text-primary); font-size: 1.25rem; }
.portal-feedback-head p:last-child { margin: 0; color: var(--text-muted); font-size: 13px; }
.portal-feedback-icon { display: grid; width: 52px; height: 52px; flex: 0 0 auto; place-items: center; border-radius: 15px; background: var(--warning-soft); color: var(--warning-text); font-size: 26px; }
.portal-feedback-form { display: grid; gap: 16px; }
.portal-feedback-form label,
.portal-rating-field legend { color: var(--text-primary); font-size: 13px; font-weight: 800; }
.portal-feedback-form label { display: grid; gap: 8px; }
.portal-feedback-form select,
.portal-feedback-form textarea { width: 100%; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-card); color: var(--text-primary); font: inherit; }
.portal-feedback-form select { height: 48px; padding: 0 14px; }
.portal-feedback-form textarea { min-height: 120px; padding: 13px 14px; line-height: 1.75; resize: vertical; }
.portal-feedback-form select:focus,
.portal-feedback-form textarea:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px var(--primary-soft); }
.portal-rating-field { display: grid; gap: 10px; min-width: 0; padding: 0; border: 0; }
.portal-stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 5px; }
.portal-stars button { display: grid; width: 40px; height: 40px; place-items: center; padding: 0; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-card); color: var(--text-disabled); font: 800 25px/1 Arial, sans-serif; cursor: pointer; transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 150ms ease; }
.portal-stars button:hover,
.portal-stars button:focus-visible,
.portal-stars button.is-selected { border-color: var(--warning); background: var(--warning-soft); color: var(--warning-text); }
.portal-stars button:hover { transform: translateY(-1px); }
.portal-stars button:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.portal-feedback-actions { display: grid; gap: 8px; }
.portal-feedback-actions .btn { min-height: 52px; justify-content: center; }
.portal-feedback-message { margin: 0; color: var(--danger-text); font-size: 13px; font-weight: 700; }
.portal-feedback-message.success { color: var(--success-text); }

@keyframes portal-spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .member-portal-page { background-attachment: scroll; }
  .member-portal-page .portal-shell { width: min(100% - 24px, 620px); padding-top: 22px; }
  .portal-login, .portal-result { padding: 22px 18px; border-radius: 20px; }
  .portal-login { margin-top: 0; }
  .portal-lookup-form input { height: 60px; }
  .portal-result-header { display: grid; gap: 16px; }
  .portal-occupancy-card { grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 16px; }
  .portal-occupancy-summary { grid-column: 1 / -1; align-items: flex-start; }
  .portal-occupancy-reading { align-self: center; }
  .portal-occupancy-status { min-width: 0; }
  .portal-occupancy-meta { min-width: 0; align-items: end; }
  .portal-occupancy-note { margin-top: -2px; }
  .portal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-actions .btn:last-child { grid-column: 1 / -1; }
  .portal-view-toolbar { grid-template-columns: 1fr; align-items: stretch; gap: 12px; }
  .portal-back-button { width: 100%; justify-content: center; }
  .portal-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-member-identity { align-items: flex-start; flex-wrap: wrap; }
  .portal-status { margin-inline-start: 76px; }
  .portal-feedback { padding: 18px; }
  .portal-feedback-head { align-items: flex-start; }
  .portal-feedback-icon { width: 44px; height: 44px; font-size: 22px; }
  .portal-stars button { width: 36px; height: 36px; font-size: 22px; }
}

@media print {
  @page { size: A4; margin: 13mm; }
  .member-portal-page { background: var(--bg-card); }
  .member-portal-page .portal-shell { width: 100%; padding: 0; }
  .member-portal-page .portal-login,
  .member-portal-page .portal-ui-footer,
  .member-portal-page [data-no-print] { display: none; }
  .member-portal-page .portal-result[hidden] { display: block; }
  .portal-result { padding: 0; border: 0; box-shadow: none; }
  .portal-result-header { padding-bottom: 14px; }
  .portal-result-header h2 { font-size: 22px; }
  .portal-report-content { padding-top: 14px; }
  .portal-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .portal-section, .portal-table-wrap, .portal-member-identity { break-inside: avoid; }
  .portal-table { min-width: 0; font-size: 10px; }
  .portal-table th, .portal-table td { padding: 6px 5px; }
  .portal-report-signatures { margin-top: 18px; }
  .portal-result::after { display: block; margin-top: 10px; color: var(--text-muted); font-size: 10px; text-align: center; content: "صفحة " counter(page); }
}

/* Shared client portal presentation for Independent Trainer tenants. */
.portal-trainer-overview {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.portal-trainer-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--color-border-soft);
  border-radius: 16px;
  background: var(--color-surface-muted);
}

.portal-trainer-identity h4 {
  margin: 3px 0 2px;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.portal-trainer-identity p { margin: 0; color: var(--text-muted); font-size: .82rem; }

.portal-trainer-mode {
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: 999px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.portal-trainer-stats { margin: 0; }
.portal-trainer-history { margin-top: 0; }

@media (max-width: 520px) {
  .portal-trainer-identity { align-items: flex-start; flex-direction: column; gap: 10px; }
  .portal-trainer-mode { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-spinner { animation: none; }
}

/* Member portal hub and interactive anatomy guide. */
.portal-tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.portal-tool-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 132px;
  align-items: flex-start;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border-primary);
  border-radius: 18px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: right;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.portal-tool-card:hover,
.portal-tool-card:focus-visible {
  border-color: var(--primary-border);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 28px var(--primary-soft);
  transform: translateY(-2px);
}

.portal-tool-card:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.portal-tool-card-print .portal-tool-icon { background: var(--primary-soft); color: var(--primary); }
.portal-tool-card-feedback .portal-tool-icon { background: var(--warning-soft); color: var(--warning-text); }
.portal-tool-card-exercises .portal-tool-icon { background: var(--success-soft); color: var(--success-text); }
.portal-tool-card-foods .portal-tool-icon { background: var(--warning-soft); color: var(--warning-text); }

.portal-tool-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
}

.portal-tool-icon .ui-icon { width: 22px; height: 22px; }
.portal-tool-card > span:nth-child(2) { display: grid; min-width: 0; gap: 5px; padding-top: 2px; }
.portal-tool-card strong { font-size: 14px; font-weight: 800; line-height: 1.4; }
.portal-tool-card small { color: var(--text-muted); font-size: 11px; line-height: 1.7; }
.portal-tool-arrow { margin-inline-start: auto; align-self: center; color: var(--text-muted); font-size: 18px; direction: ltr; }

.portal-library-section {
  position: relative;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border-primary);
  border-radius: 22px;
  background: linear-gradient(145deg, var(--bg-card), var(--bg-card-hover));
  box-shadow: var(--shadow-card);
}

.portal-library-head,
.portal-library-subhead,
.portal-library-results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.portal-library-head { padding-bottom: 18px; border-bottom: 1px solid var(--border-secondary); }
.portal-library-head h3 { margin: 4px 0; color: var(--text-primary); font-size: 1.45rem; }
.portal-library-head p { margin: 0; color: var(--text-muted); font-size: 13px; }
.portal-library-kicker { display: block; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .14em; direction: ltr; }

.portal-explorer-grid { display: grid; grid-template-columns: minmax(290px, .78fr) minmax(0, 1.55fr); gap: 20px; align-items: start; }
.portal-anatomy-card { position: sticky; top: 18px; overflow: hidden; border: 1px solid var(--border-primary); border-radius: 18px; background: var(--bg-card-hover); }
.portal-anatomy-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 18px 10px; }
.portal-anatomy-head h4 { margin: 3px 0; color: var(--text-primary); font-size: 1.08rem; }
.portal-anatomy-head p { max-width: 230px; margin: 0; color: var(--text-muted); font-size: 11px; line-height: 1.7; }
.portal-anatomy-selected { padding: 6px 9px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 800; white-space: nowrap; }
.portal-anatomy-3d-shell { position: relative; min-height: 320px; margin: 0 12px 10px; overflow: hidden; border: 1px solid var(--border-primary); border-radius: 16px; background: radial-gradient(circle at 50% 42%, var(--bg-card-hover), var(--primary-soft) 78%); }
.portal-anatomy-3d-stage { min-height: 280px; }
.portal-anatomy-canvas { width: 100%; height: 100%; min-height: 280px; touch-action: none; }
.portal-anatomy-3d-placeholder { display: grid; min-height: 280px; align-content: center; justify-items: center; gap: 8px; padding: 26px; color: var(--text-muted); text-align: center; }
.portal-anatomy-3d-placeholder strong { color: var(--text-primary); font-size: 14px; }
.portal-anatomy-3d-placeholder > span:not(.portal-anatomy-3d-badge) { max-width: 245px; font-size: 11px; line-height: 1.8; }
.portal-anatomy-3d-badge { display: grid; width: 56px; height: 56px; place-items: center; border: 1px solid var(--primary-border); border-radius: 17px; background: var(--primary-soft); color: var(--primary); font: 800 20px/1 Cairo, sans-serif; direction: ltr; box-shadow: 0 10px 24px var(--primary-soft); }
.portal-anatomy-progress { width: min(230px, 100%); height: 6px; overflow: hidden; border-radius: 999px; background: var(--info-soft); }
.portal-anatomy-progress i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 180ms ease; }
.portal-anatomy-3d-unavailable { min-height: 280px; background: linear-gradient(145deg, var(--bg-card-hover), var(--primary-soft)); }
.portal-anatomy-3d-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; padding: 0 12px 12px; }
.portal-anatomy-3d-controls button { min-height: 30px; padding: 0 9px; border: 1px solid var(--border-primary); border-radius: 8px; background: var(--bg-card); color: var(--text-secondary); font-size: 10px; font-weight: 800; cursor: pointer; }
.portal-anatomy-3d-controls button:hover, .portal-anatomy-3d-controls button:focus-visible { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-hover); }
.portal-anatomy-3d-controls button:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.portal-anatomy-fallback-view[hidden] { display: none; }
.portal-anatomy-view { position: relative; min-height: 430px; margin: 0 12px; overflow: hidden; border: 1px solid var(--border-secondary); border-radius: 16px; background: radial-gradient(circle at 50% 45%, var(--text-on-primary) 0, var(--primary-soft) 62%, var(--primary-soft) 100%); }
.portal-anatomy-glow { position: absolute; inset: 22% 15% 10%; border-radius: 50%; background: radial-gradient(circle, var(--primary-soft), transparent 67%); filter: blur(14px); }
.portal-anatomy-silhouette { position: absolute; inset: 18px 22% 10px; width: 56%; height: calc(100% - 28px); opacity: .92; }
.portal-anatomy-hotspot { --hotspot-top: 0%; --hotspot-left: 0%; position: absolute; top: var(--hotspot-top); left: var(--hotspot-left); display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 2px solid var(--text-on-primary); border-radius: 50%; background: var(--primary); color: var(--text-on-primary); box-shadow: 0 4px 12px var(--primary-soft); transform: translate(-50%, -50%); cursor: pointer; transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease; }
.portal-anatomy-hotspot:hover, .portal-anatomy-hotspot:focus-visible, .portal-anatomy-hotspot.is-active { background: var(--primary-hover); box-shadow: 0 0 0 6px var(--primary-soft), 0 5px 16px var(--primary-border); transform: translate(-50%, -50%) scale(1.12); }
.portal-anatomy-hotspot:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.portal-anatomy-hotspot span { font-size: 11px; font-weight: 800; }
.portal-anatomy-zone-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 16px; }
.portal-anatomy-zone { display: inline-flex; min-height: 34px; align-items: center; gap: 5px; padding: 0 10px; border: 1px solid var(--border-primary); border-radius: 9px; background: var(--bg-card); color: var(--text-muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.portal-anatomy-zone:hover, .portal-anatomy-zone:focus-visible, .portal-anatomy-zone.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-hover); }
.portal-anatomy-zone:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }

.portal-library-filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--border-secondary); border-radius: 14px; background: var(--bg-card); }
.portal-library-filter-bar label { display: grid; min-width: 150px; flex: 1; gap: 5px; color: var(--text-secondary); font-size: 11px; font-weight: 800; }
.portal-library-filter-bar label:first-child { min-width: min(100%, 240px); flex: 1.8; }
.portal-library-filter-bar input, .portal-library-filter-bar select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-card); color: var(--text-primary); font-size: 13px; }
.portal-library-filter-bar input:focus, .portal-library-filter-bar select:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px var(--primary-soft); }
.portal-library-subhead { margin: 4px 0 12px; }
.portal-library-subhead div { display: grid; gap: 2px; }
.portal-library-subhead strong { color: var(--text-primary); font-size: 14px; }
.portal-library-subhead span, .portal-library-selection, .portal-library-results-head span { color: var(--text-muted); font-size: 11px; }
.portal-library-selection { padding: 5px 8px; border-radius: 8px; background: var(--bg-elevated); }
.portal-muscle-chips { display: flex; max-height: 174px; flex-wrap: wrap; gap: 7px; overflow: auto; padding: 2px; }
.portal-muscle-chip { display: grid; min-height: 42px; gap: 1px; padding: 6px 10px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-card); color: var(--text-secondary); text-align: right; cursor: pointer; }
.portal-muscle-chip:hover, .portal-muscle-chip:focus-visible, .portal-muscle-chip.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-hover); }
.portal-muscle-chip:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.portal-muscle-chip span { font-size: 12px; font-weight: 800; }
.portal-muscle-chip small { direction: ltr; color: var(--text-muted); font-size: 9px; text-align: right; }
.portal-library-results-head { margin: 20px 0 10px; align-items: center; }
.portal-library-results-head h4 { margin: 0; color: var(--text-primary); font-size: 1rem; }
.portal-exercise-grid, .portal-food-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.portal-exercise-card, .portal-food-card { overflow: hidden; border: 1px solid var(--border-primary); border-radius: 15px; background: var(--bg-card); box-shadow: var(--shadow-card); }
.portal-exercise-card { display: grid; grid-template-rows: 148px 1fr; }
.portal-exercise-media { position: relative; overflow: hidden; background: var(--primary-soft); }
.portal-exercise-media img { width: 100%; height: 100%; object-fit: cover; }
.portal-exercise-media .portal-library-image-fallback { display: grid; width: 100%; height: 100%; place-items: center; color: var(--primary); font-size: 36px; }
.portal-exercise-phase { position: absolute; right: 9px; bottom: 8px; padding: 4px 7px; border-radius: 7px; background: var(--overlay); color: var(--text-on-primary); font-size: 10px; }
.portal-exercise-body, .portal-food-card { padding: 13px; }
.portal-exercise-title, .portal-food-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.portal-exercise-title h5, .portal-food-title h5 { margin: 0; color: var(--text-primary); font-size: 13px; line-height: 1.5; }
.portal-exercise-title small, .portal-food-title small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 9px; direction: ltr; }
.portal-exercise-icon { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--primary-soft); font-size: 16px; }
.portal-exercise-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.portal-exercise-tags span, .portal-food-title > span, .portal-detail-tags span { padding: 4px 7px; border-radius: 6px; background: var(--bg-elevated); color: var(--text-muted); font-size: 10px; }
.portal-exercise-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 11px; color: var(--text-muted); font-size: 10px; }
.portal-library-details-button { width: 100%; min-height: 38px; justify-content: center; border-radius: 9px; color: var(--primary); font-size: 11px; font-weight: 800; }
.portal-food-card { display: grid; gap: 11px; }
.portal-food-symbol { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: var(--warning-soft); font-size: 24px; }

.portal-food-media-wrap { height: 142px; overflow: hidden; background: linear-gradient(145deg, #dcecff, #f6fbff); }
.portal-food-media { display: block; width: 100%; height: 100%; }
.portal-food-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portal-food-media.is-fallback img { display: none; }
html[data-theme="dark"] .portal-food-media-wrap { background: linear-gradient(145deg, #1a3658, #0e2038); }
.portal-food-title > span { background: var(--warning-soft); color: var(--warning-text); white-space: nowrap; }
.portal-food-calories { display: flex; align-items: baseline; gap: 6px; padding: 10px; border-radius: 10px; background: var(--bg-elevated); }
.portal-food-calories strong { color: var(--text-primary); font-size: 22px; font-weight: 800; }
.portal-food-calories span { color: var(--text-muted); font-size: 10px; }
.portal-macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.portal-macro-grid span { display: grid; gap: 2px; padding: 7px 4px; border: 1px solid var(--border-secondary); border-radius: 8px; text-align: center; }
.portal-macro-grid b { color: var(--primary); font-size: 12px; direction: ltr; }
.portal-macro-grid small { color: var(--text-muted); font-size: 9px; }
.portal-library-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; color: var(--text-muted); font-size: 11px; }
.portal-library-pagination > div { display: flex; gap: 6px; }
.portal-library-pagination .btn { min-height: 36px; padding: 0 11px; font-size: 11px; }
.portal-library-state { display: grid; min-height: 150px; align-content: center; justify-items: center; gap: 6px; padding: 24px; color: var(--text-muted); text-align: center; }
.portal-library-state strong { color: var(--text-secondary); font-size: 14px; }
.portal-library-state span { font-size: 12px; }
.portal-library-state-wide { grid-column: 1 / -1; min-height: 190px; border: 1px dashed var(--text-disabled); border-radius: 14px; background: var(--bg-card); }
.portal-library-error { color: var(--danger-text); }
.portal-library-error strong { color: var(--danger-text); }
.portal-library-loader { width: 24px; height: 24px; border: 3px solid var(--info-soft); border-top-color: var(--primary); border-radius: 50%; animation: portal-spin .7s linear infinite; }
.portal-library-content.is-loading { opacity: .62; pointer-events: none; }

.portal-library-modal { position: fixed; z-index: 90; inset: 0; display: grid; overflow: auto; place-items: center; padding: 18px; background: var(--overlay); }
.portal-library-modal-card { width: min(860px, 100%); max-height: min(88dvh, 820px); overflow: auto; border: 1px solid var(--border-primary); border-radius: 20px; background: var(--bg-card); box-shadow: var(--shadow-popup); }
.portal-library-modal-card > header { position: sticky; z-index: 1; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border-secondary); background: var(--bg-card); }
.portal-library-modal-card > header h3 { margin: 4px 0 0; color: var(--text-primary); font-size: 1.2rem; }
.portal-library-modal-close { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-card); color: var(--text-muted); font-size: 25px; line-height: 1; cursor: pointer; }
.portal-library-modal-close:hover, .portal-library-modal-close:focus-visible { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.portal-library-modal-close:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
#portalLibraryModalContent { display: grid; gap: 18px; padding: 20px; }
.portal-detail-hero { display: grid; grid-template-columns: minmax(250px, .9fr) 1.1fr; gap: 20px; align-items: center; }
.portal-detail-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.portal-detail-image { width: 100%; min-height: 180px; object-fit: cover; border-radius: 12px; background: var(--primary-soft); }
.portal-detail-hero h4, .portal-food-detail-hero h4 { margin: 6px 0; color: var(--text-primary); font-size: 1.35rem; }
.portal-detail-hero p, .portal-food-detail-hero p { margin: 0; color: var(--text-muted); font-size: 12px; }
.portal-detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.portal-detail-tags span { background: var(--primary-soft); color: var(--primary); }
.portal-detail-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.portal-detail-stat-grid span { display: grid; gap: 3px; padding: 12px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--bg-card-hover); text-align: center; }
.portal-detail-stat-grid b { color: var(--text-primary); font-size: 15px; direction: ltr; }
.portal-detail-stat-grid small { color: var(--text-muted); font-size: 10px; }
.portal-detail-copy { display: grid; gap: 14px; }
.portal-detail-copy > p { margin: 0; padding: 12px; border-radius: 10px; background: var(--bg-elevated); color: var(--text-secondary); line-height: 1.8; }
.portal-detail-block { padding: 13px; border: 1px solid var(--border-secondary); border-radius: 12px; background: var(--bg-card); }
.portal-detail-block h4 { margin: 0 0 8px; color: var(--text-primary); font-size: 13px; }
.portal-detail-block ul { display: grid; gap: 6px; margin: 0; padding-inline-start: 18px; list-style: disc; color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.portal-detail-muted { margin: 0; color: var(--text-muted); font-size: 12px; }
.portal-food-detail-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--warning-soft); }
.portal-food-detail-icon { display: grid; width: 64px; height: 64px; flex: 0 0 auto; place-items: center; border-radius: 18px; background: var(--bg-card); font-size: 32px; }
.portal-food-detail-hero > div > span:last-child { display: block; margin-top: 8px; color: var(--warning-text); font-size: 11px; }
.portal-food-detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.portal-food-detail-grid div { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--border-primary); border-radius: 11px; background: var(--bg-card); }
.portal-food-detail-grid span { color: var(--text-muted); font-size: 11px; }
.portal-food-detail-grid strong { color: var(--text-primary); font-size: 14px; font-weight: 800; }

@media (max-width: 1040px) {
  .portal-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-explorer-grid { grid-template-columns: 1fr; }
  .portal-anatomy-card { position: relative; top: auto; }
  .portal-anatomy-view { min-height: 360px; }
  .portal-anatomy-3d-shell { min-height: 290px; }
  .portal-anatomy-3d-stage, .portal-anatomy-canvas, .portal-anatomy-3d-placeholder { min-height: 245px; }
  .portal-anatomy-silhouette { inset-inline: 36%; width: 28%; }
}

@media (max-width: 640px) {
  .portal-library-section { padding: 16px 12px; border-radius: 18px; }
  .portal-tool-grid { grid-template-columns: 1fr; gap: 9px; }
  .portal-tool-card { min-height: 92px; padding: 14px; }
  .portal-library-head { display: grid; }
  .portal-library-head .btn { width: 100%; justify-content: center; }
  .portal-library-filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .portal-library-filter-bar label, .portal-library-filter-bar label:first-child { min-width: 0; }
  .portal-library-filter-bar label:first-child { grid-column: 1 / -1; }
  .portal-exercise-grid, .portal-food-grid { grid-template-columns: 1fr; }
  .portal-anatomy-view { min-height: 390px; }
  .portal-anatomy-3d-shell { min-height: 270px; }
  .portal-anatomy-3d-stage, .portal-anatomy-canvas, .portal-anatomy-3d-placeholder { min-height: 225px; }
  .portal-anatomy-silhouette { inset-inline: 30%; width: 40%; }
  .portal-anatomy-hotspot { width: 26px; height: 26px; }
  .portal-detail-hero { grid-template-columns: 1fr; }
  .portal-detail-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-food-detail-grid { grid-template-columns: repeat(2, 1fr); }
  #portalLibraryModalContent { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-tool-card, .portal-anatomy-hotspot { transition: none; }
  .portal-library-loader { animation: none; }
}

/* Member record isolation -------------------------------------------------
   The portal shows one code-scoped member at a time. Keep the identity,
   current membership, financial summary and historical ledgers in separate
   blocks so long names, dates or extra rows cannot collide with a neighbour. */
.portal-report-content,
.portal-section,
.portal-member-copy,
.portal-membership-overview-head > div { min-width: 0; }

.portal-member-identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  background: var(--bg-card-hover);
}

.portal-member-primary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.portal-member-copy { display: grid; gap: 4px; }
.portal-member-copy h3 { min-width: 0; margin: 0 0 3px; overflow-wrap: anywhere; font-size: 1.25rem; }
.portal-member-copy p { min-width: 0; margin: 0; }
.portal-member-contact { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 9px; color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.portal-member-contact span { color: var(--text-disabled); font-size: 10px; font-weight: 700; }
.portal-member-contact b { min-width: 0; color: var(--text-secondary); font-weight: 700; overflow-wrap: anywhere; }
.portal-member-status-block { display: grid; min-width: 112px; align-content: center; justify-items: end; gap: 6px; }
.portal-member-status-block > span:first-child { color: var(--text-muted); font-size: 10px; font-weight: 700; }
.portal-member-status-block .portal-status { margin: 0; }
.portal-ltr { min-width: 0; overflow-wrap: anywhere; }

.portal-membership-overview {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--primary-border);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--bg-card-hover), var(--bg-card));
}

.portal-membership-overview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; min-width: 0; }
.portal-membership-overview-head h3 { margin: 3px 0 2px; color: var(--text-primary); font-size: 1.12rem; }
.portal-membership-overview-head p { margin: 0; color: var(--text-muted); font-size: 11px; line-height: 1.7; }
.portal-membership-scope { display: inline-flex; min-width: 0; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid var(--border-secondary); border-radius: 9px; background: var(--bg-card); color: var(--text-secondary); font-size: 11px; font-weight: 800; overflow-wrap: anywhere; }
.portal-membership-scope > span { color: var(--primary); font-size: 14px; line-height: 1; }
.portal-membership-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; min-width: 0; }
.portal-membership-fact { display: grid; min-width: 0; gap: 5px; padding: 12px; border: 1px solid var(--border-secondary); border-radius: 11px; background: var(--bg-card); }
.portal-membership-fact > span { color: var(--text-muted); font-size: 10px; font-weight: 700; }
.portal-membership-fact strong { min-width: 0; color: var(--text-primary); font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.portal-membership-fact small { min-width: 0; color: var(--text-muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.portal-membership-fact-featured { border-color: var(--primary-border); background: var(--primary-soft); }
.portal-membership-fact-featured strong { color: var(--primary-hover); }

.portal-financial-grid { min-width: 0; }
.portal-section { gap: 11px; padding: 16px; border: 1px solid var(--border-secondary); border-radius: 16px; background: var(--bg-card-hover); }
.portal-section-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; }
.portal-section-heading h3 { margin: 2px 0 0; overflow-wrap: anywhere; }
.portal-section-kicker { display: block; color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .12em; direction: ltr; }
.portal-section-count { flex: 0 0 auto; padding: 5px 8px; border-radius: 8px; background: var(--bg-elevated); color: var(--text-muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.portal-table-wrap { min-width: 0; }
.portal-table td { min-width: 0; overflow-wrap: anywhere; }
.portal-table-cell-value { display: block; min-width: 0; overflow-wrap: anywhere; }
.portal-table td small { display: block; margin-top: 3px; color: var(--text-muted); line-height: 1.55; overflow-wrap: anywhere; }
.portal-membership-history .portal-table-wrap { border-color: var(--primary-border); }

@media (max-width: 760px) {
  .portal-member-identity { grid-template-columns: 1fr; align-items: stretch; gap: 14px; padding: 16px; }
  .portal-member-primary { align-items: flex-start; }
  .portal-member-status-block { justify-items: start; }
  .portal-member-status-block .portal-status { margin: 0; }
  .portal-membership-overview { padding: 16px; }
  .portal-membership-overview-head { display: grid; gap: 10px; }
  .portal-membership-scope { justify-self: start; }
  .portal-membership-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-section { padding: 13px; }
  .portal-section-heading { align-items: flex-start; }
  .portal-table-wrap { overflow: visible; border: 0; }
  .portal-table { display: block; width: 100%; min-width: 0; }
  .portal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .portal-table tbody { display: grid; gap: 9px; }
  .portal-table tr { display: grid; gap: 0; padding: 8px 11px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-card); }
  .portal-table td { display: grid; grid-template-columns: minmax(88px, .42fr) minmax(0, 1fr); align-items: start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-secondary); text-align: start; }
  .portal-table td:last-child { border-bottom: 0; }
  .portal-table td::before { color: var(--text-muted); content: attr(data-label); font-size: 10px; font-weight: 800; line-height: 1.6; }
  .portal-table td > * { min-width: 0; }
  .portal-table td.portal-ltr { direction: rtl; text-align: start; }
  .portal-table .portal-table-cell-value.portal-ltr { direction: ltr; text-align: start; justify-self: start; }
  .portal-table .portal-status { margin: 0; justify-self: start; }
  .portal-table .portal-money { justify-self: start; text-align: start; }
  .portal-table .portal-ltr { direction: ltr; text-align: start; }
}

@media (max-width: 420px) {
  .portal-occupancy-card { grid-template-columns: 1fr; }
  .portal-occupancy-reading, .portal-occupancy-status, .portal-occupancy-meta { width: 100%; }
  .portal-occupancy-reading { grid-template-columns: auto 1fr; align-items: baseline; justify-content: start; gap: 7px; text-align: start; }
  .portal-occupancy-status { justify-content: start; }
  .portal-occupancy-meta { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .portal-occupancy-meta > span { text-align: start; }
  .portal-membership-facts { grid-template-columns: 1fr; }
  .portal-member-primary { gap: 11px; }
  .portal-member-avatar { width: 52px; height: 52px; font-size: 19px; }
  .portal-section-heading { display: grid; gap: 7px; }
  .portal-section-count { justify-self: start; }
}

/* Tenant-scoped membership request flow. */
.portal-tool-card-subscription .portal-tool-icon { background: var(--info-soft); color: var(--info-text); }
.portal-activation-celebration {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  margin-bottom: 2px;
  padding: 16px 18px;
  border: 1px solid var(--success-border);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--success-soft), var(--bg-card));
  color: var(--text-primary);
}
.portal-activation-celebration::before,
.portal-activation-celebration::after { position: absolute; width: 90px; height: 90px; border-radius: 50%; content: ''; pointer-events: none; }
.portal-activation-celebration::before { inset: -42px auto auto -26px; background: var(--success-soft); }
.portal-activation-celebration::after { inset: auto -34px -48px auto; border: 1px solid var(--success-border); }
.portal-activation-spark { position: absolute; z-index: 1; width: 6px; height: 6px; border-radius: 2px; background: var(--success-text); transform: rotate(35deg); opacity: .75; }
.portal-activation-spark-one { inset: 17px 24%; }
.portal-activation-spark-two { inset: auto 12% 18px; width: 5px; height: 5px; background: var(--primary); transform: rotate(18deg); }
.portal-activation-badge { position: relative; z-index: 2; display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 15px; background: var(--success); color: var(--text-on-primary); box-shadow: 0 8px 20px var(--success-border); }
.portal-activation-badge .ui-icon { width: 25px; height: 25px; }
.portal-activation-copy { position: relative; z-index: 2; min-width: 0; }
.portal-activation-copy h3 { margin: 3px 0 4px; color: var(--text-primary); font-size: 1.15rem; }
.portal-activation-copy p { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.portal-activation-celebration > .btn { position: relative; z-index: 2; white-space: nowrap; }
.portal-activation-celebration.is-visible { animation: portalActivationIn 420ms ease both; }
.portal-activation-celebration.is-visible .portal-activation-badge { animation: portalActivationBadge 640ms ease both; }
@keyframes portalActivationIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes portalActivationBadge { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.08) rotate(-3deg); } }
.portal-subscription {
  display: grid;
  gap: 20px;
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--border-primary);
  border-radius: 22px;
  background: linear-gradient(145deg, var(--bg-card), var(--bg-card-hover));
  box-shadow: var(--shadow-card);
}
.portal-subscription-head,
.portal-subsection-heading,
.portal-subscription-actions,
.portal-payment-method-row,
.portal-request-history-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.portal-subscription-head h3,
.portal-subsection-heading h4 { margin: 4px 0; color: var(--text-primary); }
.portal-subscription-head h3 { font-size: 1.35rem; }
.portal-subscription-head p,
.portal-subsection-heading p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.75; }
.portal-subscription-secure { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 15px; background: var(--success-soft); color: var(--success-text); }
.portal-subscription-secure .ui-icon { width: 24px; height: 24px; }
.portal-subscription-form { display: grid; gap: 18px; }
.portal-subscription-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.portal-subscription-grid label,
.portal-subscription-notes { display: grid; gap: 8px; color: var(--text-primary); font-size: 12px; font-weight: 800; }
.portal-subscription-grid select,
.portal-subscription-grid input,
.portal-subscription-notes textarea { width: 100%; min-width: 0; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-card); color: var(--text-primary); font: inherit; }
.portal-subscription-grid select,
.portal-subscription-grid input { height: 46px; padding: 0 12px; }
.portal-subscription-notes textarea { padding: 12px; line-height: 1.7; resize: vertical; }
.portal-subscription-grid select:focus,
.portal-subscription-grid input:focus,
.portal-subscription-notes textarea:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px var(--primary-soft); }
.portal-subscription-grid select:disabled { opacity: 1; cursor: not-allowed; background: var(--bg-elevated); color: var(--text-primary); }
.portal-subscription-grid label > small { color: var(--text-muted); font-size: 10px; font-weight: 600; line-height: 1.6; }
.portal-subscription-grid label > small.is-blocked { color: var(--danger-text); }
.portal-payment-methods,
.portal-request-history { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border-secondary); border-radius: 16px; background: var(--bg-elevated); }
.portal-payment-method-list,
.portal-request-history-list { display: grid; gap: 9px; }
.portal-payment-method-row { align-items: center; padding: 12px; border: 1px solid var(--border-primary); border-radius: 13px; background: var(--bg-card); cursor: pointer; }
.portal-payment-method-row:hover,
.portal-payment-method-row:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.portal-payment-method-row input { accent-color: var(--primary); }
.portal-payment-method-copy { display: grid; min-width: 0; flex: 1; gap: 3px; }
.portal-payment-method-copy strong { color: var(--text-primary); font-size: 13px; }
.portal-payment-method-copy small { color: var(--text-muted); font-size: 11px; line-height: 1.65; }
.portal-payment-method-account { direction: ltr; color: var(--text-secondary); font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.portal-subscription-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 14px; border: 1px solid var(--primary-border); border-radius: 14px; background: var(--primary-soft); }
.portal-subscription-summary div { display: grid; gap: 4px; min-width: 0; }
.portal-subscription-summary span { color: var(--text-muted); font-size: 10px; font-weight: 700; }
.portal-subscription-summary strong { color: var(--text-primary); font-size: 13px; overflow-wrap: anywhere; }
.portal-subscription-summary div:last-child strong { color: var(--primary); font-size: 1.1rem; }
.portal-proof-picker { display: flex; min-width: 0; align-items: center; gap: 12px; padding: 14px; border: 1px dashed var(--primary-border); border-radius: 14px; background: var(--bg-card); color: var(--text-primary); cursor: pointer; }
.portal-proof-picker:hover { border-color: var(--primary); background: var(--primary-soft); }
.portal-proof-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.portal-proof-picker-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.portal-proof-picker > span:nth-child(2) { display: grid; min-width: 0; gap: 3px; }
.portal-proof-picker strong { font-size: 12px; }
.portal-proof-picker small { color: var(--text-muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.portal-subscription-actions { align-items: center; }
.portal-subscription-actions .btn { min-height: 50px; justify-content: center; }
.portal-subscription-note { color: var(--text-muted); font-size: 11px; line-height: 1.7; }
.portal-subscription-feedback { margin: 0; padding: 11px 13px; border-radius: 11px; font-size: 12px; font-weight: 800; }
.portal-subscription-feedback.success { background: var(--success-soft); color: var(--success-text); }
.portal-subscription-feedback.error { background: var(--danger-soft); color: var(--danger-text); }
.portal-subscription-state { padding: 15px; border-radius: 12px; background: var(--bg-card); color: var(--text-muted); text-align: center; font-size: 12px; }
.portal-request-history-row { align-items: center; padding: 12px; border: 1px solid var(--border-primary); border-radius: 12px; background: var(--bg-card); }
.portal-request-history-copy { display: grid; min-width: 0; gap: 3px; }
.portal-request-history-copy strong { color: var(--text-primary); font-size: 12px; }
.portal-request-history-copy small { color: var(--text-muted); font-size: 11px; }
.portal-request-history-copy .portal-request-history-review { display: grid; gap: 2px; margin-top: 4px; padding: 7px 9px; border-inline-start: 3px solid var(--danger-text); border-radius: 8px; background: var(--danger-soft); color: var(--danger-text); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.portal-request-history-copy .portal-request-history-review strong { color: var(--danger-text); font-size: 10px; }
.portal-request-history-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.portal-request-history-actions .btn { min-height: 32px; padding-inline: 10px; font-size: 10px; white-space: nowrap; }
.portal-request-history-status { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: var(--warning-soft); color: var(--warning-text); font-size: 10px; font-weight: 800; }
.portal-request-history-status.approved { background: var(--success-soft); color: var(--success-text); }
.portal-request-history-status.rejected,
.portal-request-history-status.cancelled { background: var(--danger-soft); color: var(--danger-text); }

@media (max-width: 640px) {
  .portal-activation-celebration { grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: 15px 14px; }
  .portal-activation-celebration > .btn { grid-column: 1 / -1; width: 100%; }
  .portal-subscription { padding: 18px 14px; }
  .portal-subscription-grid,
  .portal-subscription-summary { grid-template-columns: 1fr; }
  .portal-subscription-actions { display: grid; align-items: stretch; }
  .portal-subscription-actions .btn { width: 100%; }
  .portal-payment-method-row,
  .portal-request-history-row { align-items: flex-start; }
  .portal-request-history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
  }
  .portal-request-history-copy { gap: 6px; }
  .portal-request-history-copy strong { font-size: 13px; line-height: 1.7; }
  .portal-request-history-copy small { font-size: 11px; line-height: 1.75; overflow-wrap: anywhere; }
  .portal-request-history-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    align-items: center;
    justify-content: initial;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-secondary);
  }
  .portal-request-history-status { justify-self: start; }
  .portal-request-history-actions .btn { min-height: 40px; justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-activation-celebration.is-visible,
  .portal-activation-celebration.is-visible .portal-activation-badge { animation: none; }
}

@media print {
  .portal-member-identity { grid-template-columns: minmax(0, 1fr) auto; }
  .portal-membership-overview,
  .portal-section { break-inside: avoid; }
  .portal-table-wrap { overflow: visible; border: 1px solid var(--border-primary); }
  .portal-table { display: table; min-width: 0; }
  .portal-table thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; white-space: normal; }
  .portal-table tbody { display: table-row-group; }
  .portal-table tr { display: table-row; padding: 0; border: 0; background: transparent; }
  .portal-table td { display: table-cell; grid-template-columns: none; gap: 0; padding: 6px 5px; border-bottom: 1px solid var(--border-secondary); text-align: center; }
  .portal-table td::before { content: none; }
}

/* Portal result surface: a calm, readable member hub with one clear visual
   hierarchy for identity, live occupancy and the four available services. */
.member-portal-page {
  overflow-x: hidden;
}

.member-portal-page .portal-shell {
  width: min(1180px, calc(100% - 40px));
  padding-block: clamp(24px, 4vw, 48px) 30px;
}

.member-portal-page .portal-result {
  overflow: hidden;
  padding: clamp(22px, 3vw, 34px);
  border-color: var(--border-primary);
  background: color-mix(in srgb, var(--bg-card) 96%, transparent);
}

.portal-result-header {
  min-width: 0;
  align-items: center;
  gap: 18px;
  padding-bottom: 20px;
}

.portal-result-header > div:first-child {
  min-width: 0;
}

.portal-result-header h2 {
  margin-top: 3px;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  letter-spacing: -.02em;
}

.portal-result-header p:last-child {
  max-width: 520px;
  line-height: 1.7;
}

.portal-actions {
  flex: 0 0 auto;
  align-items: center;
}

.portal-actions .btn {
  min-height: 42px;
  padding-inline: 14px;
}

.portal-occupancy-card {
  grid-template-columns: minmax(0, 1.45fr) minmax(112px, .42fr) minmax(182px, .72fr);
  gap: 14px;
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 16px;
  box-shadow: none;
}

.portal-occupancy-summary {
  gap: 11px;
}

.portal-occupancy-summary h3 {
  font-size: 1rem;
}

.portal-occupancy-summary p {
  max-width: 460px;
}

.portal-occupancy-reading {
  min-width: 0;
  padding-inline: 8px;
}

.portal-occupancy-reading strong {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.portal-occupancy-status {
  min-width: 0;
}

.portal-occupancy-status small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-occupancy-meta {
  min-width: 0;
}

.portal-occupancy-meta > span {
  max-width: 220px;
}

.portal-tool-grid {
  gap: 14px;
  margin-top: 18px;
}

.portal-tool-card {
  min-height: 118px;
  align-items: center;
  gap: 11px;
  padding: 16px;
  border-radius: 16px;
  box-shadow: none;
}

.portal-tool-card > span:nth-child(2) {
  gap: 4px;
}

.portal-tool-card strong {
  font-size: 13px;
}

.portal-tool-card small {
  line-height: 1.6;
}

.portal-tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.portal-report-content,
.portal-feedback,
.portal-library-section {
  margin-top: 20px;
}

@media (max-width: 980px) {
  .member-portal-page .portal-shell {
    width: min(100% - 28px, 760px);
  }

  .portal-occupancy-card {
    grid-template-columns: minmax(0, 1fr) minmax(120px, .45fr);
  }

  .portal-occupancy-summary {
    grid-column: 1 / -1;
  }

  .portal-occupancy-meta {
    justify-items: end;
  }
}

@media (max-width: 760px) {
  .member-portal-page .portal-shell {
    width: min(100% - 22px, 620px);
    padding-block: 18px 22px;
  }

  .member-portal-page .portal-result {
    padding: 18px 14px 20px;
    border-radius: 20px;
  }

  .portal-result-header {
    gap: 14px;
    padding-bottom: 16px;
  }

  .portal-result-header h2 {
    font-size: 1.8rem;
  }

  .portal-actions {
    width: 100%;
  }

  .portal-actions .btn {
    flex: 1 1 auto;
  }

  .portal-occupancy-card {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px;
  }

  .portal-occupancy-summary {
    grid-column: 1 / -1;
  }

  .portal-occupancy-status {
    min-width: 0;
  }

  .portal-occupancy-meta {
    min-width: 0;
    justify-items: end;
  }

  .portal-occupancy-meta > span {
    max-width: 150px;
  }

  .portal-tool-grid {
    gap: 10px;
  }

  .portal-tool-card {
    min-height: 92px;
    padding: 13px;
  }
}

@media (max-width: 420px) {
  .portal-occupancy-card {
    grid-template-columns: 1fr;
  }

  .portal-occupancy-summary,
  .portal-occupancy-reading,
  .portal-occupancy-status,
  .portal-occupancy-meta {
    width: 100%;
  }

  .portal-occupancy-reading,
  .portal-occupancy-status,
  .portal-occupancy-meta {
    justify-items: start;
    text-align: start;
  }

  .portal-occupancy-status {
    justify-content: start;
  }

  .portal-occupancy-meta {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .portal-occupancy-meta > span {
    max-width: none;
  }
}

/* Subscription request surface -------------------------------------------
   The request flow keeps its existing markup and hooks, but uses a denser
   review-oriented composition: details first, payment and quote side by side,
   then proof and notes. This keeps the reference hierarchy without changing
   the submission flow or any data contract. */
.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) {
  width: min(1180px, calc(100% - 32px));
  padding: clamp(18px, 2.8vw, 30px);
  border-radius: 24px;
  background: color-mix(in srgb, var(--bg-card) 94%, var(--primary-soft));
  box-shadow: var(--shadow-popup);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) > .portal-result-header {
  min-height: 0;
  justify-content: flex-start;
  padding: 0;
  border-bottom: 0;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) > .portal-result-header > div:first-child {
  display: none;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-actions {
  width: auto;
  margin-inline-start: auto;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-actions .btn {
  min-height: 36px;
  padding-inline: 12px;
  font-size: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-view-toolbar {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: flex-start;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-secondary);
  border-radius: 16px;
  background: var(--bg-elevated);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-view-toolbar > div {
  display: none;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-back-button {
  margin-inline-start: auto;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription {
  gap: 14px;
  margin-top: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-head {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 17px 18px;
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-head > div {
  min-width: 0;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-head h3 {
  margin: 3px 0 4px;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -.02em;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-head p {
  max-width: 720px;
  line-height: 1.65;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-secure {
  width: 44px;
  height: 44px;
  order: -1;
  border: 1px solid var(--primary-border);
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-secure .ui-icon {
  width: 22px;
  height: 22px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "details details"
    "methods summary"
    "proof notes"
    "actions actions";
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-grid {
  grid-area: details;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-grid label,
.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-notes {
  gap: 6px;
  font-size: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-grid select,
.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-grid input {
  height: 44px;
  border-radius: 10px;
  font-size: 12px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-grid label > small {
  min-height: 0;
  font-size: 9px;
  line-height: 1.55;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-methods,
.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary,
.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-notes,
.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-proof-picker {
  min-width: 0;
  margin: 0;
  border-radius: 13px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-methods {
  grid-area: methods;
  gap: 10px;
  padding: 13px;
  border-color: var(--border-secondary);
  background: var(--bg-elevated);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subsection-heading {
  gap: 10px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subsection-heading h4 {
  margin: 2px 0 3px;
  font-size: 1rem;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subsection-heading p {
  font-size: 10px;
  line-height: 1.55;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-method-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-method-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 64px;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-method-copy {
  gap: 2px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-method-copy strong {
  font-size: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-method-copy small,
.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-method-account {
  font-size: 10px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary {
  grid-area: summary;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: stretch;
  gap: 1px;
  padding: 10px;
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary div {
  min-height: 56px;
  align-content: center;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--primary-border) 46%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-card) 68%, transparent);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary span {
  font-size: 9px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary strong {
  font-size: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary div:last-child strong {
  font-size: 1rem;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-notes {
  grid-area: notes;
  align-content: start;
  padding: 13px;
  border: 1px solid var(--border-secondary);
  border-radius: 13px;
  background: var(--bg-elevated);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-notes textarea {
  min-height: 94px;
  border-radius: 10px;
  font-size: 11px;
  resize: vertical;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-proof-picker {
  grid-area: proof;
  align-items: center;
  min-height: 120px;
  padding: 13px;
  border-color: var(--primary-border);
  background: var(--bg-elevated);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-proof-picker-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-proof-picker strong {
  font-size: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-proof-picker small {
  font-size: 10px;
  line-height: 1.55;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-actions {
  grid-area: actions;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-secondary);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-actions .btn {
  width: min(100%, 330px);
  min-height: 48px;
  justify-content: center;
  border-radius: 11px;
  font-size: 12px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-note {
  max-width: 420px;
  font-size: 10px;
  line-height: 1.65;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history {
  gap: 10px;
  margin: 0;
  padding: 14px;
  border-color: var(--border-primary);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history-list {
  gap: 8px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history-row {
  min-width: 0;
  align-items: center;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--bg-elevated);
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history-copy strong {
  font-size: 11px;
}

.member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history-copy small {
  font-size: 10px;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) {
    width: min(100% - 24px, 760px);
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "details"
      "methods"
      "summary"
      "proof"
      "notes"
      "actions";
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) {
    width: min(100% - 16px, 620px);
    padding: 14px 10px 16px;
    border-radius: 18px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-view-toolbar {
    margin-top: 8px;
    padding: 11px 12px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-head {
    align-items: flex-start;
    padding: 14px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-head h3 {
    font-size: 1.18rem;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-form {
    gap: 10px;
    padding: 12px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-payment-method-list {
    grid-template-columns: 1fr;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-proof-picker {
    min-height: 100px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-actions {
    display: grid;
    align-items: stretch;
    gap: 8px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-actions .btn {
    width: 100%;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-note {
    max-width: none;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history-actions {
    justify-content: space-between;
    padding-top: 9px;
    border-top: 1px solid var(--border-secondary);
  }
}

@media (max-width: 420px) {
  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary div {
    min-height: 52px;
    padding-inline: 7px;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-summary strong {
    font-size: 10px;
  }
}

@media print {
  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) {
    width: 100%;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-form,
  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-subscription-head,
  .member-portal-page .portal-result:has(#portalSubscriptionSection:not([hidden])) .portal-request-history {
    box-shadow: none;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/member-feedback.css */
.member-feedback-section { display: grid; gap: var(--space-6); }
.member-feedback-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); padding-bottom: var(--space-5); border-bottom: 1px solid var(--border-color); }
.member-feedback-heading { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.member-feedback-heading-icon { display: grid; width: 54px; height: 54px; flex: 0 0 auto; place-items: center; border-radius: var(--radius-lg); background: var(--color-warning-soft); color: var(--color-warning); }
.member-feedback-heading-icon .ui-icon { width: 26px; height: 26px; }
.member-feedback-kicker { display: block; color: var(--color-primary); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.member-feedback-heading h3 { margin: 3px 0 4px; color: var(--color-text); font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
.member-feedback-heading p { margin: 0; color: var(--color-text-muted); font-size: var(--font-sm); }
.member-feedback-filters { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)) auto; align-items: end; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface-muted); }
.member-feedback-filters label { display: grid; gap: 6px; color: var(--color-text-soft); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.member-feedback-filters input,
.member-feedback-filters select { width: 100%; height: 44px; padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); font: inherit; }
.member-feedback-filters input:focus,
.member-feedback-filters select:focus { border-color: var(--border-focus); outline: 0; box-shadow: var(--focus-ring); }
.member-feedback-filters .member-feedback-search { min-width: 180px; }
.member-feedback-meta { color: var(--color-text-muted); font-size: var(--font-sm); font-weight: var(--weight-semibold); }
.member-feedback-table-wrap { min-width: 0; overflow: hidden; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--color-surface); }
.member-feedback-table-scroll { max-width: 100%; overflow-x: auto; direction: ltr; scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
.member-feedback-table { width: 100%; min-width: 980px; border-collapse: separate; border-spacing: 0; table-layout: fixed; direction: rtl; }
.member-feedback-table th,
.member-feedback-table td { height: 72px; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-color); text-align: center; vertical-align: middle; }
.member-feedback-table th { padding: var(--space-3) var(--space-4); text-align: center; vertical-align: middle; }
.member-feedback-table th { background: var(--color-surface-muted); color: var(--color-text-soft); font-size: var(--font-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.member-feedback-table th:nth-child(1) { width: 17%; }
.member-feedback-table th:nth-child(2) { width: 14%; }
.member-feedback-table th:nth-child(3) { width: 16%; }
.member-feedback-table th:nth-child(4) { width: 25%; }
.member-feedback-table th:nth-child(5) { width: 14%; }
.member-feedback-table th:nth-child(6) { width: 14%; }
.member-feedback-table tbody tr:last-child td { border-bottom: 0; }
.member-feedback-table tbody tr:hover { background: var(--color-primary-soft); }
.feedback-member-cell { display: grid; justify-items: center; gap: 3px; text-align: center; }
.feedback-member-cell strong { color: var(--color-text); font-size: var(--font-sm); }
.feedback-phone { color: var(--color-text-muted); font-size: var(--font-xs); }
.feedback-stars { display: inline-flex; direction: ltr; gap: 2px; color: var(--border-strong); font: 800 17px/1 Arial, sans-serif; }
.feedback-stars .is-filled { color: var(--color-warning); }
.feedback-type { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: var(--radius-sm); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.feedback-type-general { background: var(--color-info-soft); color: var(--color-primary); }
.feedback-type-problem { background: var(--color-warning-soft); color: var(--color-warning); }
.feedback-type-complaint { background: var(--color-danger-soft); color: var(--color-danger); }
.feedback-type-suggestion { background: var(--color-success-soft); color: var(--color-success); }
.feedback-type-feature_request { background: var(--primary-soft); color: var(--text-primary-soft); }
.feedback-message-cell { max-height: 88px; margin: 0; overflow: auto; color: var(--color-text-soft); font-size: var(--font-sm); line-height: 1.7; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-date { color: var(--color-text-muted); font-size: var(--font-xs); white-space: nowrap; }
.feedback-details-button { min-width: 110px; white-space: nowrap; }
.member-feedback-pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-top: var(--space-2); color: var(--color-text-muted); font-size: var(--font-sm); }
.feedback-pagination-actions { display: flex; align-items: center; gap: var(--space-3); }
.feedback-pagination-actions strong { color: var(--color-text-soft); font-size: var(--font-xs); }
.member-feedback-empty,
.member-feedback-error,
.member-feedback-loading { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-5); color: var(--color-text-muted); text-align: center; }
.member-feedback-empty strong,
.member-feedback-error strong { color: var(--color-text); }
.member-feedback-error { color: var(--color-danger); }
.member-feedback-error .btn { margin-top: var(--space-2); }

@media (max-width: 1100px) {
  .member-feedback-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .member-feedback-filters .member-feedback-search { grid-column: span 2; }
}

@media (max-width: 700px) {
  .member-feedback-header { align-items: flex-start; flex-direction: column; }
  .member-feedback-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .member-feedback-filters .member-feedback-search { grid-column: 1 / -1; }
  .member-feedback-filters > button { width: 100%; }
  .member-feedback-pagination { align-items: flex-start; flex-direction: column; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/member-subscription-requests.css */
.member-subscription-requests-page,
.portal-analytics-page {
  display: grid;
  gap: var(--space-6);
}

.member-requests-header,
.portal-analytics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-color);
}

.member-requests-heading,
.portal-analytics-heading {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.member-requests-heading-icon,
.portal-analytics-heading-icon {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  color: var(--primary);
}

.member-requests-heading-icon .ui-icon,
.portal-analytics-heading-icon .ui-icon {
  width: 26px;
  height: 26px;
}

.member-requests-kicker,
.portal-analytics-kicker {
  display: block;
  color: var(--primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .04em;
}

.member-requests-heading h3,
.portal-analytics-heading h3 {
  margin: 3px 0 4px;
  color: var(--text-primary);
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
}

.member-requests-heading p,
.portal-analytics-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.member-requests-toolbar,
.portal-analytics-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.member-requests-toolbar label,
.portal-analytics-actions label {
  display: grid;
  min-width: 190px;
  gap: 6px;
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.member-requests-toolbar select,
.portal-analytics-actions select {
  min-height: 42px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
}

.member-requests-summary,
.portal-analytics-range-label {
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.member-requests-table-wrap {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.member-requests-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  direction: ltr;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.member-requests-table {
  width: 100%;
  min-width: 1060px;
  border-collapse: separate;
  border-spacing: 0;
  direction: rtl;
}

.member-requests-table th,
.member-requests-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  vertical-align: middle;
}

.member-requests-table th {
  background: var(--color-surface-muted);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  white-space: nowrap;
}

.member-requests-table tbody tr:last-child td { border-bottom: 0; }
.member-requests-table tbody tr:hover { background: var(--primary-soft); }

.member-request-member,
.member-request-membership,
.member-request-actions {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.member-request-member strong,
.member-request-membership strong,
.member-request-amount { color: var(--text-primary); }
.member-request-member span,
.member-request-membership span,
.member-request-membership small,
.member-request-price-detail,
.member-request-review-note,
.member-request-muted { color: var(--text-muted); font-size: var(--font-xs); }
.member-request-date { color: var(--text-muted); font-size: var(--font-xs); white-space: nowrap; }
.member-request-actions { min-width: 190px; }
.member-request-action-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.member-request-status { display: inline-flex; min-height: 26px; align-items: center; padding: 4px 9px; border-radius: var(--radius-pill); font-size: var(--font-xs); font-weight: var(--weight-bold); }
.member-request-status-pending { background: var(--warning-soft); color: var(--warning-text); }
.member-request-status-approved { background: var(--success-soft); color: var(--success-text); }
.member-request-status-rejected,
.member-request-status-cancelled { background: var(--danger-soft); color: var(--danger-text); }
.member-requests-loading,
.member-requests-empty,
.member-requests-error { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-5); color: var(--text-muted); text-align: center; }
.member-requests-empty strong,
.member-requests-error strong { color: var(--text-primary); }
.member-requests-error { color: var(--danger); }
.member-requests-error .btn { margin-top: var(--space-2); }
.member-requests-pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); color: var(--text-muted); font-size: var(--font-sm); }
.member-requests-pagination > div { display: flex; gap: var(--space-2); }
.member-requests-status { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--success-soft); color: var(--success-text); font-size: var(--font-sm); }
.member-requests-status.is-error { background: var(--danger-soft); color: var(--danger-text); }

@media (max-width: 760px) {
  .member-requests-header,
  .portal-analytics-header,
  .member-requests-toolbar,
  .portal-analytics-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .member-requests-heading,
  .portal-analytics-heading { align-items: flex-start; }
  .member-requests-toolbar label,
  .portal-analytics-actions label { min-width: 0; }
  .member-requests-toolbar .btn,
  .portal-analytics-actions .btn { width: 100%; }
  .member-requests-pagination { align-items: flex-start; flex-direction: column; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/portal-analytics.css */
.portal-analytics-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.portal-analytics-card {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.portal-analytics-card-label { color: var(--text-secondary); font-size: var(--font-sm); font-weight: var(--weight-bold); }
.portal-analytics-card strong { color: var(--text-primary); font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.1; }
.portal-analytics-card small { color: var(--text-muted); font-size: var(--font-xs); }
.portal-analytics-card-views { border-top: 3px solid var(--primary); }
.portal-analytics-card-visitors { border-top: 3px solid var(--success); }
.portal-analytics-card-members { border-top: 3px solid var(--warning); }

.portal-analytics-daily-panel {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.portal-analytics-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.portal-analytics-section-head h4 { margin: 3px 0 4px; color: var(--text-primary); font-size: var(--font-lg); }
.portal-analytics-section-head p { margin: 0; color: var(--text-muted); font-size: var(--font-sm); }
.portal-analytics-daily { min-width: 0; }
.portal-analytics-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-4); color: var(--text-secondary); font-size: var(--font-xs); font-weight: var(--weight-semibold); }
.portal-analytics-legend span { display: inline-flex; align-items: center; gap: 6px; }
.portal-bar-key { width: 9px; height: 9px; border-radius: 50%; }
.portal-bar-key-views { background: var(--primary); }
.portal-bar-key-visitors { background: var(--success); }
.portal-bar-key-members { background: var(--warning); }
.portal-analytics-daily-list { display: grid; gap: var(--space-3); }
.portal-analytics-day { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--color-surface-muted); }
.portal-analytics-day-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); color: var(--text-muted); font-size: var(--font-xs); }
.portal-analytics-day-meta strong { color: var(--text-primary); }
.portal-analytics-bars { display: grid; gap: var(--space-2); }
.portal-analytics-bar-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 50px; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--font-xs); }
.portal-analytics-bar-row strong { color: var(--text-secondary); text-align: end; }
.portal-analytics-bar-track { height: 8px; overflow: hidden; border-radius: var(--radius-pill); background: var(--border-secondary); }
.portal-analytics-bar { --portal-bar-size: 0%; display: block; width: var(--portal-bar-size); height: 100%; border-radius: inherit; }
.portal-analytics-bar-views { background: var(--primary); }
.portal-analytics-bar-visitors { background: var(--success); }
.portal-analytics-bar-members { background: var(--warning); }
.portal-analytics-highlight { margin: var(--space-4) 0 0; color: var(--text-muted); font-size: var(--font-sm); }
.portal-analytics-highlight strong { color: var(--text-primary); }
.portal-analytics-loading,
.portal-analytics-empty,
.portal-analytics-error { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-5); color: var(--text-muted); text-align: center; }
.portal-analytics-empty strong,
.portal-analytics-error strong { color: var(--text-primary); }
.portal-analytics-error { color: var(--danger); }
.portal-analytics-status { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger-text); font-size: var(--font-sm); }

@media (max-width: 760px) {
  .portal-analytics-cards { grid-template-columns: 1fr; }
  .portal-analytics-section-head { align-items: flex-start; flex-direction: column; }
  .portal-analytics-bar-row { grid-template-columns: 58px minmax(0, 1fr) 42px; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/permissions.css */
.permissions-section {
  display: grid;
  gap: var(--space-5);
  padding: clamp(20px, 3vw, 32px);
}

.permissions-header,
.permissions-editor-head,
.permissions-subheading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.permissions-heading {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.permissions-heading-icon {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.permissions-heading-icon .ui-icon { width: 25px; height: 25px; }
.permissions-kicker,
.permissions-editor-kicker {
  display: block;
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.permissions-heading h3,
.permissions-editor-head h4,
.permissions-subheading h4 {
  margin: 3px 0 0;
  color: var(--color-text);
}

.permissions-heading h3 { font-size: clamp(22px, 3vw, 30px); }
.permissions-heading p,
.permissions-editor-head p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-sm);
}

.permissions-owner-badge,
.permissions-readonly-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  padding: 0 12px;
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.permissions-account-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: var(--color-primary-soft);
  padding: var(--space-5);
}

.permissions-account-copy { min-width: 0; }
.permissions-account-copy h4 { margin: 4px 0 0; color: var(--color-text); font-size: var(--font-lg); }
.permissions-account-copy p { max-width: 760px; margin: 6px 0 0; color: var(--color-text-muted); font-size: var(--font-xs); line-height: 1.7; }
.permissions-account-metrics { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.permissions-account-metric { display: grid; gap: 3px; min-width: 0; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface); padding: 10px 12px; }
.permissions-account-metric span { color: var(--color-text-muted); font-size: 11px; }
.permissions-account-metric strong { color: var(--color-primary); font-size: var(--font-lg); line-height: 1; }
.permissions-account-metric.success strong { color: var(--color-success); }
.permissions-account-metric.muted strong { color: var(--color-text-muted); }

.permissions-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 2fr);
  gap: var(--space-4);
  align-items: start;
}

.permissions-users-panel,
.permissions-editor-panel {
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.permissions-users-panel { padding: var(--space-4); }
.permissions-editor-panel { padding: clamp(16px, 2.5vw, 24px); }
.permissions-subheading { align-items: center; padding-bottom: var(--space-3); border-bottom: 1px solid var(--border-color); }
.permissions-subheading span:first-child { color: var(--color-text-muted); font-size: var(--font-xs); }
.permissions-users-count { display: grid; min-width: 30px; height: 30px; place-items: center; border-radius: var(--radius-pill); background: var(--color-primary-soft); color: var(--color-primary); font-weight: var(--weight-bold); }

.permissions-user-list { display: grid; gap: var(--space-2); padding-top: var(--space-3); }
.permissions-user-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  padding: 10px;
  text-align: start;
}
.permissions-user-button:hover { border-color: var(--border-color); background: var(--color-primary-soft); }
.permissions-user-button.active { border-color: var(--primary-border); background: var(--color-primary-soft); color: var(--color-primary); }
.permissions-user-avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); font-weight: var(--weight-bold); }
.permissions-user-copy { display: grid; min-width: 0; gap: 2px; }
.permissions-user-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-sm); }
.permissions-user-copy small { overflow: hidden; color: var(--color-text-muted); text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-xs); direction: ltr; text-align: start; }
.permissions-user-status { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); }
.permissions-user-status.disabled { background: var(--color-danger); }

.permissions-editor-head { align-items: center; padding-bottom: var(--space-4); border-bottom: 1px solid var(--border-color); }
.permissions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-4) 0; }
.permission-group-card { min-width: 0; overflow: hidden; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--color-surface-elevated); }
.permission-group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border: 0; border-bottom: 1px solid transparent; background: var(--color-surface-muted); padding: 13px 14px; cursor: pointer; list-style: none; }
.permission-group-head::-webkit-details-marker { display: none; }
.permission-group-card[open] > .permission-group-head { border-bottom-color: var(--border-color); background: var(--color-primary-soft); }
.permission-group-title,
.permission-group-summary { display: flex; min-width: 0; align-items: center; gap: var(--space-2); }
.permission-group-title { flex: 1; flex-direction: column; align-items: flex-start; gap: 3px; }
.permission-group-title strong { color: var(--color-text); font-size: var(--font-sm); }
.permission-group-title small { color: var(--color-text-muted); font-size: 11px; font-weight: var(--weight-regular); }
.permission-group-summary { flex: 0 0 auto; color: var(--color-text-muted); font-size: 11px; }
.permission-group-chevron { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border: 1px solid var(--border-color); border-radius: 10px; background: var(--color-surface); color: var(--color-primary); line-height: 1; transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast); }
.permission-group-chevron-icon { width: 16px; height: 16px; transition: transform var(--transition-fast); }
.permission-group-card[open] .permission-group-chevron { transform: rotate(180deg); background: var(--color-primary); color: var(--text-on-primary); }
.permission-readonly-summary { color: var(--color-primary); font-size: 11px; font-weight: var(--weight-semibold); white-space: nowrap; }
.permission-group-body { background: var(--color-surface-elevated); }
.permission-group-controls { border-bottom: 1px solid var(--border-color); padding: 9px 13px; }
.permission-group-controls .permission-readonly-toggle { justify-content: flex-start; }
.permission-group-readonly { color: var(--color-text-muted); font-size: 11px; }
.permission-readonly-toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--color-text-muted); cursor: pointer; font-size: 11px; font-weight: var(--weight-semibold); white-space: nowrap; }
.permission-readonly-toggle input { width: 16px; height: 16px; accent-color: var(--color-primary); }
.permission-option { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 9px; padding: 11px 13px; cursor: pointer; }
.permission-option + .permission-option { border-top: 1px solid var(--border-color); }
.permission-option input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--color-primary); }
.permission-option-copy { display: grid; gap: 3px; min-width: 0; }
.permission-option-copy strong { color: var(--color-text); font-size: var(--font-xs); }
.permission-option-copy small { color: var(--color-text-muted); font-size: 11px; line-height: 1.5; }
.permission-option:has(input:checked) { background: var(--primary-soft); }
.permissions-editor-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); align-items: end; padding-top: var(--space-4); border-top: 1px solid var(--border-color); }
.permissions-reason-field { display: grid; gap: 7px; color: var(--color-text-muted); font-size: var(--font-xs); font-weight: var(--weight-semibold); }
.permissions-reason-field textarea { min-height: 66px; resize: vertical; }
.permissions-form-actions { display: flex; align-items: center; gap: var(--space-2); }
.permissions-form-actions .btn { min-height: 44px; white-space: nowrap; }
.permissions-status { margin: var(--space-3) 0 0; border-radius: var(--radius-md); padding: 10px 12px; font-size: var(--font-xs); }
.permissions-status.success { background: var(--color-success-soft); color: var(--color-success); }
.permissions-status.error { background: var(--color-danger-soft); color: var(--color-danger); }
.permissions-empty-state { grid-column: 1 / -1; border: 1px dashed var(--border-color); border-radius: var(--radius-md); color: var(--color-text-muted); padding: 32px 16px; text-align: center; }

@media (max-width: 900px) {
  .permissions-layout { grid-template-columns: 1fr; }
  .permissions-user-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .permissions-header,
  .permissions-editor-head { flex-direction: column; }
  .permissions-grid { grid-template-columns: 1fr; }
  .permissions-account-metrics { grid-template-columns: 1fr; }
  .permissions-editor-footer { grid-template-columns: 1fr; }
  .permissions-form-actions { justify-content: stretch; }
  .permissions-form-actions .btn { flex: 1; }
  .permissions-user-list { grid-template-columns: 1fr; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/store.css */
.dashboard-store-summary {
    margin-top: var(--space-5, 24px);
    padding: var(--space-5, 24px);
    border: 1px solid var(--store-border);
    border-radius: var(--radius-lg, 20px);
    background: var(--color-surface);
}

.dashboard-store-summary-head,
.store-page-header,
.store-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4, 16px);
}

.dashboard-store-summary-title,
.store-page-heading {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
}

.dashboard-store-summary-title h3,
.store-page-heading h3,
.store-card-header h4 {
    margin: 0;
    color: var(--store-text);
}

.dashboard-store-summary-title p,
.store-page-heading p,
.store-card-header p {
    margin: 4px 0 0;
    color: var(--store-muted);
    font-size: var(--font-sm, 13px);
}

.dashboard-store-summary-title > div > span,
.store-page-heading > div > span {
    color: var(--store-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dashboard-store-summary-icon,
.store-page-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--store-primary);
}

.dashboard-store-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.dashboard-store-summary-grid article {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--store-border);
    border-radius: 14px;
    background: var(--bg-card-hover);
}

.dashboard-store-summary-grid span {
    display: block;
    color: var(--store-muted);
    font-size: 12px;
}

.dashboard-store-summary-grid strong {
    display: block;
    margin-top: 8px;
    color: var(--store-text);
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.store-section {
    width: 100%;
    margin-top: var(--space-6, 32px);
}

.store-page-header {
    padding: 4px 0 22px;
}

.store-page-actions,
.store-form-actions,
.store-report-filters {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 10px;
}

.store-subnav {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: var(--space-2, 8px);
    min-width: 0;
    margin-bottom: var(--space-5, 24px);
    padding: var(--space-2, 8px);
    border: 1px solid var(--border-color, var(--store-border));
    border-radius: var(--radius-lg, 18px);
    background: var(--color-surface-muted, var(--bg-card-hover));
    box-shadow: var(--shadow-xs);
}

.store-subnav-button {
    display: flex;
    min-width: 0;
    min-height: 68px;
    align-items: center;
    justify-content: center;
    gap: var(--space-2, 8px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    border: 1px solid transparent;
    border-radius: var(--radius-md, 12px);
    background: transparent;
    color: var(--color-text-muted, var(--store-muted));
    cursor: pointer;
    font: inherit;
    font-size: var(--font-xs, 12px);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    transition: background-color var(--transition-fast, 160ms ease), border-color var(--transition-fast, 160ms ease), color var(--transition-fast, 160ms ease), transform var(--transition-fast, 160ms ease), box-shadow var(--transition-fast, 160ms ease);
}

.store-subnav-button:hover,
.store-subnav-button:focus-visible {
    border-color: var(--border-focus);
    background: var(--color-surface);
    color: var(--color-primary, var(--store-primary));
    transform: translateY(-1px);
}

.store-subnav-button.is-active,
.store-subnav-button[aria-selected="true"] {
    border-color: var(--color-primary, var(--store-primary));
    background: var(--color-primary, var(--store-primary));
    color: var(--text-on-primary);
    box-shadow: var(--shadow-primary);
}

.store-tab-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border-radius: var(--radius-sm, 8px);
    background: var(--color-primary-soft);
    color: var(--color-primary, var(--store-primary));
}

.store-subnav-button.is-active .store-tab-icon,
.store-subnav-button[aria-selected="true"] .store-tab-icon {
    background: var(--primary-soft);
    color: var(--text-on-primary);
}

.store-tab-icon .ui-icon {
    width: 18px;
    height: 18px;
}

.store-tab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-view[hidden] {
    display: none;
}

.store-pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, .85fr);
    gap: 16px;
    align-items: start;
}

.store-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--store-border);
    border-radius: 18px;
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.store-search-field {
    min-width: min(100%, 270px);
}

.store-search-field input,
.store-customer-picker input,
.store-form-grid input,
.store-form-grid select,
.store-form-grid textarea,
.store-checkout-form input,
.store-checkout-form select,
.store-checkout-form textarea,
.store-report-filters input,
.store-report-filters select {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--store-text);
    font: inherit;
}

.store-search-field input,
.store-customer-picker input,
.store-report-filters input,
.store-report-filters select {
    padding: 9px 12px;
}

.store-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
    max-height: 620px;
    margin-top: 16px;
    overflow: auto;
    padding: 2px;
}

.store-product-card {
    display: flex;
    min-height: 118px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--store-border);
    border-radius: 12px;
    background: var(--bg-card-hover);
    color: var(--store-text);
    cursor: pointer;
    text-align: right;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.store-product-card:hover,
.store-product-card:focus-visible {
    border-color: var(--border-hover);
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.store-product-card strong,
.store-product-card small {
    display: block;
    max-width: 100%;
}

.store-product-card small {
    color: var(--store-muted);
}

.store-product-card .store-product-price {
    color: var(--store-primary-dark);
    font-size: 16px;
    font-weight: 800;
}

.store-customer-picker {
    position: relative;
    margin-top: 16px;
}

.store-customer-picker label,
.store-form-grid label,
.store-checkout-form label,
.store-report-filters label {
    display: grid;
    gap: 6px;
    color: var(--store-muted);
    font-size: 12px;
    font-weight: 700;
}

.store-customer-results {
    position: absolute;
    z-index: 4;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    max-height: 220px;
    overflow: auto;
    border: 1px solid var(--store-border);
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: var(--shadow-popup);
}

.store-customer-result {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border: 0;
    border-bottom: 1px solid var(--border-secondary);
    background: var(--bg-card);
    color: var(--store-text);
    cursor: pointer;
    font: inherit;
    text-align: right;
}

.store-customer-result:hover,
.store-customer-result:focus-visible {
    background: var(--primary-soft);
}

.store-selected-customer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--primary-border);
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary-active);
    font-size: 13px;
}

.store-cart-lines {
    display: grid;
    gap: 8px;
    max-height: 280px;
    margin-top: 14px;
    overflow: auto;
}

.store-cart-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
}

.store-cart-line strong,
.store-cart-line small {
    display: block;
}

.store-cart-line small {
    color: var(--store-muted);
}

.store-cart-quantity {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.store-cart-quantity button,
.store-cart-remove {
    width: 30px;
    height: 30px;
    border: 1px solid var(--store-border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--store-primary);
    cursor: pointer;
    font: inherit;
}

.store-cart-quantity input {
    width: 52px;
    min-height: 30px;
    padding: 3px;
    border: 1px solid var(--store-border);
    border-radius: 8px;
    text-align: center;
}

.store-checkout-form {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.store-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.store-checkout-form label,
.store-form-grid label {
    color: var(--store-muted);
}

.store-checkout-form input,
.store-checkout-form select,
.store-checkout-form textarea,
.store-form-grid input,
.store-form-grid select,
.store-form-grid textarea,
.store-report-filters input,
.store-report-filters select {
    padding: 9px 11px;
}

.store-cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 0;
    border-top: 1px solid var(--store-border);
    color: var(--store-muted);
}

.store-cart-total strong {
    color: var(--store-text);
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.store-complete-sale {
    width: 100%;
}

.store-form-card {
    margin-top: 18px;
    padding: 20px;
    border: 1px solid var(--border-secondary);
    border-top: 3px solid var(--store-primary);
    border-radius: 14px;
    background: var(--bg-card-hover);
}

.store-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
}

.store-form-grid label {
    min-width: 0;
    gap: 8px;
}

.store-form-grid label:has(textarea),
.store-form-grid .store-form-actions {
    grid-column: 1 / -1;
}

.store-form-grid .store-check-field {
    display: flex;
    align-items: center;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-self: end;
    min-height: 44px;
}

.store-form-grid input,
.store-form-grid select,
.store-form-grid textarea,
.store-checkout-form input,
.store-checkout-form select,
.store-checkout-form textarea,
.store-report-filters input,
.store-report-filters select {
    outline: 0;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.store-form-grid input:focus,
.store-form-grid select:focus,
.store-form-grid textarea:focus,
.store-checkout-form input:focus,
.store-checkout-form select:focus,
.store-checkout-form textarea:focus,
.store-report-filters input:focus,
.store-report-filters select:focus {
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring);
}

.store-form-grid .store-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--border-secondary);
    padding-top: 14px;
}

.store-form-grid .store-form-actions .btn {
    min-width: 128px;
}

.store-table-wrap {
    width: 100%;
    margin-top: 18px;
    overflow-x: auto;
}

.store-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    color: var(--store-text);
    font-size: 13px;
}

.store-table th,
.store-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-secondary);
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.store-table td > small {
    display: block;
    margin-top: 3px;
    color: var(--store-muted);
    font-size: 11px;
}

.store-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: max-content;
    flex-wrap: nowrap;
    gap: 6px;
}

.store-table th {
    background: var(--table-header-bg);
    color: var(--store-muted);
    font-size: 12px;
    font-weight: 800;
}

.store-table tbody tr:hover {
    background: var(--color-primary-soft);
}

.store-report-filters label {
    min-width: 150px;
    flex: 1 1 170px;
}

.store-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 8px;
    background: var(--success-soft);
    color: var(--success-text);
    font-size: 12px;
    font-weight: 800;
}

.store-status.warning {
    background: var(--warning-soft);
    color: var(--warning-text);
}

.store-status.danger {
    background: var(--danger-soft);
    color: var(--danger-text);
}

.store-report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.store-report-summary article {
    padding: 14px;
    border: 1px solid var(--store-border);
    border-radius: 12px;
    background: var(--bg-card-hover);
}

.store-report-summary span,
.store-report-summary strong {
    display: block;
}

.store-report-summary span {
    color: var(--store-muted);
    font-size: 12px;
}

.store-report-summary strong {
    margin-top: 7px;
    color: var(--store-text);
    font-size: 19px;
}

@media (max-width: 1199px) {
    .store-subnav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .dashboard-store-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .store-pos-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .dashboard-store-summary,
    .store-card {
        padding: 16px;
    }

    .dashboard-store-summary-head,
    .store-page-header,
    .store-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-store-summary-grid,
    .store-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .store-form-grid label:has(textarea),
    .store-form-grid .store-form-actions {
        grid-column: span 2;
    }

    .store-page-actions,
    .store-page-actions .btn,
    .store-report-filters,
    .store-report-filters .btn {
        width: 100%;
    }

    .store-subnav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--space-2, 8px);
    }

    .store-subnav-button {
        width: 100%;
        min-width: 0;
        min-height: 68px;
        flex-direction: column;
        gap: 4px;
        padding: var(--space-2, 8px);
        border-color: var(--store-border);
        border-radius: 14px;
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
    }

    .store-tab-icon {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    .store-tab-icon .ui-icon {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 420px) {
    .dashboard-store-summary-grid,
    .store-form-grid,
    .store-form-row {
        grid-template-columns: 1fr;
    }

    .store-form-grid label:has(textarea),
    .store-form-grid .store-form-actions {
        grid-column: auto;
    }

    .store-cart-line {
        grid-template-columns: 1fr auto;
    }

    .store-cart-line > :last-child {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/intelligence.css */
.intelligence-section {
    display: grid;
    gap: var(--space-5);
    padding: clamp(1rem, 2vw, 1.5rem);
    background: linear-gradient(145deg, var(--bg-app) 0%, var(--primary-soft) 52%, var(--bg-card) 100%);
}

.intelligence-page-header,
.intelligence-card-head,
.intelligence-result-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.intelligence-page-header {
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--primary-border);
    border-radius: 1.25rem;
    background: radial-gradient(circle at 12% 12%, var(--primary-soft), transparent 32%), var(--bg-card);
    box-shadow: var(--shadow-card);
}

.intelligence-page-heading {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
}

.intelligence-page-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    flex: 0 0 3rem;
    color: var(--primary);
    border-radius: 1rem;
    background: var(--primary-soft);
}

.intelligence-page-heading h3,
.intelligence-card-head h4,
.intelligence-result-head h4 {
    margin: .15rem 0 .25rem;
    color: var(--text-primary);
}

.intelligence-page-heading p,
.intelligence-card-head p,
.intelligence-result-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: .88rem;
}

.intelligence-kicker,
.intelligence-card-head > div > span,
.intelligence-result-kicker {
    color: var(--primary);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.intelligence-header-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}

.intelligence-engine-badge,
.intelligence-draft-badge,
.intelligence-card-mark {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: .25rem .65rem;
    color: var(--primary-active);
    border: 1px solid var(--primary-border);
    border-radius: 999px;
    background: var(--primary-soft);
    font-size: .72rem;
    font-weight: 800;
}

.intelligence-card-mark {
    min-width: 2.25rem;
    justify-content: center;
    color: var(--text-disabled);
    border-color: var(--border-primary);
    background: var(--bg-card-hover);
}

.intelligence-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .75rem;
}

.intelligence-stat-card {
    position: relative;
    display: grid;
    gap: .3rem;
    min-height: 7.25rem;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.intelligence-stat-card::after {
    position: absolute;
    inset: auto 0 0;
    height: .2rem;
    content: '';
    background: var(--border-hover);
}

.intelligence-stat-card.active::after { background: var(--success); }
.intelligence-stat-card.warning::after { background: var(--warning); }
.intelligence-stat-card.danger::after { background: var(--danger); }
.intelligence-stat-card.workout::after { background: var(--info); }
.intelligence-stat-card.diet::after { background: var(--success); }
.intelligence-stat-card > span { color: var(--text-muted); font-size: .78rem; }
.intelligence-stat-card strong { color: var(--text-primary); font-size: 1.75rem; line-height: 1; }
.intelligence-stat-card small { color: var(--text-disabled); font-size: .72rem; }

.intelligence-dashboard-grid,
.intelligence-plan-layout {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: var(--space-5);
}

/* The operational screen is intentionally ordered by action: urgent signals,
   retention follow-up, questions, then plan execution. */
.intelligence-section > .intelligence-dashboard-grid { display: contents; }
.intelligence-priorities-card { order: 1; border-color: var(--warning-border); box-shadow: var(--shadow-card); }
.intelligence-stats-grid { order: 2; }
.intelligence-churn-card { order: 3; }
.intelligence-query-card { order: 4; }
.intelligence-plans-card { order: 5; }
.intelligence-card-mark-critical { color: var(--warning-text); border-color: var(--warning-border); background: var(--warning-soft); }
.intelligence-card-head-actions { display: flex; align-items: flex-start; justify-content: flex-end; gap: .55rem; flex-wrap: wrap; }

.intelligence-card {
    min-width: 0;
    padding: clamp(1rem, 2vw, 1.35rem);
    border: 1px solid var(--border-primary);
    border-radius: 1.15rem;
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.intelligence-card-head {
    margin-bottom: 1rem;
}

.intelligence-card-head h4 { font-size: 1.05rem; }
.intelligence-card-head p { margin-top: .35rem; max-width: 62ch; }

.intelligence-priorities {
    display: grid;
    gap: .65rem;
}

.intelligence-priority {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    border: 1px solid var(--border-primary);
    border-radius: .85rem;
    background: var(--bg-card-hover);
}

.intelligence-priority-dot {
    width: .65rem;
    height: .65rem;
    flex: 0 0 .65rem;
    border-radius: 50%;
    background: var(--text-disabled);
}

.intelligence-priority.warning .intelligence-priority-dot { background: var(--warning); }
.intelligence-priority.danger .intelligence-priority-dot { background: var(--danger); }
.intelligence-priority.info .intelligence-priority-dot { background: var(--info); }
.intelligence-priority.success .intelligence-priority-dot { background: var(--success); }
.intelligence-priority strong,
.intelligence-priority small { display: block; }
.intelligence-priority strong { color: var(--text-secondary); font-size: .86rem; }
.intelligence-priority small { margin-top: .15rem; color: var(--text-muted); font-size: .76rem; }

.intelligence-query-form,
.intelligence-refine-form,
.intelligence-plan-form {
    display: grid;
    gap: .8rem;
}

.intelligence-query-form label,
.intelligence-refine-form label,
.intelligence-plan-form label {
    display: grid;
    gap: .35rem;
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 700;
}

.intelligence-query-form input,
.intelligence-refine-form textarea,
.intelligence-plan-form input,
.intelligence-plan-form select {
    width: 100%;
}

.intelligence-answer {
    margin-top: 1rem;
    padding: .85rem;
    border: 1px solid var(--primary-border);
    border-radius: .85rem;
    background: var(--primary-soft);
    white-space: pre-line;
}

.intelligence-answer-label { color: var(--primary); font-size: .72rem; font-weight: 800; }
.intelligence-answer p { margin: .35rem 0 0; color: var(--text-secondary); font-size: .84rem; line-height: 1.8; }

.intelligence-prompt-list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .8rem;
}

.intelligence-prompt {
    padding: .35rem .55rem;
    color: var(--primary-active);
    border: 1px solid var(--primary-border);
    border-radius: 999px;
    background: var(--bg-card);
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
}

.intelligence-churn-legend { display: flex; gap: .35rem; flex-wrap: wrap; }
.intelligence-churn-legend span,
.intelligence-risk-badge { display: inline-flex; align-items: center; padding: .25rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 800; }
.risk-high, .intelligence-risk-badge.high { color: var(--danger-text); background: var(--danger-soft); }
.risk-medium, .intelligence-risk-badge.medium { color: var(--warning-text); background: var(--warning-soft); }
.risk-low, .intelligence-risk-badge.low { color: var(--success-text); background: var(--success-soft); }

.intelligence-churn-table-wrap { overflow-x: auto; }
.intelligence-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.intelligence-table th { padding: .65rem .55rem; color: var(--text-muted); background: var(--table-header-bg); font-size: .72rem; text-align: right; white-space: nowrap; }
.intelligence-table td { padding: .72rem .55rem; border-top: 1px solid var(--border-secondary); color: var(--text-secondary); font-size: .78rem; vertical-align: middle; }
.intelligence-table td small { color: var(--text-muted); }
.intelligence-member-cell { display: flex; align-items: center; gap: .55rem; }
.intelligence-member-cell strong, .intelligence-member-cell small { display: block; }
.intelligence-member-cell strong { color: var(--text-primary); }
.intelligence-member-avatar { display: grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 2rem; color: var(--primary-active); border-radius: .7rem; background: var(--primary-soft); font-weight: 800; }

.intelligence-plan-type {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem;
    padding: .3rem;
    border-radius: .8rem;
    background: var(--bg-elevated);
}

.intelligence-plan-type button {
    padding: .6rem;
    color: var(--text-muted);
    border: 0;
    border-radius: .6rem;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: .82rem;
    font-weight: 800;
}

.intelligence-plan-type button.is-active { color: var(--primary-active); background: var(--bg-card); box-shadow: var(--shadow-card); }
.intelligence-workout-fields,
.intelligence-diet-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.intelligence-workout-fields label:last-child,
.intelligence-diet-fields label:last-child { grid-column: 1 / -1; }
.intelligence-generate-button { margin-top: .25rem; }

.intelligence-plan-result {
    min-height: 100%;
    padding: 1rem;
    border: 1px dashed var(--primary-border);
    border-radius: 1rem;
    background: linear-gradient(145deg, var(--primary-soft), var(--bg-card));
}

.intelligence-empty-result { display: grid; place-items: center; align-content: center; min-height: 20rem; gap: .5rem; color: var(--text-muted); text-align: center; }
.intelligence-empty-result span { color: var(--primary-hover); font-size: 2rem; }
.intelligence-empty-result strong { color: var(--text-secondary); }
.intelligence-empty-result small { color: var(--text-disabled); }
.intelligence-result-head { align-items: flex-start; }
.intelligence-result-head h4 { font-size: 1rem; }
.intelligence-result-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; margin: 1rem 0; }
.intelligence-result-metrics span { padding: .6rem; border-radius: .7rem; background: var(--bg-elevated); color: var(--text-muted); font-size: .7rem; text-align: center; }
.intelligence-result-metrics b { display: block; color: var(--text-primary); font-size: .95rem; }
.intelligence-plan-preview-list { display: grid; gap: .45rem; max-height: 14rem; overflow: auto; margin-bottom: 1rem; }
.intelligence-plan-preview-list article { padding: .65rem .75rem; border: 1px solid var(--primary-border); border-radius: .7rem; background: var(--bg-elevated); }
.intelligence-plan-preview-list strong, .intelligence-plan-preview-list small { display: block; }
.intelligence-plan-preview-list strong { color: var(--text-secondary); font-size: .8rem; }
.intelligence-plan-preview-list small { margin-top: .2rem; color: var(--text-muted); line-height: 1.7; }
.intelligence-result-notice { margin: .75rem 0; padding: .65rem .75rem; border-radius: .7rem; font-size: .76rem; }
.intelligence-result-notice.warning { color: var(--warning-text); background: var(--warning-soft); border: 1px solid var(--warning-border); }
.intelligence-result-notice.success { color: var(--success-text); background: var(--success-soft); border: 1px solid var(--success-border); }
.intelligence-result-notice ul { margin: .35rem 0 0; padding-inline-start: 1.2rem; }
.intelligence-refine-form { padding-top: .8rem; border-top: 1px solid var(--primary-border); }
.intelligence-result-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
.intelligence-human-review-note { display: block; margin-top: .65rem; color: var(--text-disabled); font-size: .7rem; }
.intelligence-empty-line { padding: 1rem; color: var(--text-disabled); text-align: center; }
.intelligence-message { padding: .7rem .85rem; border-radius: .75rem; font-size: .8rem; }
.intelligence-message.error { color: var(--danger-text); background: var(--danger-soft); }
.intelligence-message.warning { color: var(--warning-text); background: var(--warning-soft); }
.intelligence-message.success { color: var(--success-text); background: var(--success-soft); }

@media (max-width: 1150px) {
    .intelligence-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .intelligence-page-header,
    .intelligence-card-head,
    .intelligence-result-head { flex-direction: column; }
    .intelligence-dashboard-grid,
    .intelligence-plan-layout { grid-template-columns: 1fr; }
    .intelligence-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .intelligence-header-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 520px) {
    .intelligence-section { padding: .75rem; }
    .intelligence-stats-grid,
    .intelligence-workout-fields,
    .intelligence-diet-fields,
    .intelligence-result-metrics { grid-template-columns: 1fr 1fr; }
    .intelligence-workout-fields label:last-child,
    .intelligence-diet-fields label:last-child { grid-column: 1 / -1; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/branding.css */
/* Central Custom Branding editor and safe runtime overrides. The editor uses
   the same semantic tokens as the rest of the application, while the preview
   frame receives an isolated token set so drafts never leak into production. */

.auth-branding-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 24px;
  text-align: right;
}

.auth-branding-mark,
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  background: var(--primary);
  color: var(--text-on-primary);
}

.auth-branding-mark {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-primary);
}

.auth-branding-mark img,
.brand-mark img,
.portal-brand-mark img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.auth-branding-mark > span,
.brand-mark > span,
.portal-brand-mark > span {
  color: inherit;
  font-size: 1.25rem;
  font-weight: var(--weight-extrabold);
  line-height: 1;
}

.auth-branding-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.auth-branding-copy strong {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: var(--weight-extrabold);
}

.auth-branding-copy small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.branding-page {
  display: grid;
  gap: var(--space-5);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.branding-page-head,
.branding-editor-status,
.branding-section-head,
.branding-action-bar,
.branding-preview-head,
.branding-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.branding-page-head {
  padding: var(--space-2) 0;
}

.branding-page-head h2,
.branding-section-head h3,
.branding-preview-head h3 {
  margin: 3px 0;
  color: var(--text-primary);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: var(--weight-extrabold);
}

.branding-page-head p,
.branding-section-head p,
.branding-preview-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-sm);
  line-height: 1.7;
}

.branding-eyebrow,
.branding-preview-kicker {
  display: block;
  color: var(--primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.branding-page-head .branding-header-mark {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  color: var(--primary);
}

.branding-page-head .branding-header-mark .ui-icon {
  width: 26px;
  height: 26px;
}

.branding-editor-status {
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.branding-status-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.branding-status-copy::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
  content: "";
}

.branding-status-copy.is-dirty::before {
  background: var(--warning);
  box-shadow: 0 0 0 4px var(--warning-soft);
}

.branding-version-meta {
  color: var(--text-muted);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  direction: ltr;
}

.branding-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, .82fr);
  gap: var(--space-5);
  align-items: start;
}

.branding-editor-card,
.branding-preview-card {
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.branding-editor-card {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  min-height: 650px;
  overflow: hidden;
}

.branding-editor-nav {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 14px;
  border-inline-end: 1px solid var(--border-secondary);
  background: var(--brand-surface-secondary, var(--bg-surface));
}

.branding-editor-nav button {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  padding: 0 10px;
  text-align: start;
  cursor: pointer;
  font: inherit;
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.branding-editor-nav button .ui-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--text-muted);
}

.branding-editor-nav button:hover,
.branding-editor-nav button:focus-visible {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
  outline: 0;
}

.branding-editor-nav button.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: var(--weight-bold);
}

.branding-editor-nav button.active .ui-icon {
  color: var(--primary);
}

.branding-editor-content {
  min-width: 0;
  padding: var(--space-5);
}

.branding-form-panel {
  display: grid;
  gap: var(--space-4);
}

.branding-form-panel[hidden] {
  display: none;
}

.branding-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.branding-field-grid .field-full {
  grid-column: 1 / -1;
}

.branding-field-grid .field > label,
.branding-field-grid .checkbox-field > span,
.branding-section-label {
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

.branding-section-label {
  display: block;
  margin-bottom: -4px;
}

.branding-hint {
  margin: -6px 0 0;
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.branding-inline-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  background: var(--info-soft);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.branding-inline-note .ui-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--info);
}

.branding-asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.branding-asset-card {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.branding-asset-preview {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--brand-image-radius);
  background: var(--primary-soft);
  color: var(--primary);
}

.branding-asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.branding-asset-preview span {
  font-size: 20px;
  font-weight: var(--weight-extrabold);
}

.branding-asset-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.branding-asset-copy strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branding-asset-copy small {
  min-height: 17px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branding-asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.branding-asset-actions .btn {
  min-height: 30px;
  padding: 0 9px;
  font-size: 10px;
}

.branding-theme-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.branding-theme-tabs button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  padding: 0 13px;
  cursor: pointer;
  font: inherit;
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.branding-theme-tabs button.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.branding-token-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.branding-color-field {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.branding-color-field label {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branding-color-field input[type="color"] {
  width: 38px;
  height: 34px;
  min-height: 34px;
  padding: 3px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}

.branding-color-field input[type="text"] {
  min-height: 34px;
  padding-inline: 9px;
  direction: ltr;
  font-family: var(--font-latin);
  font-size: 11px;
  text-align: left;
}

.branding-contrast-note {
  min-height: 18px;
  grid-column: 1 / -1;
  color: var(--warning-text);
  font-size: 10px;
}

.branding-contrast-note.is-valid {
  color: var(--success-text);
}

.branding-control-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.branding-control-row .field select {
  width: 100%;
}

.branding-validation {
  display: grid;
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.branding-validation.is-error {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.branding-validation.is-success {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

.branding-action-bar {
  position: sticky;
  z-index: var(--z-sticky);
  bottom: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.branding-action-bar .branding-action-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.branding-action-copy strong {
  color: var(--text-primary);
  font-size: var(--font-sm);
}

.branding-action-copy small {
  color: var(--text-muted);
  font-size: 10px;
}

.branding-audit-card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.branding-audit-card .branding-section-head {
  margin: 0;
}

.branding-audit-list {
  display: grid;
  gap: 8px;
}

.branding-audit-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(180px, 1.6fr);
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.branding-audit-row strong,
.branding-audit-row span,
.branding-audit-row small {
  min-width: 0;
}

.branding-audit-row strong {
  color: var(--text-primary);
  font-size: var(--font-sm);
}

.branding-audit-row span,
.branding-audit-row small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.branding-audit-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branding-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.branding-preview-card {
  position: sticky;
  top: 18px;
  overflow: hidden;
}

.branding-preview-head {
  align-items: flex-start;
  padding: var(--space-5) var(--space-5) var(--space-3);
}

.branding-preview-toolbar {
  flex-wrap: wrap;
  padding: 0 var(--space-5) var(--space-4);
}

.branding-preview-switch {
  display: inline-flex;
  gap: 5px;
}

.branding-preview-switch button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  padding: 0 9px;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: var(--weight-bold);
}

.branding-preview-switch button.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.branding-preview-frame {
  --preview-background: var(--bg-app);
  --preview-surface: var(--bg-surface);
  --preview-card: var(--bg-card);
  --preview-card-hover: var(--bg-card-hover);
  --preview-sidebar: var(--bg-sidebar);
  --preview-primary: var(--primary);
  --preview-primary-hover: var(--primary-hover);
  --preview-on-primary: var(--text-on-primary);
  --preview-sidebar-text: var(--sidebar-text);
  --preview-text: var(--text-primary);
  --preview-muted: var(--text-muted);
  --preview-border: var(--border-primary);
  --preview-soft: var(--primary-soft);
  min-height: 520px;
  margin: 0 var(--space-5) var(--space-5);
  overflow: hidden;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--preview-background);
  color: var(--preview-text);
  font-size: 12px;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.branding-preview-frame.is-mobile {
  width: min(360px, calc(100% - 24px));
  min-height: 570px;
  margin-inline: auto;
}

.branding-preview-shell {
  display: grid;
  min-height: inherit;
  grid-template-columns: 76px minmax(0, 1fr);
  direction: rtl;
}

.branding-preview-frame.is-mobile .branding-preview-shell {
  grid-template-columns: 1fr;
}

.branding-preview-sidebar {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px 9px;
  background: var(--preview-sidebar);
  color: var(--preview-sidebar-text);
}

.branding-preview-frame.is-mobile .branding-preview-sidebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 48px;
  padding: 7px 10px;
}

.branding-preview-mini-logo {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0 auto 7px;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  background: var(--preview-primary);
  color: var(--preview-on-primary);
  font-size: 17px;
  font-weight: 800;
}

.branding-preview-mini-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.branding-preview-nav-item {
  display: block;
  min-height: 30px;
  border-radius: 8px;
  background: transparent;
  color: color-mix(in srgb, var(--preview-sidebar-text) 72%, transparent);
  padding: 7px 5px;
  text-align: center;
  font-size: 9px;
}

.branding-preview-nav-item.active {
  background: linear-gradient(135deg, var(--preview-primary), var(--preview-primary-hover));
  color: var(--preview-on-primary);
  font-weight: 800;
}

.branding-preview-main {
  min-width: 0;
  padding: 14px;
}

.branding-preview-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--preview-border);
  padding-bottom: 10px;
}

.branding-preview-topbar strong {
  color: var(--preview-text);
  font-size: 14px;
}

.branding-preview-topbar small {
  display: block;
  margin-top: 2px;
  color: var(--preview-muted);
  font-size: 9px;
}

.branding-preview-circle {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--preview-soft);
  color: var(--preview-primary);
  font-size: 10px;
  font-weight: 800;
}

.branding-preview-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.branding-preview-kpi,
.branding-preview-card-sample,
.branding-preview-table-wrap,
.branding-preview-modal {
  border: 1px solid var(--preview-border);
  border-radius: 10px;
  background: var(--preview-card);
  box-shadow: 0 5px 16px rgb(15 23 42 / .05);
}

.branding-preview-kpi {
  display: grid;
  gap: 4px;
  padding: 9px;
}

.branding-preview-kpi span,
.branding-preview-table-wrap th {
  color: var(--preview-muted);
  font-size: 8px;
}

.branding-preview-kpi strong {
  color: var(--preview-text);
  font-size: 16px;
}

.branding-preview-card-sample {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 11px;
}

.branding-preview-card-sample header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.branding-preview-card-sample header strong {
  color: var(--preview-text);
  font-size: 11px;
}

.branding-preview-card-sample header span {
  color: var(--preview-muted);
  font-size: 8px;
}

.branding-preview-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.branding-preview-input {
  min-height: 31px;
  border: 1px solid var(--preview-border);
  border-radius: 7px;
  background: var(--preview-surface);
  color: var(--preview-text);
  padding: 0 8px;
  font: inherit;
  font-size: 9px;
}

.branding-preview-button {
  min-height: 31px;
  border: 0;
  border-radius: 7px;
  background: var(--preview-primary);
  color: var(--preview-on-primary);
  padding: 0 11px;
  font: inherit;
  font-size: 9px;
  font-weight: 800;
}

.branding-preview-table-wrap {
  overflow: hidden;
}

.branding-preview-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8px;
}

.branding-preview-table-wrap th,
.branding-preview-table-wrap td {
  border-bottom: 1px solid var(--preview-border);
  padding: 7px;
  text-align: center;
}

.branding-preview-table-wrap th {
  background: var(--preview-card-hover);
  font-weight: 700;
}

.branding-preview-table-wrap td {
  color: var(--preview-text);
}

.branding-preview-table-wrap tr:last-child td {
  border-bottom: 0;
}

.branding-preview-badge {
  display: inline-flex;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-text);
  padding: 2px 6px;
  font-size: 7px;
  font-weight: 800;
}

.branding-preview-modal {
  position: relative;
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
}

.branding-preview-modal strong {
  color: var(--preview-text);
  font-size: 10px;
}

.branding-preview-modal p {
  margin: 0;
  color: var(--preview-muted);
  font-size: 8px;
}

.branding-preview-modal .branding-preview-button {
  width: max-content;
}

.branding-payment-panel {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
}

.branding-payment-panel-head {
  align-items: flex-start;
}

.branding-payment-panel h4 {
  margin: 3px 0;
  color: var(--text-primary);
  font-size: var(--font-md);
}

.branding-payment-list {
  display: grid;
  gap: var(--space-3);
}

.branding-payment-row,
.branding-payment-empty {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.branding-payment-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.branding-payment-row-head strong,
.branding-payment-empty strong {
  color: var(--text-primary);
}

.branding-payment-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.branding-payment-fields .field-full {
  grid-column: 1 / -1;
}

.branding-payment-fields label {
  display: grid;
  gap: 6px;
}

.branding-payment-fields label > span {
  color: var(--danger);
}

.branding-payment-active {
  margin: 0;
}

.branding-payment-empty span {
  color: var(--text-muted);
  font-size: var(--font-sm);
}

html[data-brand-card-style="flat"] .panel,
html[data-brand-card-style="flat"] .card,
html[data-brand-card-style="flat"] .stat-card,
html[data-brand-card-style="flat"] .content-card {
  box-shadow: none;
}

html[data-brand-card-style="soft-shadow"] .panel,
html[data-brand-card-style="soft-shadow"] .card,
html[data-brand-card-style="soft-shadow"] .stat-card,
html[data-brand-card-style="soft-shadow"] .content-card {
  box-shadow: var(--shadow-card);
}

body.auth-locked .auth-screen {
  background-color: var(--brand-login-background, var(--bg-app));
  background-image: linear-gradient(180deg, rgb(2 6 23 / var(--brand-login-overlay-opacity, .72)), rgb(2 6 23 / var(--brand-login-overlay-opacity, .72))), var(--brand-login-image, url("/assets/gym-background.webp"));
}

.member-portal-page {
  background-image: linear-gradient(180deg, rgb(2 6 23 / var(--brand-login-overlay-opacity, .72)), rgb(2 6 23 / var(--brand-login-overlay-opacity, .72))), var(--brand-login-image, url("/assets/gym-background.webp"));
}

@media (max-width: 1100px) {
  .branding-workspace {
    grid-template-columns: 1fr;
  }

  .branding-preview-card {
    position: relative;
    top: auto;
  }
}

@media (max-width: 760px) {
  .branding-page-head,
  .branding-editor-status,
  .branding-action-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .branding-action-bar {
    position: relative;
    bottom: auto;
  }

  .branding-action-buttons {
    width: 100%;
  }

  .branding-action-buttons .btn {
    flex: 1 1 130px;
  }

  .branding-editor-card {
    display: block;
    min-height: 0;
  }

  .branding-editor-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-inline-end: 0;
    border-bottom: 1px solid var(--border-secondary);
  }

  .branding-editor-content {
    padding: var(--space-4);
  }

  .branding-field-grid,
  .branding-control-row,
  .branding-asset-grid,
  .branding-token-grid,
  .branding-payment-fields {
    grid-template-columns: 1fr;
  }

  .branding-field-grid .field-full {
    grid-column: auto;
  }

  .branding-preview-head {
    padding: var(--space-4) var(--space-4) var(--space-3);
  }

  .branding-preview-toolbar {
    padding-inline: var(--space-4);
  }

  .branding-preview-frame {
    margin-inline: var(--space-4);
  }

  .branding-audit-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .branding-preview-frame,
  .branding-editor-nav button {
    transition: none;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/member-payment-methods.css */
/* Owner-only editor for a tenant's member payment instructions. It reuses the
   existing identity tokens and remains separate from platform billing. */

.member-payment-methods-page {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
  padding: 0;
}

.member-payment-page-head,
.member-payment-statusbar,
.member-payment-section-head,
.member-payment-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.member-payment-page-head {
  padding: var(--space-2) 0;
}

.member-payment-page-heading,
.member-payment-section-head > div,
.member-payment-summary-top {
  min-width: 0;
}

.member-payment-page-heading h2,
.member-payment-section-head h3,
.member-payment-summary-top h3 {
  margin: 3px 0;
  color: var(--text-primary);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: var(--weight-extrabold);
}

.member-payment-section-head h3,
.member-payment-summary-top h3 {
  font-size: var(--font-xl);
}

.member-payment-page-heading p,
.member-payment-section-head p,
.member-payment-summary-top p {
  max-width: 760px;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-sm);
  line-height: 1.75;
}

.member-payment-eyebrow,
.member-payment-kicker {
  display: block;
  color: var(--primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .04em;
}

.member-payment-header-mark {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  color: var(--primary);
}

.member-payment-header-mark .ui-icon {
  width: 26px;
  height: 26px;
}

.member-payment-statusbar {
  min-height: 48px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}

.member-payment-status-copy,
.member-payment-version-meta {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.member-payment-status-copy.is-error {
  color: var(--danger-text);
}

.member-payment-status-copy.is-success {
  color: var(--success-text);
}

.member-payment-version-meta {
  color: var(--text-muted);
  font-size: var(--font-xs);
  white-space: nowrap;
}

.member-payment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  align-items: start;
  gap: var(--space-5);
}

.member-payment-editor-card,
.member-payment-summary-card,
.member-payment-action-bar {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.member-payment-editor-card {
  min-width: 0;
  padding: var(--space-5);
}

.member-payment-section-head {
  align-items: flex-start;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-secondary);
}

.member-payment-section-head .btn {
  flex: 0 0 auto;
}

.member-payment-methods-list {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-4);
}

.member-payment-methods-list[aria-busy="true"] {
  opacity: .72;
}

.member-payment-loading,
.member-payment-empty {
  display: grid;
  min-height: 120px;
  align-content: center;
  justify-items: center;
  gap: var(--space-2);
  border: 1px dashed var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  color: var(--text-muted);
  text-align: center;
}

.member-payment-empty strong {
  color: var(--text-primary);
}

.member-payment-method-card {
  display: grid;
  gap: var(--space-4);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--bg-surface);
}

.member-payment-method-card:hover {
  border-color: var(--border-hover);
}

.member-payment-method-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.member-payment-method-card-head strong {
  color: var(--text-primary);
  font-size: var(--font-md);
}

.member-payment-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.member-payment-field-grid .field-full {
  grid-column: 1 / -1;
}

.member-payment-method-card .field {
  min-width: 0;
}

.member-payment-method-card .field > label {
  display: grid;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}

.member-payment-method-card input,
.member-payment-method-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--font-sm);
}

.member-payment-method-card input:focus,
.member-payment-method-card textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
  outline: none;
}

.member-payment-method-card textarea {
  min-height: 74px;
  resize: vertical;
}

.member-payment-method-active {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  cursor: pointer;
}

.member-payment-method-active input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.member-payment-summary-card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
}

.member-payment-summary-top p {
  line-height: 1.7;
}

.member-payment-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-top: 1px solid var(--border-secondary);
  padding-top: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.member-payment-stat strong {
  color: var(--primary);
  font-size: var(--font-2xl);
  line-height: 1;
}

.member-payment-summary-note {
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--primary-soft);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.member-payment-action-bar {
  align-items: center;
  padding: var(--space-4) var(--space-5);
}

.member-payment-action-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.member-payment-action-copy strong {
  color: var(--text-primary);
  font-size: var(--font-sm);
}

.member-payment-action-copy small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.member-payment-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

@media (max-width: 900px) {
  .member-payment-layout {
    grid-template-columns: 1fr;
  }

  .member-payment-summary-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-payment-summary-top,
  .member-payment-summary-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .member-payment-page-head,
  .member-payment-statusbar,
  .member-payment-section-head,
  .member-payment-action-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .member-payment-header-mark {
    width: 48px;
    height: 48px;
  }

  .member-payment-statusbar {
    gap: var(--space-2);
  }

  .member-payment-version-meta {
    white-space: normal;
  }

  .member-payment-editor-card,
  .member-payment-summary-card,
  .member-payment-action-bar {
    padding: var(--space-4);
  }

  .member-payment-field-grid,
  .member-payment-summary-card {
    grid-template-columns: 1fr;
  }

  .member-payment-method-card .field-full,
  .member-payment-summary-top,
  .member-payment-summary-note {
    grid-column: auto;
  }

  .member-payment-action-buttons,
  .member-payment-action-buttons .btn,
  .member-payment-section-head .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .member-payment-method-card,
  .member-payment-method-card:hover {
    transition: none;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/saas.css */
.saas-page {
    display: block;
    direction: rtl;
    color: var(--text-primary);
}

.saas-page-header,
.saas-panel-head,
.saas-panel-head-inline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.saas-page-header {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-secondary);
}

.saas-billing-page {
    display: grid;
    gap: var(--space-4);
}

.saas-billing-page .saas-page-header,
.saas-billing-page .saas-subscription-summary,
.saas-billing-page .saas-billing-grid,
.saas-billing-page .saas-requests-panel {
    width: 100%;
}

.saas-page-header-status {
    display: grid;
    justify-items: end;
    gap: 5px;
    flex: 0 0 auto;
}

.saas-page-header-status small {
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.saas-billing-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}

.saas-billing-step {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
}

.saas-billing-step > span {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: var(--radius-pill);
    background: var(--border-secondary);
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
}

.saas-billing-step > div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.saas-billing-step strong {
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.saas-billing-step small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: var(--font-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saas-billing-step.is-current {
    border-color: var(--primary-border);
    background: var(--primary-soft);
}

.saas-billing-step.is-current > span {
    background: var(--primary);
    color: var(--text-on-primary);
}

.saas-billing-step.is-current strong { color: var(--text-primary); }

.saas-page-heading,
.saas-panel-head > div {
    min-width: 0;
}

.saas-eyebrow {
    display: inline-flex;
    color: var(--primary);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.saas-page-heading h3,
.saas-panel-head h4 {
    margin: 4px 0 3px;
    color: var(--text-primary);
}

.saas-page-heading h3 { font-size: var(--font-2xl); }
.saas-panel-head h4 { font-size: var(--font-lg); }

.saas-page-heading p,
.saas-panel-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--font-sm);
    line-height: 1.7;
}

.saas-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.saas-kpi {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.saas-kpi > span:last-child {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.saas-kpi small { color: var(--text-muted); font-size: var(--font-xs); }
.saas-kpi strong { color: var(--text-primary); font-size: var(--font-2xl); line-height: 1.1; }

.saas-kpi-icon {
    display: inline-grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: var(--radius-md);
}

.saas-kpi-icon .ui-icon { width: 21px; height: 21px; }
.saas-kpi-purple { color: var(--primary); background: var(--primary-soft); }
.saas-kpi-green { color: var(--success); background: var(--success-soft); }
.saas-kpi-orange { color: var(--warning); background: var(--warning-soft); }
.saas-kpi-red { color: var(--danger); background: var(--danger-soft); }

.platform-grid,
.saas-billing-grid {
    display: grid;
    grid-template-columns: minmax(300px, .82fr) minmax(0, 1.4fr);
    gap: var(--space-4);
    align-items: start;
}

.platform-grid > .platform-tenants-panel,
.platform-grid > .platform-plans-panel,
.platform-grid > .platform-audit-panel {
    grid-column: 1 / -1;
}

.saas-panel {
    min-width: 0;
    overflow: hidden;
    padding: var(--space-5);
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.saas-panel-head { margin-bottom: var(--space-4); }
.saas-panel-head-inline { align-items: center; }
.saas-panel-head-inline > select { flex: 0 0 150px; width: auto; }
.saas-panel-badge {
    flex: 0 0 auto;
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--text-primary-soft);
    padding: 5px 9px;
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
    white-space: nowrap;
}
.saas-panel-badge.is-secure { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }

.saas-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.saas-form-grid .field { min-width: 0; }
.saas-form-grid .field-full { grid-column: 1 / -1; }
.saas-form-grid label { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.saas-form-grid input,
.saas-form-grid select,
.saas-form-grid textarea { width: 100%; }

.saas-form-actions {
    display: flex;
    justify-content: flex-start;
    padding-top: var(--space-2);
}

.saas-table-wrap {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
}

.saas-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    color: var(--text-primary);
    font-size: var(--font-sm);
}

.saas-table th,
.saas-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border-secondary);
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.saas-table th {
    background: var(--table-header-bg);
    color: var(--text-secondary);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
}

.saas-table tbody tr:last-child td { border-bottom: 0; }
.saas-table tbody tr:hover td { background: var(--bg-card-hover); }
.saas-table td:last-child { white-space: normal; }

.saas-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.saas-table-actions .btn { white-space: nowrap; }
.saas-table .saas-inline-input { width: 88px; min-height: 34px; padding: 5px 8px; }

.saas-status-pill,
.saas-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
    white-space: nowrap;
}

.saas-status-pill[data-status="active"],
.saas-status[data-status="active"],
.saas-status[data-status="approved"] { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.saas-status-pill[data-status="trial"],
.saas-status[data-status="pending"] { color: var(--warning); background: var(--warning-soft); border-color: var(--warning-border); }
.saas-status-pill[data-status="expired"],
.saas-status-pill[data-status="suspended"],
.saas-status[data-status="rejected"] { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }

.saas-subscription-summary {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(150px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.saas-summary-card {
    min-width: 0;
    padding: var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
}

.saas-summary-card small,
.saas-summary-card span { display: block; color: var(--text-muted); font-size: var(--font-xs); }
.saas-summary-card strong { display: block; margin-top: 5px; color: var(--text-primary); font-size: var(--font-lg); }
.saas-summary-card p { margin: 5px 0 0; color: var(--text-secondary); font-size: var(--font-sm); }

.saas-plan-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
}

.saas-plan-card {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.saas-plan-card:hover { transform: translateY(-1px); border-color: var(--border-hover); background: var(--bg-card-hover); }
.saas-plan-card.is-selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.saas-plan-card.is-current { border-color: var(--success-border); }
.saas-plan-card.is-selected.is-current { border-color: var(--primary); }
.saas-plan-card h5 { margin: 0; color: var(--text-primary); font-size: var(--font-lg); }
.saas-plan-card p { min-height: 42px; margin: 0; color: var(--text-muted); font-size: var(--font-xs); line-height: 1.65; }
.saas-plan-price { color: var(--primary); font-size: var(--font-xl); font-weight: var(--weight-bold); }
.saas-plan-price small { color: var(--text-muted); font-size: var(--font-xs); font-weight: var(--weight-regular); }
.saas-plan-limits { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; color: var(--text-secondary); font-size: var(--font-xs); }
.saas-plan-limits li { display: flex; justify-content: space-between; gap: var(--space-2); }
.saas-plan-limits strong { color: var(--text-primary); }
.saas-plan-card .btn { width: 100%; margin-top: auto; }

.saas-plan-entitlements { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.saas-entitlement { border-radius: var(--radius-pill); padding: 4px 8px; font-size: var(--font-2xs); font-weight: 700; }
.saas-entitlement.is-enabled { background: var(--success-soft); color: var(--success-text); }
.saas-entitlement.is-disabled { background: var(--border-secondary); color: var(--text-muted); }

.saas-upload-field { min-width: 0; }
.saas-upload-box {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-3);
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}
.saas-upload-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: var(--radius-md);
    background: var(--primary-soft);
    color: var(--text-primary-soft);
    font-size: 1.2rem;
    font-weight: var(--weight-bold);
}
.saas-upload-box > div { display: grid; min-width: 0; gap: 2px; }
.saas-upload-box strong { color: var(--text-secondary); font-size: var(--font-sm); }
.saas-upload-box small { color: var(--text-muted); font-size: var(--font-xs); }
.saas-upload-box input[type="file"] { grid-column: 1 / -1; width: 100%; min-width: 0; }

.saas-request-panel { border-top: 3px solid var(--primary); }
.saas-requests-panel { margin-top: 0; }

.platform-plans-panel .saas-plan-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.saas-plan-edit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.saas-plan-edit label { display: grid; gap: 3px; color: var(--text-muted); font-size: var(--font-xs); }

.saas-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding-top: 2px;
}

.saas-feature-grid > .saas-muted { grid-column: 1 / -1; }
.saas-feature-toggle { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 6px; color: var(--text-secondary) !important; cursor: pointer; }
.saas-feature-toggle input { width: 15px !important; height: 15px; accent-color: var(--primary); }

.saas-admin-plan-card .saas-plan-edit .saas-inline-input { min-width: 0; width: 100%; }

.saas-empty,
.saas-loading-block {
    padding: var(--space-5);
    color: var(--text-muted);
    text-align: center;
}

.saas-inline-message {
    margin-top: var(--space-3);
    padding: 10px 12px;
    border: 1px solid var(--info-border);
    border-radius: var(--radius-md);
    background: var(--info-soft);
    color: var(--info);
    font-size: var(--font-sm);
}

.saas-inline-message.is-error { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger); }
.saas-muted { color: var(--text-muted); font-size: var(--font-xs); font-weight: var(--weight-regular); }

.saas-audit-list { display: grid; gap: 0; max-height: 270px; overflow: auto; }
.saas-audit-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--space-3); padding: 10px 0; border-bottom: 1px solid var(--border-secondary); }
.saas-audit-item:last-child { border-bottom: 0; }
.saas-audit-item time { color: var(--text-muted); font-size: var(--font-xs); }
.saas-audit-item strong { display: block; color: var(--text-primary); font-size: var(--font-sm); }
.saas-audit-item span { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--font-xs); }

@media (max-width: 1100px) {
    .saas-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .saas-subscription-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .saas-plan-list,
    .platform-plans-panel .saas-plan-list { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .platform-grid,
    .saas-billing-grid { grid-template-columns: 1fr; }
    .saas-page-header,
    .saas-panel-head-inline { flex-direction: column; align-items: stretch; }
    .saas-panel-head-inline > select { flex-basis: auto; width: 100%; }
    .saas-page-header-status { justify-items: start; }
    .saas-billing-steps { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .saas-kpi-grid,
    .saas-subscription-summary,
    .saas-form-grid { grid-template-columns: 1fr; }
    .saas-form-grid .field-full { grid-column: auto; }
    .saas-panel { padding: var(--space-4); }
    .saas-kpi { padding: 12px; }
    .saas-kpi strong { font-size: var(--font-xl); }
    .saas-panel-badge { align-self: flex-start; }
    .saas-audit-item { grid-template-columns: 1fr; gap: 3px; }
    .saas-feature-grid { grid-template-columns: 1fr; }
}

/* Subscription workspace composition: compact summary, balanced plans, and
   a request form that remains readable without wasting wide-screen space. */
.saas-billing-page {
    width: min(100%, 1800px);
    max-width: 1800px;
    margin-inline: auto;
    gap: 20px;
}

.saas-billing-page .saas-page-header {
    align-items: center;
    min-height: 68px;
    margin-bottom: 0;
    padding-bottom: 18px;
}

.saas-billing-page .saas-page-heading h3 { font-size: clamp(24px, 2.2vw, 32px); letter-spacing: -.03em; }
.saas-billing-page .saas-page-heading p { max-width: 720px; }
.saas-billing-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px; }

.saas-subscription-summary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 0;
}

.saas-summary-card {
    min-height: 92px;
    padding: 15px 16px;
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.saas-summary-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.saas-summary-card-top .saas-status { min-height: 24px; padding: 3px 8px; }
.saas-summary-card strong { font-size: clamp(17px, 1.5vw, 22px); }
.saas-summary-card p { line-height: 1.45; }
.saas-summary-progress { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: var(--border-secondary); }
.saas-summary-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--info)); }

.saas-billing-grid {
    grid-template-columns: minmax(0, 1fr) minmax(500px, 1.08fr);
    gap: 20px;
    align-items: stretch;
}

.saas-billing-grid > .saas-plans-panel { order: 1; }
.saas-billing-grid > .saas-request-panel { order: 2; }
.saas-panel { border-radius: 16px; padding: 20px; }
.saas-panel-head { align-items: center; }

.saas-owner-plan-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.saas-owner-plan-list .saas-plan-card {
    position: relative;
    min-height: 100%;
    grid-template-rows: auto auto 1fr auto;
    padding: 18px;
    border-radius: 15px;
}

.saas-owner-plan-list .saas-plan-card.is-current::before {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    content: "الباقة الحالية";
    border: 1px solid var(--success-border);
    border-radius: 99px;
    background: var(--success-soft);
    color: var(--success-text);
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 800;
}

.saas-owner-plan-list .saas-plan-card.is-selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent), 0 14px 30px color-mix(in srgb, var(--primary) 12%, transparent); }
.saas-owner-plan-list .saas-plan-card.is-current.is-selected { background: color-mix(in srgb, var(--primary-soft) 70%, var(--bg-card)); }
.saas-owner-plan-list .saas-plan-card.is-current .btn { background: var(--primary); color: var(--text-on-primary); }
.saas-owner-plan-list .saas-plan-card h5 { padding-inline-end: 86px; }
.saas-plan-limits { padding-block: 4px 8px; }

.saas-request-panel { display: flex; flex-direction: column; }
.saas-request-panel .saas-form-grid { flex: 1 1 auto; align-content: start; }
.saas-upload-box { min-height: 122px; align-content: center; justify-items: start; }
.saas-upload-box input[type="file"] { cursor: pointer; }
.saas-form-actions .btn { min-height: 48px; padding-inline: 24px; }

.saas-requests-panel { margin-top: 0; }

@media (max-width: 1279px) {
    .saas-subscription-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .saas-summary-status { grid-column: span 2; }
    .saas-billing-grid { grid-template-columns: minmax(0, 1fr) minmax(430px, .95fr); }
    .saas-owner-plan-list { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
}

@media (max-width: 1080px) {
    .saas-billing-grid { grid-template-columns: 1fr; }
    .saas-billing-grid > .saas-plans-panel { order: 1; }
    .saas-billing-grid > .saas-request-panel { order: 2; }
}

@media (max-width: 820px) {
    .saas-subscription-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .saas-summary-status { grid-column: 1 / -1; }
    .saas-owner-plan-list { grid-template-columns: repeat(3, minmax(220px, 1fr)); overflow-x: auto; padding: 3px 3px 10px; scroll-snap-type: x proximity; }
    .saas-owner-plan-list .saas-plan-card { min-height: 330px; scroll-snap-align: start; }
}

@media (max-width: 560px) {
    .saas-billing-page { gap: 14px; }
    .saas-billing-page .saas-page-header { align-items: flex-start; flex-direction: column; }
    .saas-billing-steps { gap: 7px; padding: 7px; }
    .saas-billing-step { padding: 8px; }
    .saas-billing-step small { white-space: normal; }
    .saas-subscription-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .saas-summary-card { min-height: 84px; padding: 13px; }
    .saas-summary-status { grid-column: 1 / -1; }
    .saas-owner-plan-list { display: grid; grid-template-columns: 1fr; overflow: visible; }
    .saas-owner-plan-list .saas-plan-card { min-height: 0; }
    .saas-table-wrap { overflow: visible; border: 0; }
    .saas-table { min-width: 0; }
    .saas-table thead { display: none; }
    .saas-table,
    .saas-table tbody,
    .saas-table tr,
    .saas-table td { display: block; width: 100%; }
    .saas-table tr { margin-bottom: 10px; padding: 12px; border: 1px solid var(--border-secondary); border-radius: 14px; background: var(--bg-card); box-shadow: var(--shadow-sm); }
    .saas-table td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border: 0; white-space: normal; text-align: start; }
    .saas-table td::before { flex: 0 0 92px; color: var(--text-muted); content: attr(data-label); font-size: var(--font-xs); font-weight: 700; }
    .saas-table td:last-child { justify-content: space-between; }
    .saas-table td:last-child::before { align-self: flex-start; }
}

@media (max-width: 389px) {
    .saas-subscription-summary { grid-template-columns: 1fr; }
    .saas-summary-status { grid-column: auto; }
    .saas-panel { padding: 16px; }
    .saas-summary-card strong { overflow-wrap: anywhere; }
}

/* Platform subscription visual reconstruction.
   The data contract stays unchanged; this layer only restores the reference
   composition: compact header, five-card summary, balanced workspace, and a
   quiet history surface. */
.saas-billing-page {
    --subscription-page: var(--bg-app);
    --subscription-panel: var(--bg-card);
    --subscription-panel-soft: var(--bg-surface);
    --subscription-line: var(--border-secondary);
    --subscription-muted: var(--text-muted);
    --subscription-accent: var(--primary);
    --subscription-accent-soft: var(--primary-soft);
    width: calc(100% - clamp(24px, 3vw, 64px));
    max-width: none;
    min-height: calc(100dvh - 24px);
    margin-inline: auto;
    padding: 18px 0 24px;
    gap: 14px;
    background: var(--subscription-page);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

html[data-theme="dark"] .saas-billing-page,
body[data-theme="dark"] .saas-billing-page {
    --subscription-page: #07172a;
    --subscription-panel: #10233b;
    --subscription-panel-soft: #0c1c31;
    --subscription-line: rgba(136, 165, 202, .22);
    --subscription-muted: #9aacc5;
    --subscription-accent: #8b45f2;
    --subscription-accent-soft: rgba(139, 69, 242, .14);
    background:
        radial-gradient(circle at 86% 0%, rgba(91, 62, 183, .13), transparent 28%),
        linear-gradient(180deg, #08192e 0%, #07172a 100%);
}

/* visual-redesign.css is intentionally loaded after page layers. Keep the
   subscription canvas itself as the final visual authority for this route. */
.saas-billing-page { background: var(--subscription-page) !important; }
html[data-theme="dark"] .saas-billing-page,
body[data-theme="dark"] .saas-billing-page { background: linear-gradient(180deg, #08192e 0%, #07172a 100%) !important; }

.saas-billing-page .saas-page-header {
    align-items: flex-start;
    min-height: 0;
    margin: 0;
    padding: 0 6px 4px;
    border-bottom: 0;
}

.saas-billing-page .saas-page-heading h3 {
    margin: 5px 0 4px;
    font-size: clamp(22px, 1.9vw, 29px);
    letter-spacing: -.025em;
}

.saas-billing-page .saas-page-heading p {
    max-width: 620px;
    font-size: 12px;
    line-height: 1.6;
}

.saas-page-header-nav {
    display: grid;
    justify-items: start;
    gap: 7px;
    flex: 0 0 auto;
    min-width: 150px;
}

.saas-back-button {
    min-height: 34px;
    padding-inline: 12px;
    border-color: color-mix(in srgb, var(--success) 55%, var(--subscription-line));
    color: var(--success);
    background: color-mix(in srgb, var(--success-soft) 60%, transparent);
}

.saas-back-button .ui-icon { width: 15px; height: 15px; }

.saas-breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--subscription-muted);
    font-size: 11px;
    white-space: nowrap;
}

.saas-breadcrumb b { color: var(--subscription-accent); font-size: 15px; line-height: 1; }
.saas-breadcrumb strong { color: var(--text-primary); font-weight: 700; }

.saas-billing-page .saas-subscription-summary {
    grid-template-columns: minmax(190px, 1fr) minmax(270px, 1.55fr) repeat(3, minmax(170px, 1fr));
    gap: 12px;
    margin: 0;
}

.saas-billing-page .saas-summary-card {
    min-height: 88px;
    padding: 14px 16px;
    background: var(--subscription-panel);
    border: 1px solid var(--subscription-line);
    border-radius: 13px;
    box-shadow: 0 10px 26px rgba(1, 8, 20, .12);
}

.saas-billing-page .saas-summary-card span { color: var(--subscription-muted); font-size: 11px; }
.saas-billing-page .saas-summary-card strong { margin-top: 7px; font-size: clamp(17px, 1.35vw, 21px); }
.saas-billing-page .saas-summary-card p { margin-top: 4px; color: var(--subscription-muted); font-size: 11px; }
.saas-billing-page .saas-summary-card-top { gap: 6px; }
.saas-billing-page .saas-summary-card-top .saas-status { min-height: 23px; padding: 3px 8px; }
.saas-billing-page .saas-summary-progress { height: 5px; margin-top: 9px; background: color-mix(in srgb, var(--success) 20%, var(--subscription-line)); }
.saas-billing-page .saas-summary-progress span { background: linear-gradient(90deg, #19c47b, #36e19b); }

.saas-billing-page .saas-billing-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.saas-billing-page .saas-panel {
    padding: 18px;
    background: var(--subscription-panel);
    border: 1px solid var(--subscription-line);
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(1, 8, 20, .14);
}

.saas-billing-page .saas-plans-panel,
.saas-billing-page .saas-request-panel { min-height: 354px; }
.saas-billing-page .saas-panel-head { align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.saas-billing-page .saas-panel-head h4 { margin-top: 4px; font-size: 18px; }
.saas-billing-page .saas-panel-head p { max-width: 530px; font-size: 11px; line-height: 1.55; }
.saas-billing-page .saas-panel-badge { padding: 4px 8px; font-size: 10px; }

.saas-billing-page .saas-owner-plan-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    height: calc(100% - 66px);
}

.saas-billing-page .saas-owner-plan-list .saas-plan-card {
    min-height: 260px;
    gap: 10px;
    padding: 14px;
    background: var(--subscription-panel-soft);
    border: 1px solid var(--subscription-line);
    border-radius: 12px;
}

.saas-billing-page .saas-plan-card-heading {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-width: 0;
}

.saas-billing-page .saas-plan-card-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--subscription-accent) 42%, var(--subscription-line));
    border-radius: 10px;
    background: var(--subscription-accent-soft);
    color: var(--subscription-accent);
}

.saas-billing-page .saas-plan-card-icon .ui-icon { width: 18px; height: 18px; }
.saas-billing-page .saas-plan-card h5 { padding-inline: 0; font-size: 16px; }
.saas-billing-page .saas-plan-card-heading .saas-muted { display: block; margin-top: 3px; font-size: 10px; line-height: 1.45; }
.saas-billing-page .saas-plan-price { color: var(--subscription-accent); font-size: 19px; }
.saas-billing-page .saas-plan-price small { font-size: 10px; }
.saas-billing-page .saas-plan-limits { gap: 4px; padding: 2px 0 5px; font-size: 11px; }
.saas-billing-page .saas-plan-limits strong { color: var(--text-primary); }

.saas-billing-page .saas-owner-plan-list .saas-plan-card.is-current {
    border-color: color-mix(in srgb, var(--subscription-accent) 78%, #fff 0%);
    background: color-mix(in srgb, var(--subscription-accent-soft) 58%, var(--subscription-panel-soft));
}

.saas-billing-page .saas-owner-plan-list .saas-plan-card.is-selected {
    border-color: var(--subscription-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--subscription-accent) 22%, transparent), 0 14px 26px color-mix(in srgb, var(--subscription-accent) 13%, transparent);
}

.saas-billing-page .saas-owner-plan-list .saas-plan-card.is-current::before {
    top: 10px;
    inset-inline-start: 10px;
    padding: 3px 7px;
    border-color: color-mix(in srgb, var(--subscription-accent) 55%, var(--subscription-line));
    background: var(--subscription-accent-soft);
    color: color-mix(in srgb, var(--subscription-accent) 75%, #fff);
    font-size: 9px;
}

.saas-billing-page .saas-owner-plan-list .saas-plan-card.is-current h5 { padding-inline-start: 74px; }
.saas-billing-page .saas-owner-plan-list .saas-plan-card.is-current .btn { background: var(--subscription-accent); color: #fff; }
.saas-billing-page .saas-plan-entitlements { display: none; }
.saas-billing-page .saas-plan-card .btn { min-height: 36px; font-size: 11px; }

.saas-billing-page .saas-request-panel { display: flex; flex-direction: column; }
.saas-billing-page .saas-request-panel .saas-form-grid { flex: 1 1 auto; gap: 9px 12px; align-content: start; }
.saas-billing-page .saas-form-grid label { margin-bottom: 4px; font-size: 11px; }
.saas-billing-page .saas-form-grid input,
.saas-billing-page .saas-form-grid select,
.saas-billing-page .saas-form-grid textarea { border-color: var(--subscription-line); background: var(--subscription-panel-soft); }
.saas-billing-page .saas-form-grid select,
.saas-billing-page .saas-form-grid textarea { min-height: 42px; }
.saas-billing-page .saas-form-grid textarea { min-height: 64px; }

.saas-billing-page .saas-upload-box {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 87px;
    padding: 10px 12px;
    border-color: color-mix(in srgb, var(--subscription-accent) 38%, var(--subscription-line));
    background: var(--subscription-panel-soft);
}

.saas-billing-page .saas-upload-icon { width: 32px; height: 32px; border-radius: 9px; }
.saas-billing-page .saas-upload-icon .ui-icon { width: 16px; height: 16px; }
.saas-billing-page .saas-upload-box strong { display: block; font-size: 12px; }
.saas-billing-page .saas-upload-box small { display: block; margin-top: 3px; color: var(--subscription-muted); font-size: 10px; }
.saas-billing-page .saas-upload-box input[type="file"] { width: 132px; min-width: 0; color: var(--subscription-muted); font-size: 10px; }
.saas-billing-page .saas-upload-box input[type="file"]::file-selector-button { margin-inline-end: 5px; padding: 6px 8px; border: 1px solid var(--subscription-line); border-radius: 7px; background: var(--subscription-panel); color: var(--text-primary); font: inherit; cursor: pointer; }
.saas-billing-page .saas-form-actions { justify-content: flex-end; padding-top: 2px; }
.saas-billing-page .saas-form-actions .btn { min-width: 190px; min-height: 42px; padding-inline: 18px; }
.saas-billing-page .saas-requests-panel { margin-top: 0; }
.saas-billing-page .saas-requests-panel .saas-panel-head { margin-bottom: 10px; }
.saas-billing-page .saas-table-wrap { border-color: var(--subscription-line); }

@media (max-width: 1279px) {
    .saas-billing-page .saas-subscription-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .saas-billing-page .saas-summary-status { grid-column: span 2; }
    .saas-billing-page .saas-billing-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .saas-billing-page .saas-owner-plan-list .saas-plan-card { padding-inline: 12px; }
}

@media (max-width: 1080px) {
    .saas-billing-page .saas-billing-grid { grid-template-columns: 1fr; }
    .saas-billing-page .saas-billing-grid > .saas-plans-panel { order: 1; }
    .saas-billing-page .saas-billing-grid > .saas-request-panel { order: 2; }
}

@media (max-width: 820px) {
    .saas-billing-page { width: calc(100% - 24px); padding-top: 14px; }
    .saas-billing-page .saas-page-header { gap: 14px; }
    .saas-billing-page .saas-subscription-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .saas-billing-page .saas-summary-status { grid-column: 1 / -1; order: -1; }
    .saas-billing-page .saas-owner-plan-list { grid-template-columns: 1fr; height: auto; }
    .saas-billing-page .saas-owner-plan-list .saas-plan-card { min-height: 0; }
}

@media (max-width: 560px) {
    .saas-billing-page { width: calc(100% - 24px); gap: 12px; }
    .saas-billing-page .saas-page-header { flex-direction: column; }
    .saas-page-header-nav { width: 100%; grid-template-columns: auto 1fr; align-items: center; justify-items: start; }
    .saas-breadcrumb { justify-self: end; }
    .saas-billing-page .saas-subscription-summary { gap: 9px; }
    .saas-billing-page .saas-summary-card { min-height: 80px; padding: 12px; }
    .saas-billing-page .saas-summary-card strong { font-size: 17px; }
    .saas-billing-page .saas-panel { padding: 14px; }
    .saas-billing-page .saas-panel-head { flex-direction: column; gap: 7px; }
    .saas-billing-page .saas-panel-badge { align-self: flex-start; }
    .saas-billing-page .saas-upload-box { grid-template-columns: auto minmax(0, 1fr); }
    .saas-billing-page .saas-upload-box input[type="file"] { grid-column: 1 / -1; width: 100%; }
    .saas-billing-page .saas-form-actions .btn { width: 100%; }
    .saas-billing-page .saas-table-wrap { overflow: visible; border: 0; }
}

@media (max-width: 389px) {
    .saas-billing-page { width: calc(100% - 20px); padding-top: 10px; }
    .saas-billing-page .saas-subscription-summary { grid-template-columns: 1fr; }
    .saas-billing-page .saas-summary-status { grid-column: auto; }
    .saas-billing-page .saas-page-heading h3 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .saas-billing-page .saas-plan-card { transition: none; }
}

/* Current plan and payment proof polish: one source of truth for plans and a
   clear, touch-friendly upload surface. */
.saas-billing-page .saas-owner-plan-list .saas-plan-card.is-current .btn-current-plan {
    min-height: 38px;
    border: 1px solid color-mix(in srgb, var(--subscription-accent) 50%, var(--subscription-line));
    background: var(--subscription-accent-soft);
    color: var(--subscription-accent);
    cursor: default;
    opacity: 1;
}

.saas-billing-page .saas-owner-plan-list .saas-plan-card:not(.is-current) .btn-light:hover {
    border-color: var(--subscription-accent);
    color: var(--subscription-accent);
}

.saas-billing-page .saas-upload-box {
    position: relative;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 104px;
    padding: 14px 16px;
    border: 1px dashed color-mix(in srgb, var(--subscription-accent) 46%, var(--subscription-line));
    background: linear-gradient(135deg, color-mix(in srgb, var(--subscription-accent-soft) 72%, var(--subscription-panel-soft)), var(--subscription-panel-soft));
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.saas-billing-page .saas-upload-box.is-dragging,
.saas-billing-page .saas-upload-box:focus-within {
    border-color: var(--subscription-accent);
    background: color-mix(in srgb, var(--subscription-accent-soft) 86%, var(--subscription-panel-soft));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--subscription-accent) 16%, transparent);
}

.saas-billing-page .saas-upload-box.has-file {
    border-style: solid;
    border-color: color-mix(in srgb, var(--success) 56%, var(--subscription-line));
    background: color-mix(in srgb, var(--success-soft) 62%, var(--subscription-panel-soft));
}

.saas-billing-page .saas-upload-box > div { min-width: 0; }

.saas-billing-page .saas-upload-file-name {
    display: block;
    max-width: 100%;
    margin-top: 5px;
    overflow: hidden;
    color: var(--subscription-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saas-billing-page .saas-upload-box.has-file .saas-upload-file-name {
    color: var(--success-text);
    font-weight: 700;
}

.saas-billing-page .saas-upload-trigger {
    min-width: 104px;
    min-height: 44px;
    padding: 8px 13px;
    border: 1px solid color-mix(in srgb, var(--subscription-accent) 50%, var(--subscription-line));
    border-radius: 9px;
    background: var(--subscription-panel);
    color: var(--subscription-accent);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.saas-billing-page .saas-upload-trigger:hover {
    background: var(--subscription-accent);
    color: #fff;
    transform: translateY(-1px);
}

.saas-billing-page .saas-upload-trigger:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--subscription-accent) 35%, transparent);
    outline-offset: 2px;
}

.saas-billing-page .saas-upload-box input[type="file"] {
    position: absolute;
    width: 1px !important;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 560px) {
    .saas-billing-page .saas-upload-box {
        grid-template-columns: auto minmax(0, 1fr);
        min-height: 122px;
    }

    .saas-billing-page .saas-upload-trigger {
        grid-column: 1 / -1;
        width: 100%;
    }
}

/* Full-width plan comparison with feature-led cards. */
.saas-billing-page .saas-billing-grid {
    display: block;
}

.saas-billing-page .saas-plans-panel {
    width: 100%;
    min-height: 0;
}

.saas-billing-page .saas-owner-plan-list {
    height: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.saas-billing-page .saas-owner-plan-list .saas-plan-card {
    min-height: 100%;
    grid-template-rows: auto auto auto 1fr auto;
    gap: 14px;
    padding: 20px;
    background: linear-gradient(180deg, var(--subscription-panel-soft), color-mix(in srgb, var(--subscription-panel) 82%, var(--subscription-panel-soft)));
}

.saas-billing-page .saas-owner-plan-list .saas-plan-card.is-current {
    border-width: 2px;
}

.saas-billing-page .saas-plan-features {
    min-width: 0;
    padding-top: 4px;
    border-top: 1px solid var(--subscription-line);
}

.saas-billing-page .saas-plan-features-title {
    display: block;
    margin-bottom: 9px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 800;
}

.saas-billing-page .saas-plan-features > ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.saas-billing-page .saas-plan-features li {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.45;
}

.saas-billing-page .saas-plan-feature-check {
    display: inline-grid;
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--success) 62%, transparent);
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success-text);
    font-size: 12px;
    font-weight: 900;
}

.saas-billing-page .saas-plan-feature-empty {
    grid-column: 1 / -1;
    color: var(--subscription-muted);
}

.saas-billing-page .saas-request-open {
    min-width: 216px;
    min-height: 52px;
    margin-inline-start: auto;
    padding-inline: 24px;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.35;
    white-space: nowrap;
    box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 20%, transparent);
}

.saas-billing-page .saas-request-open span:last-child {
    display: inline-block;
    min-width: max-content;
}

body .saas-billing-page .saas-request-open,
body .saas-billing-page .saas-request-open span {
    color: #fff !important;
}

.saas-billing-page .saas-plan-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding: 12px 16px;
    border: 1px solid var(--subscription-line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--subscription-panel) 82%, var(--subscription-accent-soft));
}

.saas-billing-page .saas-plan-action-bar > div {
    display: grid;
    gap: 3px;
}

.saas-billing-page .saas-plan-action-bar span {
    color: var(--subscription-muted);
    font-size: 11px;
}

.saas-billing-page .saas-plan-action-bar strong {
    color: var(--text-primary);
    font-size: 14px;
}

.saas-billing-page .saas-request-current {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--subscription-accent) 32%, var(--subscription-line));
    border-radius: 12px;
    background: color-mix(in srgb, var(--subscription-accent-soft) 58%, var(--subscription-panel-soft));
}

.saas-billing-page .saas-request-current-icon {
    display: inline-grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success-text);
    font-weight: 900;
}

.saas-billing-page .saas-request-current div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.saas-billing-page .saas-request-current small,
.saas-billing-page .saas-request-current span:not(.saas-request-current-icon) {
    color: var(--subscription-muted);
    font-size: 11px;
}

.saas-billing-page .saas-request-current strong {
    color: var(--text-primary);
    font-size: 14px;
}

.saas-request-dialog {
    width: min(700px, calc(100vw - 32px));
    max-width: 700px;
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--subscription-line, var(--border-secondary));
    border-radius: 18px;
    background: var(--subscription-page, var(--bg-card));
    color: var(--text-primary);
    box-shadow: 0 24px 70px rgba(1, 8, 20, .34);
}

.saas-request-dialog::backdrop {
    background: rgba(2, 10, 24, .62);
    backdrop-filter: blur(3px);
}

.saas-request-dialog .saas-request-panel {
    min-height: 0;
    max-height: calc(100dvh - 32px);
    overflow: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.saas-request-dialog .saas-request-dialog-close {
    min-height: 38px;
}

@media (max-width: 820px) {
    .saas-billing-page .saas-owner-plan-list {
        grid-template-columns: repeat(3, minmax(230px, 1fr));
        overflow-x: auto;
        padding-bottom: 10px;
    }
}

@media (max-width: 560px) {
    .saas-billing-page .saas-plan-action-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .saas-billing-page .saas-page-header {
        align-items: stretch;
    }

    .saas-billing-page .saas-request-open {
        width: 100%;
        margin-inline-start: 0;
    }

    .saas-billing-page .saas-owner-plan-list {
        display: grid;
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .saas-billing-page .saas-plan-features > ul {
        grid-template-columns: 1fr;
    }

    .saas-request-dialog {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
    }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/register-gym.css */
/* Logic Fit registration flow — one coherent source for the public wizard. */
.public-registration-page {
  min-height: 100dvh;
  background: var(--bg-app);
  color: var(--text-primary);
}

.registration-shell {
  box-sizing: border-box;
  width: min(100% - 48px, 1280px);
  min-height: 100dvh;
  margin-inline: auto;
  padding-block: var(--space-5) var(--space-10);
}

.registration-header,
.registration-header-actions,
.registration-brand,
.registration-safe-note,
.registration-actions,
.registration-card-badge,
.registration-payment-top,
.registration-plan-top,
.registration-review-row,
.registration-review-total,
.registration-file-preview,
.registration-success,
.registration-aside-foot {
  display: flex;
  align-items: center;
}

.registration-header {
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.registration-brand {
  min-width: 0;
  gap: var(--space-3);
  color: var(--text-primary);
}

.registration-brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--brand-image-radius);
  background: transparent;
  color: var(--primary);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
}

.registration-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.registration-brand > span:last-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.registration-brand strong,
.registration-brand small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-brand strong {
  color: var(--text-primary);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
  line-height: 1.25;
}

.registration-brand small,
.registration-safe-note {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.registration-header-actions {
  flex: 0 0 auto;
  gap: var(--space-2);
}

.registration-return,
.registration-safe-note,
.registration-header .theme-toggle-button {
  min-height: 40px;
}

.registration-return,
.registration-header .theme-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.registration-return {
  gap: var(--space-2);
  padding-inline: var(--space-4);
}

.registration-return span {
  color: var(--primary);
  font-size: var(--font-md);
  line-height: 1;
}

.registration-return:hover,
.registration-return:focus-visible,
.registration-header .theme-toggle-button:hover,
.registration-header .theme-toggle-button:focus-visible {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-1px);
}

.registration-header .theme-toggle-button {
  width: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: var(--font-lg);
}

.registration-header .theme-toggle-button span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.registration-safe-note {
  gap: var(--space-2);
  color: var(--success-text);
}

.registration-safe-note span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  font-weight: var(--weight-bold);
}

.registration-progress {
  overflow: hidden;
  margin-bottom: var(--space-5);
  padding: var(--space-2) var(--space-3) 0;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.registration-type-switch {
  display: grid;
  grid-template-columns: minmax(190px, .7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 54%, var(--bg-card)), var(--bg-card));
  box-shadow: var(--shadow-md);
}

.registration-type-switch-intro {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.registration-type-switch-eyebrow {
  color: var(--primary);
  font-size: 0.6875rem;
  font-weight: var(--weight-bold);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.registration-type-switch-label {
  color: var(--text-primary);
  font-size: clamp(1.1rem, 1rem + .35vw, 1.35rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.35;
}

.registration-type-switch-helper {
  max-width: 250px;
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.65;
}

.registration-type-switch-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.registration-type-switch-options a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 84px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-muted);
  text-align: start;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.registration-type-switch-options a:hover,
.registration-type-switch-options a:focus-visible {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}

.registration-type-switch-options a.is-active {
  color: var(--text-on-primary);
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-primary-strong);
}

.registration-type-option-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
}

.registration-type-option-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.registration-type-switch-options a.is-active .registration-type-option-icon {
  border-color: rgb(255 255 255 / .25);
  background: rgb(255 255 255 / .16);
  color: var(--text-on-primary);
}

.registration-type-option-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.registration-type-option-copy strong {
  overflow: hidden;
  color: currentColor;
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-type-option-copy small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-type-switch-options a.is-active .registration-type-option-copy small {
  color: rgb(255 255 255 / .8);
}

.registration-type-option-arrow {
  color: var(--primary);
  font-size: var(--font-lg);
  font-weight: var(--weight-bold);
  line-height: 1;
}

.registration-type-switch-options a.is-active .registration-type-option-arrow {
  color: var(--text-on-primary);
}

.registration-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.registration-steps li {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-inline-end: 1px solid var(--border-secondary);
  color: var(--text-muted);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.registration-steps li:last-child {
  border-inline-end: 0;
}

.registration-steps li::after {
  position: absolute;
  inset-inline: var(--space-2);
  inset-block-end: 0;
  height: 2px;
  border-radius: var(--radius-pill);
  background: transparent;
  content: "";
}

.registration-steps li.is-current {
  color: var(--text-primary);
}

.registration-steps li.is-current::after {
  background: var(--primary);
}

.registration-steps li.is-complete {
  color: var(--text-secondary);
}

.registration-steps li > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.registration-steps li.is-current > span,
.registration-steps li.is-complete > span {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-on-primary);
}

.registration-steps li > div {
  display: grid;
  min-width: 0;
  gap: 1px;
  text-align: start;
}

.registration-steps strong,
.registration-steps small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-steps strong {
  color: inherit;
  font-size: var(--font-sm);
}

.registration-steps small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.registration-main {
  display: grid;
  grid-template-columns: minmax(300px, .82fr) minmax(0, 1.35fr);
  gap: clamp(var(--space-6), 4vw, var(--space-10));
  align-items: stretch;
  direction: ltr;
}

.registration-aside,
.registration-card {
  min-width: 0;
  direction: rtl;
}

.registration-aside {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
  padding: var(--space-8) var(--space-6) var(--space-5);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.registration-aside::before {
  position: absolute;
  inset: 0 0 auto;
  height: 150px;
  background: var(--primary-soft);
  content: "";
  opacity: .38;
  pointer-events: none;
}

.registration-aside-copy,
.registration-aside-visual,
.registration-aside-foot {
  position: relative;
  z-index: 1;
}

.registration-kicker {
  display: inline-flex;
  color: var(--primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: .04em;
}

.registration-aside-copy h1 {
  max-width: 360px;
  margin-top: var(--space-3);
  color: var(--text-primary);
  font-size: clamp(2.15rem, 3.6vw, 3.3rem);
  line-height: 1.15;
  letter-spacing: -.04em;
}

.registration-aside-copy p {
  max-width: 360px;
  margin-top: var(--space-4);
  color: var(--text-muted);
  font-size: var(--font-md);
  line-height: 1.85;
}

.registration-aside-visual {
  overflow: hidden;
  height: 178px;
  margin: var(--space-7) calc(var(--space-6) * -1) 0;
  border-block: 1px solid var(--border-secondary);
  background: var(--bg-surface);
}

.registration-aside-visual::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 28%, var(--bg-surface) 145%);
  content: "";
  opacity: .32;
  pointer-events: none;
}

.registration-aside-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(1.1) contrast(.9) saturate(.78);
}

.registration-aside-foot {
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-5);
}

.registration-foot-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
}

.registration-aside-foot p {
  display: grid;
  gap: 2px;
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.65;
}

.registration-aside-foot p strong {
  color: var(--text-primary);
  font-size: var(--font-sm);
}

.registration-card {
  padding: clamp(var(--space-6), 3vw, var(--space-9));
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.registration-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-secondary);
}

.registration-card-head h2 {
  margin-top: var(--space-1);
  color: var(--text-primary);
  font-size: clamp(1.7rem, 2.8vw, 2.25rem);
  line-height: 1.25;
}

.registration-card-head p {
  max-width: 620px;
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-sm);
  line-height: 1.75;
}

.registration-card-badge {
  flex: 0 0 auto;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.registration-card-badge > span {
  font-size: 8px;
}

.registration-error {
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: var(--font-sm);
  line-height: 1.65;
}

.registration-step-panel {
  padding-top: var(--space-6);
}

.registration-step-panel[hidden] {
  display: none;
}

.registration-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.registration-field {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
}

.registration-field-wide {
  grid-column: 1 / -1;
}

.registration-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

.registration-field > span b {
  color: var(--danger);
}

.registration-field > span small {
  color: var(--text-muted);
  font-weight: var(--weight-regular);
}

.registration-field input,
.registration-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.registration-field textarea {
  min-height: 92px;
  resize: vertical;
}

.registration-field input:hover,
.registration-field textarea:hover {
  border-color: var(--border-hover);
}

.registration-field input:focus,
.registration-field textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  outline: 0;
}

.registration-section-intro {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.registration-step-number {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.registration-section-intro h3 {
  color: var(--text-primary);
  font-size: var(--font-lg);
}

.registration-section-intro p {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--font-sm);
  line-height: 1.7;
}

.registration-plan-grid,
.registration-term-grid,
.registration-payment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.registration-plan-option,
.registration-term-option,
.registration-payment-option {
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}

.registration-plan-option input,
.registration-term-option input,
.registration-payment-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.registration-plan-content,
.registration-term-option > span,
.registration-payment-content {
  display: grid;
  min-height: 100%;
  padding: var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.registration-plan-option:hover .registration-plan-content,
.registration-term-option:hover > span,
.registration-payment-option:hover .registration-payment-content {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.registration-plan-option input:focus-visible + .registration-plan-content,
.registration-term-option input:focus-visible + span,
.registration-payment-option input:focus-visible + .registration-payment-content {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.registration-plan-option input:checked + .registration-plan-content,
.registration-term-option input:checked + span,
.registration-payment-option input:checked + .registration-payment-content {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-border);
}

.registration-plan-top,
.registration-payment-top {
  justify-content: space-between;
  gap: var(--space-3);
}

.registration-plan-top strong,
.registration-payment-top strong,
.registration-term-option strong {
  color: var(--text-primary);
  font-size: var(--font-md);
}

.registration-select-dot {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
}

.registration-plan-option input:checked + .registration-plan-content .registration-select-dot,
.registration-payment-option input:checked + .registration-payment-content .registration-select-dot {
  border: 4px solid var(--primary);
}

.registration-plan-content > small,
.registration-payment-content > small,
.registration-term-option small {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.registration-plan-limit {
  display: inline-flex;
  width: fit-content;
  margin-top: var(--space-3);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  font-size: var(--font-xs);
}

.registration-payment-content > b {
  margin-top: var(--space-3);
  color: var(--text-primary);
  font-size: var(--font-lg);
  letter-spacing: .02em;
}

.registration-payment-content > small + small {
  margin-top: var(--space-1);
}

.registration-price-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-lg);
  background: var(--success-soft);
}

.registration-price-summary span {
  display: grid;
  gap: var(--space-1);
}

.registration-price-summary small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.registration-price-summary strong,
.registration-price-summary b {
  color: var(--success-text);
}

.registration-price-summary strong {
  font-size: var(--font-xl);
}

.registration-price-summary b {
  font-size: var(--font-sm);
}

.registration-upload {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.registration-upload:hover,
.registration-upload:focus-within {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.registration-upload-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--text-on-primary);
  font-size: var(--font-xl);
}

.registration-upload strong {
  color: var(--text-primary);
}

.registration-upload small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.registration-file-preview {
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.registration-file-preview > span:nth-child(2) {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: var(--space-1);
}

.registration-file-preview strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-file-preview small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.registration-file-icon {
  color: var(--primary);
  font-size: var(--font-xl);
}

.registration-file-preview button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--font-lg);
}

.registration-privacy-note {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.7;
}

.registration-privacy-note span {
  color: var(--success);
}

.registration-review {
  overflow: hidden;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.registration-review-row {
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-secondary);
}

.registration-review-row span {
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.registration-review-row strong {
  max-width: 64%;
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-review-total {
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--primary-soft);
  color: var(--text-primary);
}

.registration-review-total strong {
  color: var(--primary);
  font-size: var(--font-xl);
}

.registration-notes-field {
  margin-top: var(--space-5);
}

.registration-actions {
  gap: var(--space-3);
  min-height: 48px;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-secondary);
}

.registration-back {
  flex: 0 0 auto;
}

.registration-next {
  min-width: 154px;
  margin-inline-start: auto;
  box-shadow: var(--shadow-sm);
}

.registration-action-hint {
  color: var(--text-muted);
  font-size: var(--font-xs);
  line-height: 1.6;
}

.registration-loading,
.registration-empty {
  grid-column: 1 / -1;
  padding: var(--space-7);
  border: 1px dashed var(--border-primary);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  text-align: center;
}

.registration-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.logicfit-inline-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid var(--primary-border);
  border-top-color: var(--primary);
  border-radius: var(--radius-pill);
  animation: registration-spin 800ms linear infinite;
}

.registration-success {
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-3) var(--space-4);
  text-align: center;
}

.registration-success-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin-bottom: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: 2rem;
  font-weight: var(--weight-bold);
}

.registration-success h3 {
  color: var(--text-primary);
  font-size: var(--font-2xl);
}

.registration-success p {
  max-width: 510px;
  color: var(--text-muted);
  font-size: var(--font-sm);
  line-height: 1.9;
}

.registration-reference {
  display: grid;
  gap: var(--space-1);
  min-width: 160px;
  margin: var(--space-2) 0 var(--space-3);
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.registration-reference small {
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.registration-reference strong {
  color: var(--primary);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
}

@keyframes registration-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
  .registration-main {
    grid-template-columns: minmax(260px, .74fr) minmax(0, 1.26fr);
    gap: var(--space-6);
  }

  .registration-aside {
    padding-inline: var(--space-5);
  }

  .registration-aside-visual {
    margin-inline: calc(var(--space-5) * -1);
  }
}

@media (max-width: 900px) {
  .registration-main {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .registration-card {
    grid-row: 1;
  }

  .registration-aside {
    grid-row: 2;
    min-height: auto;
  }

  .registration-aside-copy h1,
  .registration-aside-copy p {
    max-width: 640px;
  }

  .registration-aside-foot {
    margin-top: var(--space-5);
  }

  .registration-steps li {
    padding-inline: var(--space-2);
  }

  .registration-steps li > div {
    display: none;
  }
}

@media (max-width: 620px) {
  .registration-shell {
    width: calc(100% - 20px);
    padding-block: var(--space-3) var(--space-7);
  }

  .registration-header {
    align-items: center;
    margin-bottom: var(--space-3);
  }

  .registration-type-switch {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-2);
  }

  .registration-type-switch-intro {
    padding: var(--space-2) var(--space-2) 0;
  }

  .registration-type-switch-label {
    padding-inline: var(--space-1);
  }

  .registration-type-switch-options {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .registration-type-switch-options a {
    min-height: 72px;
    padding: var(--space-3);
  }

  .registration-header-actions {
    gap: var(--space-1);
  }

  .registration-brand {
    gap: var(--space-2);
  }

  .registration-brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .registration-brand strong {
    font-size: var(--font-md);
  }

  .registration-brand small,
  .registration-safe-note {
    display: none;
  }

  .registration-return {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 0;
  }

  .registration-return span {
    font-size: var(--font-lg);
  }

  .registration-progress {
    margin-bottom: var(--space-4);
    padding: var(--space-1) var(--space-1) 0;
    border-radius: var(--radius-md);
  }

  .registration-steps li {
    min-height: 48px;
    padding: var(--space-2) var(--space-1) var(--space-2);
  }

  .registration-steps li::after {
    inset-inline: var(--space-1);
  }

  .registration-steps li > span {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    font-size: 10px;
  }

  .registration-card {
    padding: var(--space-5) var(--space-4);
    border-radius: var(--radius-lg);
  }

  .registration-card-head {
    gap: var(--space-3);
  }

  .registration-card-head h2 {
    font-size: 1.55rem;
  }

  .registration-card-head p {
    font-size: var(--font-xs);
  }

  .registration-card-badge {
    padding: var(--space-2);
    font-size: 0;
  }

  .registration-card-badge > span {
    font-size: 8px;
  }

  .registration-form-grid,
  .registration-plan-grid,
  .registration-term-grid,
  .registration-payment-grid {
    grid-template-columns: 1fr;
  }

  .registration-field-wide {
    grid-column: auto;
  }

  .registration-aside {
    padding: var(--space-6) var(--space-4) var(--space-4);
    border-radius: var(--radius-lg);
  }

  .registration-aside-copy h1 {
    font-size: clamp(2rem, 10vw, 2.7rem);
  }

  .registration-aside-copy p {
    font-size: var(--font-sm);
  }

  .registration-aside-visual {
    height: 160px;
    margin-inline: calc(var(--space-4) * -1);
  }

  .registration-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .registration-action-hint {
    order: 3;
    flex-basis: 100%;
  }

  .registration-next {
    min-width: 0;
    flex: 1;
  }

  .registration-review-row {
    align-items: flex-start;
  }

  .registration-review-row strong {
    max-width: 56%;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logicfit-inline-spinner {
    animation: none;
  }

  .registration-steps li,
  .registration-return,
  .registration-header .theme-toggle-button,
  .registration-plan-content,
  .registration-term-option > span,
  .registration-payment-content,
  .registration-field input,
  .registration-field textarea,
  .registration-upload {
    transition: none;
  }
}

html[data-theme="dark"] .registration-aside-visual img {
  filter: brightness(.86) contrast(.92) saturate(.76);
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/platform-admin.css */
/* Platform Admin is a separate product surface. It consumes the same
   semantic tokens as the gym app, but owns its layout and navigation. */
.platform-admin-page {
    --platform-sidebar: var(--bg-sidebar);
    --platform-topbar: var(--bg-header);
    --platform-surface: var(--bg-card);
    --platform-surface-2: var(--bg-elevated);
    --platform-border: var(--border-primary);
    --platform-muted: var(--text-muted);
    --platform-purple: var(--primary);
    min-height: 100vh;
    background: var(--bg-app);
    color: var(--text-primary);
}

.platform-admin-page * { scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
.platform-admin-page ::-webkit-scrollbar { width: 8px; height: 8px; }
.platform-admin-page ::-webkit-scrollbar-track { background: var(--scrollbar-track); }
.platform-admin-page ::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--radius-pill); }
.platform-admin-page ::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

.platform-admin-page button,
.platform-admin-page input,
.platform-admin-page select,
.platform-admin-page textarea { font-family: inherit; }

.platform-admin-page,
.platform-admin-page * { min-width: 0; }

.platform-login-screen {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow: hidden;
    padding: var(--space-6);
    background: radial-gradient(circle at 20% 10%, var(--primary-soft), transparent 30%), var(--bg-app);
}
.platform-login-glow { position: absolute; width: 420px; height: 420px; border-radius: 50%; background: var(--primary-soft); filter: blur(80px); opacity: .7; inset: auto auto -180px -120px; pointer-events: none; }
.platform-login-card { position: relative; width: min(100%, 480px); padding: clamp(24px, 5vw, 44px); border: 1px solid var(--platform-border); border-radius: 24px; background: var(--platform-surface); box-shadow: var(--shadow-popup); }
.platform-login-theme { position: absolute; top: 20px; inset-inline-start: 20px; }
.platform-login-brand, .platform-sidebar-brand, .platform-admin-identity { display: flex; align-items: center; gap: 12px; }
.platform-brand-mark { display: grid; width: 46px; height: 46px; flex: 0 0 46px; place-items: center; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-active)); color: var(--text-on-primary); font-size: 1.45rem; font-weight: 800; box-shadow: var(--shadow-primary); }
.platform-login-brand strong, .platform-sidebar-brand strong { display: block; color: var(--text-primary); font-size: 1.1rem; }
.platform-login-brand small, .platform-sidebar-brand small, .platform-admin-identity small { display: block; margin-top: 2px; color: var(--text-muted); font-size: .68rem; letter-spacing: .04em; }
.platform-login-heading { margin: 44px 0 24px; }
.platform-login-heading h1 { margin-top: 10px; color: var(--text-primary); font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.35; }
.platform-login-heading p { margin-top: 10px; color: var(--text-muted); font-size: .9rem; }
.eyebrow { color: var(--text-primary-soft); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.platform-form { display: grid; gap: 16px; }
.platform-field { display: grid; gap: 7px; color: var(--text-secondary); font-size: .82rem; font-weight: 700; }
.platform-field input, .platform-form input, .platform-dialog input, .platform-dialog select, .platform-dialog textarea, .directory-toolbar select, .platform-global-search input, .platform-search-field input { min-width: 0; border: 1px solid var(--platform-border); border-radius: 10px; background: var(--bg-input); color: var(--text-primary); outline: none; padding: 11px 13px; transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast); }
.platform-field input::placeholder, .platform-dialog textarea::placeholder, .platform-global-search input::placeholder, .platform-search-field input::placeholder { color: var(--text-disabled); }
.platform-field input:focus, .platform-dialog input:focus, .platform-dialog select:focus, .platform-dialog textarea:focus, .directory-toolbar select:focus, .platform-global-search input:focus, .platform-search-field input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.platform-form-message { padding: 10px 12px; border: 1px solid var(--danger-border); border-radius: 10px; background: var(--danger-soft); color: var(--danger-text); font-size: .8rem; }
.platform-login-foot { margin-top: 24px; color: var(--text-disabled); font-size: .73rem; text-align: center; }

/* Keep the platform entry point on the same Logic Fit authentication card
   language as the shared login surface without changing its auth flow. */
.platform-login-screen {
    --platform-login-bg: #f3f7fc;
    --platform-login-surface: rgb(255 255 255 / .9);
    --platform-login-border: #d7e5f7;
    --platform-login-text: #0b1e42;
    --platform-login-muted: #6d7d98;
    --platform-login-blue: #1769e8;
    background:
        radial-gradient(circle at 16% 18%, rgb(23 105 232 / .1), transparent 32%),
        linear-gradient(135deg, #f8fbff, var(--platform-login-bg));
}
html[data-theme="dark"] .platform-login-screen {
    --platform-login-bg: #020b18;
    --platform-login-surface: rgb(7 22 41 / .88);
    --platform-login-border: rgb(137 171 218 / .32);
    --platform-login-text: #f7fbff;
    --platform-login-muted: #a7b8d0;
    --platform-login-blue: #2584ff;
    background:
        radial-gradient(circle at 16% 18%, rgb(23 105 232 / .16), transparent 32%),
        linear-gradient(135deg, #07172a, var(--platform-login-bg));
}
.platform-login-card {
    width: min(100%, 550px);
    padding: clamp(28px, 3.6vw, 46px) clamp(24px, 3.6vw, 42px) clamp(24px, 3vw, 34px);
    border: 1px solid var(--platform-login-border);
    border-radius: 28px;
    background: var(--platform-login-surface);
    box-shadow: 0 28px 70px rgb(20 67 129 / .16);
    backdrop-filter: blur(18px);
}
.platform-login-theme { color: var(--platform-login-text); }
.platform-login-brand { display: grid; justify-items: center; gap: 10px; text-align: center; }
.platform-login-card .platform-brand-mark { background: linear-gradient(135deg, #168ff9, #1655e8); box-shadow: 0 14px 28px rgb(23 105 232 / .26); }
.platform-login-brand > div { display: grid; gap: 3px; }
.platform-login-brand strong { color: var(--platform-login-text); font-size: 1.7rem; }
.platform-login-brand small { color: var(--platform-login-muted); font-size: .62rem; letter-spacing: .08em; }
.platform-login-heading { margin: 28px 0 22px; text-align: center; }
.platform-login-heading h1 { color: var(--platform-login-text); font-size: clamp(1.42rem, 2.2vw, 1.8rem); }
.platform-login-heading p { color: var(--platform-login-muted); font-size: .82rem; }
.platform-field { color: var(--platform-login-text); }
.platform-field input {
    min-height: 58px;
    border-color: var(--platform-login-border);
    border-radius: 14px;
    background: rgb(248 251 255 / .78);
    color: var(--platform-login-text);
}
html[data-theme="dark"] .platform-field input { background: rgb(10 30 53 / .78); }
.platform-field input:focus { border-color: var(--platform-login-blue); box-shadow: 0 0 0 4px rgb(23 105 232 / .12); }
.platform-btn.primary.full {
    min-height: 62px;
    border-radius: 14px;
    background: linear-gradient(135deg, #168ff9, #2d56ec);
    box-shadow: 0 14px 24px rgb(23 105 232 / .22);
}
.platform-login-foot { color: var(--platform-login-muted); }

.platform-shell { display: flex; min-height: 100vh; background: var(--bg-app); direction: rtl; }
.platform-sidebar { position: sticky; z-index: 40; top: 0; display: flex; width: 274px; min-width: 274px; height: 100vh; flex: 0 0 274px; flex-direction: column; overflow-y: auto; padding: 24px 16px 16px; border-left: 1px solid var(--border-secondary); background: var(--platform-sidebar); color: var(--sidebar-text); direction: rtl; }
.platform-sidebar-brand { padding: 0 8px 28px; }
.platform-sidebar-caption { margin: 0 12px 10px; color: var(--sidebar-text-muted); font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.platform-nav { display: grid; gap: 6px; }
.platform-nav-item { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 11px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--sidebar-text-muted); padding: 0 12px; font-size: .82rem; font-weight: 700; text-align: right; transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast); }
.platform-nav-item:hover, .platform-nav-item:focus-visible { border-color: var(--primary-border); background: var(--primary-soft); color: var(--text-primary); }
.platform-nav-item.active { border-color: var(--primary-border); background: linear-gradient(135deg, var(--primary), var(--primary-active)); color: var(--text-on-primary); box-shadow: var(--shadow-primary); }
.nav-icon { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border-radius: 8px; font-size: 1.05rem; line-height: 1; }
.platform-nav-item.active .nav-icon { background: rgb(255 255 255 / .14); }
.nav-count { display: grid; min-width: 22px; height: 22px; margin-inline-start: auto; place-items: center; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--text-primary-soft); font-size: .7rem; }
.platform-nav-item.active .nav-count { background: rgb(255 255 255 / .17); color: var(--text-on-primary); }
.platform-sidebar-footer { display: grid; gap: 13px; margin-top: auto; }
.platform-scope-card { display: flex; align-items: center; gap: 9px; margin: 0 2px; padding: 11px; border: 1px solid var(--sidebar-border); border-radius: 12px; background: rgb(255 255 255 / .04); }
.scope-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.platform-scope-card strong, .platform-scope-card small { display: block; }
.platform-scope-card strong { color: var(--sidebar-text); font-size: .73rem; }
.platform-scope-card small { margin-top: 2px; color: var(--sidebar-text-muted); font-size: .68rem; }
.logout-link { color: var(--danger-text); }
.logout-link:hover { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }

.platform-main { width: calc(100% - 274px); min-width: 0; flex: 1 1 auto; overflow-x: clip; }
.platform-topbar { position: sticky; z-index: 20; top: 0; display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: clamp(12px, 2vw, 24px); padding: 15px clamp(20px, 4vw, 44px); border-bottom: 1px solid var(--border-secondary); background: color-mix(in srgb, var(--platform-topbar) 96%, transparent); box-shadow: 0 8px 24px rgb(2 6 23 / .04); backdrop-filter: blur(14px); }
.platform-topbar-title { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; gap: 13px; }
.platform-topbar-title > div { min-width: 0; }
.platform-topbar-title h1 { overflow: hidden; margin-top: 3px; color: var(--text-primary); font-size: 1.22rem; text-overflow: ellipsis; white-space: nowrap; }
.mobile-menu-button { display: none; width: 34px; height: 34px; place-items: center; border: 1px solid var(--platform-border); border-radius: 9px; color: var(--text-secondary); cursor: pointer; }
.platform-topbar-actions { display: flex; min-width: 0; max-width: 58%; flex: 0 1 620px; align-items: center; gap: 12px; }
.platform-global-search { display: flex; width: clamp(180px, 24vw, 300px); min-width: 0; flex: 1 1 240px; align-items: center; gap: 8px; border: 1px solid var(--platform-border); border-radius: 10px; background: var(--bg-input); color: var(--text-muted); padding-inline: 11px; }
.platform-global-search input { width: 100%; border: 0; background: transparent; box-shadow: none; padding-inline: 0; }
.platform-global-search input:focus { box-shadow: none; }
.platform-icon-btn { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid var(--platform-border); border-radius: 10px; background: var(--platform-surface); color: var(--text-secondary); font-size: 1.05rem; }
.platform-icon-btn .ui-icon { width: 17px; height: 17px; }
.platform-icon-btn:hover, .platform-icon-btn:focus-visible { border-color: var(--primary-border); background: var(--primary-soft); color: var(--text-primary-soft); }
.platform-admin-identity { min-width: 0; max-width: 190px; padding-inline-start: 8px; }
.platform-admin-identity > div { min-width: 0; }
.admin-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--text-primary-soft); font-weight: 800; }
.platform-admin-identity strong { display: block; overflow: hidden; color: var(--text-primary); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.platform-content { width: min(100%, 1560px); margin: 0 auto; padding: clamp(22px, 4vw, 42px); }
.platform-view { display: none; animation: platform-fade-in .18s ease; }
.platform-view.active { display: block; }
@keyframes platform-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.platform-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.platform-page-head > div { min-width: 0; }
.platform-page-head h2 { margin-top: 5px; color: var(--text-primary); font-size: clamp(1.3rem, 2vw, 1.7rem); }
.platform-page-head p { margin-top: 5px; color: var(--text-muted); font-size: .82rem; }
.platform-page-head > .platform-btn { flex: 0 0 auto; align-self: flex-start; }
.platform-page-head > div { padding-inline-start: 2px; }

.platform-btn { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 10px; padding: 0 15px; color: var(--text-primary); font-size: .78rem; font-weight: 800; white-space: nowrap; transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), color var(--transition-fast); }
.platform-btn:hover:not(:disabled), .platform-link-btn:hover { transform: translateY(-1px); }
.platform-btn.primary { background: var(--primary); color: var(--text-on-primary); box-shadow: var(--shadow-primary); }
.platform-btn.primary:hover { background: var(--primary-hover); }
.platform-btn.ghost { border-color: var(--platform-border); background: transparent; color: var(--text-secondary); }
.platform-btn.ghost:hover { border-color: var(--border-hover); background: var(--platform-surface-2); color: var(--text-primary); }
.platform-btn.danger { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.platform-btn.danger:hover { border-color: var(--danger); background: var(--danger); color: var(--text-on-primary); }
.platform-btn.full { width: 100%; min-height: 47px; margin-top: 3px; }
.button-arrow { font-size: 1.05rem; }
.platform-link-btn { border: 0; background: transparent; color: var(--text-primary-soft); padding: 4px; font-size: .72rem; font-weight: 800; }

.platform-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.platform-kpi { display: grid; min-height: 138px; grid-template-rows: auto 1fr auto; gap: 9px; padding: 17px; border: 1px solid var(--platform-border); border-radius: 15px; background: var(--platform-surface); box-shadow: var(--shadow-card); }
.platform-kpi-top { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 10px; }
.platform-kpi-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--text-primary-soft); font-size: 1.05rem; line-height: 1; }
.platform-kpi-label { min-width: 0; color: var(--text-muted); font-size: .73rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.platform-kpi-value { align-self: end; overflow: hidden; color: var(--text-primary); font-size: clamp(1.45rem, 2.1vw, 1.8rem); font-variant-numeric: tabular-nums; font-weight: 800; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.platform-kpi-caption { overflow: hidden; color: var(--text-muted); font-size: .68rem; line-height: 1.45; overflow-wrap: anywhere; text-overflow: ellipsis; white-space: nowrap; }
.kpi-success .platform-kpi-icon { background: var(--success-soft); color: var(--success); }
.kpi-warning .platform-kpi-icon { background: var(--warning-soft); color: var(--warning); }
.kpi-danger .platform-kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi-info .platform-kpi-icon { background: var(--info-soft); color: var(--info); }
.platform-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(300px, .88fr); gap: 16px; margin-bottom: 16px; }
.lower-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.platform-card { min-width: 0; border: 1px solid var(--platform-border); border-radius: 15px; background: var(--platform-surface); box-shadow: var(--shadow-card); }
.status-overview-card, .quick-actions-card, .platform-dashboard-grid > .platform-card { padding: 20px; }
.card-heading { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.card-heading > div { min-width: 0; }
.card-heading h3 { margin-top: 4px; color: var(--text-primary); font-size: 1rem; }
.status-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.status-tile { padding: 12px 10px; border: 1px solid var(--platform-border); border-radius: 11px; background: var(--bg-surface); }
.status-tile strong { display: block; color: var(--text-primary); font-size: 1.15rem; }
.status-tile span { display: block; margin-top: 2px; color: var(--text-muted); font-size: .68rem; }
.status-tile.active { border-color: var(--success-border); background: var(--success-soft); }
.status-tile.trial { border-color: var(--info-border); background: var(--info-soft); }
.status-tile.suspended, .status-tile.expired { border-color: var(--warning-border); background: var(--warning-soft); }
.status-tile.archived { border-color: var(--border-primary); background: var(--bg-surface); }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-actions button { display: grid; min-height: 128px; align-content: start; border: 1px solid var(--platform-border); border-radius: 12px; background: var(--bg-surface); color: var(--text-secondary); padding: 15px; text-align: right; transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast); }
.quick-actions button:hover { transform: translateY(-1px); border-color: var(--primary-border); background: var(--primary-soft); }
.quick-actions button > span { display: grid; width: 31px; height: 31px; place-items: center; margin-bottom: 17px; border-radius: 9px; background: var(--primary-soft); color: var(--text-primary-soft); }
.quick-actions b, .quick-actions small { display: block; }
.quick-actions b { color: var(--text-primary); font-size: .75rem; }
.quick-actions small { margin-top: 3px; color: var(--text-muted); font-size: .65rem; }
.mini-tenant-list, .mini-activity-list { display: grid; gap: 4px; max-height: 302px; overflow: auto; }
.mini-tenant, .mini-activity { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border-secondary); padding: 8px 2px; }
.mini-tenant:last-child, .mini-activity:last-child { border-bottom: 0; }
.mini-tenant-main, .mini-activity-main { min-width: 0; }
.mini-tenant-main strong, .mini-tenant-main small, .mini-activity-main strong, .mini-activity-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-tenant-main strong, .mini-activity-main strong { color: var(--text-primary); font-size: .76rem; }
.mini-tenant-main small, .mini-activity-main small { margin-top: 2px; color: var(--text-muted); font-size: .65rem; }
.mini-tenant .status-pill { flex: 0 0 auto; }
.empty-inline { display: grid; min-height: 120px; place-items: center; color: var(--text-muted); font-size: .78rem; }

.directory-card { overflow: hidden; }
.directory-toolbar { display: flex; align-items: center; gap: 10px; padding: 15px; border-bottom: 1px solid var(--border-secondary); background: var(--bg-surface); }
.directory-toolbar.compact { justify-content: flex-start; }
.platform-search-field { display: flex; min-width: min(360px, 100%); flex: 1; align-items: center; gap: 8px; border: 1px solid var(--platform-border); border-radius: 10px; background: var(--bg-input); color: var(--text-muted); padding-inline: 11px; }
.platform-search-field input { width: 100%; border: 0; background: transparent; box-shadow: none; }
.platform-search-field input:focus { box-shadow: none; }
.directory-toolbar select { width: auto; min-width: 135px; padding: 9px 10px; }
.table-scroll { width: 100%; overflow-x: auto; }
.platform-table { width: 100%; min-width: 930px; table-layout: auto; }
.platform-table th { background: var(--table-header-bg); color: var(--text-muted); font-size: .68rem; font-weight: 800; white-space: nowrap; }
.platform-table td { border-top: 1px solid var(--border-secondary); color: var(--text-secondary); font-size: .72rem; vertical-align: middle; white-space: nowrap; }
.platform-table th, .platform-table td { padding: 12px 14px; text-align: right; }
.platform-table th { line-height: 1.4; }
.platform-table tbody tr { transition: background var(--transition-fast); }
.platform-table tbody tr:hover { background: var(--bg-card-hover); }
.tenant-cell strong, .tenant-cell small, .owner-cell strong, .owner-cell small { display: block; overflow: hidden; max-width: 180px; text-overflow: ellipsis; white-space: nowrap; }
.tenant-cell strong, .owner-cell strong { color: var(--text-primary); font-size: .76rem; }
.tenant-cell small, .owner-cell small { margin-top: 2px; color: var(--text-muted); font-size: .65rem; direction: ltr; text-align: right; }
.usage-cell { display: grid; gap: 4px; min-width: 115px; }
.usage-cell small { color: var(--text-muted); font-size: .64rem; }
.usage-bar, .progress-track { height: 5px; overflow: hidden; border-radius: var(--radius-pill); background: var(--border-secondary); }
.usage-bar i, .progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.status-pill { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--text-primary-soft); padding: 4px 8px; font-size: .63rem; font-weight: 800; }
.status-pill.active { background: var(--success-soft); color: var(--success-text); }
.status-pill.trial { background: var(--info-soft); color: var(--info-text); }
.status-pill.suspended, .status-pill.expired { background: var(--warning-soft); color: var(--warning-text); }
.status-pill.archived, .status-pill.cancelled { background: var(--danger-soft); color: var(--danger-text); }
.tenant-type-pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--platform-border); border-radius: var(--radius-pill); background: var(--bg-surface); color: var(--text-secondary); padding: 4px 8px; font-size: .62rem; font-weight: 800; white-space: nowrap; }
.tenant-type-pill.gym { border-color: var(--primary-border); background: var(--primary-soft); color: var(--text-primary-soft); }
.tenant-type-pill.independent_trainer { border-color: rgba(125, 92, 255, .35); background: rgba(125, 92, 255, .1); color: var(--text-primary); }
.table-action { border: 1px solid var(--platform-border); border-radius: 8px; background: var(--platform-surface-2); color: var(--text-primary-soft); padding: 6px 9px; font-size: .67rem; font-weight: 800; }
.table-action:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.directory-footer { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 15px; border-top: 1px solid var(--border-secondary); color: var(--text-muted); font-size: .68rem; }
.pagination { display: flex; align-items: center; gap: 5px; }
.pagination button { min-width: 29px; height: 29px; border: 1px solid var(--platform-border); border-radius: 7px; background: var(--platform-surface-2); color: var(--text-secondary); font-size: .68rem; }
.pagination button.active, .pagination button:hover { border-color: var(--primary-border); background: var(--primary-soft); color: var(--text-primary-soft); }

.tenant-profile { display: grid; gap: 16px; }
.profile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 20px; border: 1px solid var(--platform-border); border-radius: 15px; background: var(--platform-surface); box-shadow: var(--shadow-card); }
.profile-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-logo { display: grid; width: 54px; height: 54px; flex: 0 0 54px; place-items: center; border-radius: 15px; background: var(--primary-soft); color: var(--text-primary-soft); font-size: 1.3rem; font-weight: 800; }
.profile-heading h2 { color: var(--text-primary); font-size: 1.3rem; }
.profile-heading p { margin-top: 4px; color: var(--text-muted); font-size: .72rem; direction: ltr; text-align: right; }
.profile-status-line { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.profile-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 5px; border: 1px solid var(--platform-border); border-radius: 12px; background: var(--platform-surface); }
.profile-tab { flex: 0 0 auto; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-muted); padding: 9px 12px; font-size: .7rem; font-weight: 800; }
.profile-tab:hover, .profile-tab.active { border-color: var(--primary-border); background: var(--primary-soft); color: var(--text-primary-soft); }
.profile-panel { display: none; }
.profile-panel.active { display: block; }
.profile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.profile-stat { padding: 16px; border: 1px solid var(--platform-border); border-radius: 13px; background: var(--platform-surface); }
.profile-stat span { display: block; color: var(--text-muted); font-size: .68rem; }
.profile-stat strong { display: block; margin-top: 8px; color: var(--text-primary); font-size: 1.2rem; }
.profile-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.profile-section { padding: 18px; border: 1px solid var(--platform-border); border-radius: 14px; background: var(--platform-surface); }
.profile-section h3 { margin-bottom: 15px; color: var(--text-primary); font-size: .9rem; }
.detail-list { display: grid; gap: 9px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border-secondary); padding-bottom: 8px; color: var(--text-muted); font-size: .7rem; }
.detail-row:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-row b { color: var(--text-secondary); font-weight: 800; text-align: left; }
.limit-list { display: grid; gap: 13px; }
.limit-row { display: grid; gap: 6px; }
.limit-row-head { display: flex; justify-content: space-between; gap: 10px; color: var(--text-secondary); font-size: .7rem; }
.limit-row-head b { color: var(--text-primary); }
.limit-row.near .progress-track i { background: var(--warning); }
.limit-row.reached .progress-track i { background: var(--danger); }
.feature-list { display: flex; flex-wrap: wrap; gap: 7px; }
.feature-chip { border-radius: var(--radius-pill); background: var(--success-soft); color: var(--success-text); padding: 5px 9px; font-size: .65rem; font-weight: 800; }
.feature-chip.off { background: var(--border-secondary); color: var(--text-muted); }
.profile-table { width: 100%; }
.profile-table th, .profile-table td { padding: 9px 5px; border-bottom: 1px solid var(--border-secondary); font-size: .68rem; text-align: right; }
.profile-table th { color: var(--text-muted); }
.profile-table td { color: var(--text-secondary); }
.profile-table strong { color: var(--text-primary); }
.profile-wide { grid-column: 1 / -1; }
.note-list, .audit-list { display: grid; gap: 8px; max-height: 380px; overflow: auto; }
.note-item, .audit-item { padding: 11px; border: 1px solid var(--border-secondary); border-radius: 10px; background: var(--bg-surface); }
.note-item p, .audit-item p { color: var(--text-secondary); font-size: .72rem; white-space: pre-wrap; }
.note-item small, .audit-item small { display: block; margin-top: 6px; color: var(--text-muted); font-size: .63rem; }

.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan-card { position: relative; display: grid; gap: 16px; padding: 22px; border: 1px solid var(--platform-border); border-radius: 16px; background: var(--platform-surface); box-shadow: var(--shadow-card); }
.plan-card.featured { border-color: var(--primary-border); box-shadow: var(--shadow-primary); }
.plan-card h3 { color: var(--text-primary); font-size: 1.15rem; }
.plan-card p { min-height: 46px; color: var(--text-muted); font-size: .72rem; }
.plan-price { color: var(--text-primary); font-size: 1.7rem; font-weight: 800; }
.plan-price small { color: var(--text-muted); font-size: .68rem; font-weight: 500; }
.plan-compatibility { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 27px; border-top: 1px solid var(--border-secondary); padding-top: 12px; color: var(--text-muted); font-size: .65rem; }
.plan-compatibility .tenant-type-pill { padding-block: 3px; }
.plan-limits { display: grid; gap: 7px; border-top: 1px solid var(--border-secondary); padding-top: 14px; }
.plan-limits span { display: flex; justify-content: space-between; gap: 10px; color: var(--text-muted); font-size: .69rem; }
.plan-limits b { color: var(--text-secondary); }
.plan-features { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-card.is-inactive { opacity: .78; border-style: dashed; }
.plan-card.is-inactive .plan-price { color: var(--text-muted); }
.plan-card-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: auto; }
.plan-edit { width: 100%; }
.plan-delete { min-width: 66px; }
.plan-delete:disabled { cursor: not-allowed; opacity: .48; }
.dialog-fieldset { min-width: 0; margin: 0; border: 1px solid var(--platform-border); border-radius: 12px; padding: 12px; }
.dialog-fieldset legend { padding-inline: 6px; color: var(--text-secondary); font-size: .72rem; font-weight: 800; }
.audit-table { min-width: 850px; }
.platform-page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.backup-health-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.backup-health-stat { min-height: 118px; }
.backup-health-summary { display: grid; gap: 10px; }
.backup-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border-secondary); padding-bottom: 9px; color: var(--text-muted); font-size: .74rem; }
.backup-summary-row:last-child { border-bottom: 0; padding-bottom: 0; }
.backup-summary-row strong { color: var(--text-primary); font-size: .82rem; }
.backup-provider-state { display: grid; min-height: 112px; align-content: center; gap: 9px; }
.backup-provider-state p, .backup-provider-state small { color: var(--text-muted); font-size: .72rem; line-height: 1.7; }
.backup-provider-badge { display: inline-flex; width: fit-content; align-items: center; gap: 9px; border: 1px solid var(--warning-border); border-radius: var(--radius-pill); background: var(--warning-soft); color: var(--warning-text); padding: 6px 10px; font-size: .72rem; }
.backup-provider-badge.ready { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.backup-status { white-space: nowrap; }
.backup-status.verified { border: 1px solid var(--success-border); background: var(--success-soft); color: var(--success-text); }
.backup-status.failed { border: 1px solid var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.backup-status.running, .backup-status.pending, .backup-status.verifying { border: 1px solid var(--info-border); background: var(--info-soft); color: var(--info-text); }
.backup-status.expired, .backup-status.deleted { border: 1px solid var(--border-primary); background: var(--bg-surface); color: var(--text-muted); }
.backup-table-card { margin-top: 16px; overflow: hidden; padding: 20px; }
.payment-methods-intro { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; padding: 17px 20px; border-color: var(--info-border); background: var(--info-soft); }
.payment-methods-intro-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--text-primary-soft); font-size: 1.1rem; }
.payment-methods-intro strong { display: block; color: var(--text-primary); font-size: .82rem; }
.payment-methods-intro p { margin-top: 4px; color: var(--text-muted); font-size: .72rem; line-height: 1.7; }
.payment-methods-card { overflow: hidden; padding: 20px; }
.payment-methods-card .card-heading { align-items: center; }
.payment-methods-count { border: 1px solid var(--primary-border); border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--text-primary-soft); padding: 5px 9px; font-size: .67rem; font-weight: 800; white-space: nowrap; }
.platform-payment-method-table { min-width: 940px; }
.payment-account-reference { display: inline-block; color: var(--text-primary); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .75rem; letter-spacing: .02em; }
.payment-methods-empty { min-height: 190px; gap: 5px; text-align: center; }
.payment-methods-empty strong { color: var(--text-primary); font-size: .82rem; }
.payment-methods-empty span { color: var(--text-muted); font-size: .72rem; }
.profile-section-note { margin-top: 14px; border-top: 1px solid var(--border-secondary); padding-top: 12px; color: var(--text-muted); font-size: .7rem; line-height: 1.7; }
.settings-placeholder { display: grid; min-height: 290px; place-items: center; align-content: center; gap: 10px; padding: 25px; text-align: center; }
.placeholder-icon { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 15px; background: var(--primary-soft); color: var(--text-primary-soft); font-size: 1.4rem; }
.settings-placeholder h3 { color: var(--text-primary); }
.settings-placeholder p { max-width: 480px; color: var(--text-muted); font-size: .8rem; }

.platform-dialog { width: min(92vw, 600px); max-height: min(88vh, 720px); overflow: hidden; border: 1px solid var(--platform-border); border-radius: 17px; background: var(--platform-surface); color: var(--text-primary); padding: 0; box-shadow: var(--shadow-popup); }
.platform-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.platform-dialog form { display: grid; max-height: min(88vh, 720px); grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.platform-dialog header, .platform-dialog footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; }
.platform-dialog header { border-bottom: 1px solid var(--border-secondary); }
.platform-dialog header h3 { margin-top: 3px; color: var(--text-primary); font-size: 1rem; }
.platform-dialog footer { justify-content: flex-start; border-top: 1px solid var(--border-secondary); }
.dialog-close { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--platform-border); border-radius: 8px; background: var(--platform-surface-2); color: var(--text-muted); font-size: 1.15rem; line-height: 1; }
.dialog-close:hover { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.platform-dialog-error { margin: 14px 20px 0; padding: 11px 13px; border: 1px solid var(--danger-border); border-radius: 10px; background: var(--danger-soft); color: var(--danger-text); font-size: .78rem; line-height: 1.6; }
.platform-dialog-error[hidden] { display: none; }
.dialog-body { display: grid; min-height: 0; gap: 14px; max-height: none; overflow: auto; overscroll-behavior: contain; padding: 20px; }
.dialog-body p { color: var(--text-muted); font-size: .78rem; }
.dialog-hint { padding: 10px 12px; border: 1px solid var(--info-border); border-radius: 10px; background: var(--info-soft); color: var(--info-text) !important; line-height: 1.7; }
.dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dialog-label { display: grid; gap: 6px; color: var(--text-secondary); font-size: .73rem; font-weight: 800; }
.dialog-label.full { grid-column: 1 / -1; }
.dialog-label input, .dialog-label select, .dialog-label textarea { width: 100%; }
.dialog-label textarea { min-height: 88px; resize: vertical; }
.dialog-check { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: .73rem; }
.dialog-check input { accent-color: var(--primary); }
.dialog-feature-grid { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border: 1px solid var(--border-secondary); border-radius: 11px; background: var(--bg-surface); }
.gym-registration-table { min-width: 1180px; }
.table-secondary { display: block; margin-top: 3px; color: var(--text-muted); font-size: .64rem; }
.danger-text { color: var(--danger-text); }
.registration-admin-detail { padding: 12px; border: 1px solid var(--border-secondary); border-radius: 12px; background: var(--bg-surface); }
.registration-admin-detail .detail-list { gap: 8px; }
.registration-proof-review { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--info-border); border-radius: 11px; background: var(--info-soft); color: var(--info-text); font-size: .75rem; font-weight: 800; }
.platform-credentials-dialog { width: min(92vw, 650px); }
.registration-credentials-grid { display: grid; gap: 8px; }
.registration-credential-row { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(0, 1.5fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-secondary); border-radius: 10px; background: var(--bg-surface); }
.registration-credential-row > span { color: var(--text-muted); font-size: .72rem; font-weight: 800; }
.registration-credential-row code { min-width: 0; overflow-wrap: anywhere; color: var(--text-primary); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; direction: ltr; text-align: left; }
.registration-whatsapp-box { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border-secondary); border-radius: 12px; background: var(--bg-surface); }
.registration-whatsapp-box .card-heading { margin: 0; }
.registration-whatsapp-box h3 { color: var(--text-primary); font-size: .9rem; }
.registration-whatsapp-box textarea { width: 100%; min-height: 185px; resize: vertical; border: 1px solid var(--platform-border); border-radius: 10px; background: var(--bg-input); color: var(--text-primary); padding: 11px; font: inherit; font-size: .75rem; line-height: 1.7; direction: rtl; }
.registration-whatsapp-box small { color: var(--text-muted); font-size: .67rem; line-height: 1.6; }
.platform-toast { position: fixed; z-index: 120; right: 24px; bottom: 24px; max-width: min(90vw, 380px); transform: translateY(20px); border: 1px solid var(--success-border); border-radius: 11px; background: var(--success-soft); color: var(--success-text); opacity: 0; padding: 12px 15px; pointer-events: none; font-size: .75rem; font-weight: 800; transition: opacity var(--transition-fast), transform var(--transition-fast); }
.platform-toast.show { transform: none; opacity: 1; }
.platform-toast.error { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.platform-forbidden-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: var(--bg-app); color: var(--text-primary); }
.platform-forbidden-card { display: grid; max-width: 480px; justify-items: center; gap: 12px; padding: 40px; border: 1px solid var(--platform-border); border-radius: 18px; background: var(--platform-surface); box-shadow: var(--shadow-popup); text-align: center; }
.platform-forbidden-card h1 { color: var(--text-primary); font-size: 1.35rem; }
.platform-forbidden-card p { color: var(--text-muted); font-size: .82rem; }
.platform-forbidden-actions { display: grid; width: min(100%, 340px); gap: 10px; }

@media (max-width: 1280px) {
    .platform-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .platform-shell { display: block; }
    .platform-sidebar { position: fixed; inset: 0 0 0 auto; width: min(86vw, 300px); min-width: 0; height: 100dvh; transform: translateX(105%); transition: transform var(--transition-normal); box-shadow: var(--shadow-popup); }
    [dir="ltr"] .platform-sidebar { inset: 0 auto 0 0; transform: translateX(-105%); }
    .platform-sidebar.open, [dir="rtl"] .platform-sidebar.open, [dir="ltr"] .platform-sidebar.open { transform: none; }
    .platform-main { width: 100%; margin: 0; }
    .mobile-menu-button { display: grid; }
    .platform-global-search { width: min(30vw, 230px); flex-basis: 180px; }
    .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .backup-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 681px) and (max-width: 1100px) {
    .platform-topbar-actions { max-width: 62%; flex-basis: 520px; }
}
@media (max-width: 840px) {
    .platform-dashboard-grid { grid-template-columns: 1fr; }
    .platform-page-head { display: grid; align-items: start; gap: 13px; }
    .platform-page-head > .platform-btn { justify-self: start; }
}
@media (max-width: 680px) {
    .platform-topbar { min-height: 70px; padding: 12px 16px; }
    .platform-topbar-title h1 { font-size: 1rem; }
    .platform-topbar-title .eyebrow, .platform-admin-identity { display: none; }
    .platform-topbar-title { gap: 9px; }
    .platform-topbar-actions { flex: 0 0 auto; gap: 7px; }
    .platform-global-search { width: 36px; height: 36px; flex: 0 0 36px; padding: 0; justify-content: center; border: 0; background: transparent; }
    .platform-global-search input { display: none; }
    .platform-content { padding: 20px 14px 30px; }
    .platform-page-head { display: grid; align-items: start; gap: 13px; }
    .platform-page-head .platform-btn { justify-self: start; }
    .platform-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .platform-kpi { min-height: 116px; padding: 13px; }
    .platform-kpi-value { margin-top: 12px; font-size: 1.4rem; }
    .platform-dashboard-grid, .lower-grid, .profile-section-grid { grid-template-columns: 1fr; }
    .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-actions { grid-template-columns: 1fr; }
    .quick-actions button { min-height: auto; }
    .quick-actions button > span { display: inline-grid; margin: 0 0 0 8px; vertical-align: middle; }
    .directory-toolbar { flex-wrap: wrap; padding: 11px; }
    .platform-search-field { min-width: 100%; }
    .directory-toolbar select { flex: 1; min-width: 0; }
    .directory-footer { align-items: flex-start; flex-direction: column; }
    .profile-head { display: grid; }
    .profile-actions { justify-content: flex-start; }
    .profile-grid, .plan-grid { grid-template-columns: 1fr; }
    .backup-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .platform-page-actions { justify-content: flex-start; }
    .profile-tabs { border-radius: 10px; }
    .dialog-grid { grid-template-columns: 1fr; }
    .dialog-label.full { grid-column: auto; }
    .platform-dialog footer { flex-direction: row; }
    .registration-proof-review { align-items: flex-start; flex-direction: column; }
    .registration-credential-row { grid-template-columns: 1fr auto; }
    .registration-credential-row code { grid-column: 1 / -1; grid-row: 2; }
    .platform-toast { right: 14px; bottom: 14px; }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/pages/trainer-workspace.css */
/* Phase 4 Trainer workspace: operational density with a calm, editorial SaaS rhythm. */
:root {
  --trainer-ink: #0c2344;
  --trainer-muted: #6f829f;
  --trainer-line: rgba(99, 132, 178, .19);
  --trainer-blue-soft: rgba(21, 111, 244, .11);
  --trainer-violet-soft: rgba(113, 85, 222, .11);
  --trainer-radius: 18px;
}

.trainer-workspace-page {
  min-height: 100svh;
  margin: 0;
  color: var(--color-text);
  background:
    radial-gradient(circle at 5% 0%, rgba(31, 119, 246, .10), transparent 26rem),
    var(--color-bg);
}

.trainer-workspace-shell {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
  padding-block: clamp(22px, 4vw, 52px);
}

.trainer-workspace-header,
.trainer-workspace-card,
.trainer-workspace-panel {
  border: 1px solid var(--trainer-line);
  background: color-mix(in srgb, var(--color-surface) 96%, var(--color-primary-soft));
  box-shadow: 0 12px 34px rgba(20, 44, 78, .06);
}

.trainer-workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(22px, 4vw, 38px);
  border-radius: 26px;
}

.trainer-workspace-intro { max-width: 650px; }

.trainer-workspace-kicker,
.trainer-panel-kicker,
.trainer-card-eyebrow {
  display: block;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.trainer-workspace-kicker { margin-block-end: 9px; text-transform: uppercase; }

.trainer-workspace-header h1 {
  margin: 0;
  color: var(--trainer-ink);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.trainer-workspace-header p {
  max-width: 610px;
  margin: 13px 0 0;
  color: var(--color-text-soft);
  line-height: 1.75;
}

.trainer-workspace-message {
  min-height: 1.7em;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
}

.trainer-workspace-header-side { display: flex; min-width: 210px; flex-direction: column; align-items: flex-end; }

.trainer-workspace-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--trainer-ink); font-weight: 850; white-space: nowrap; }

.trainer-workspace-brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, #1678f5, #5964df);
  box-shadow: 0 8px 20px rgba(22, 120, 245, .20);
  font-size: 20px;
}

.trainer-workspace-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-block-start: 18px; }

.trainer-workspace-actions .theme-toggle-button,
.trainer-workspace-actions .btn { min-height: 40px; }

.trainer-workspace-summary {
  display: grid;
  grid-template-columns: 1.2fr repeat(2, 1fr) repeat(5, .82fr);
  gap: 12px;
  margin-block-start: 14px;
}

.trainer-workspace-card {
  min-width: 0;
  min-height: 116px;
  padding: 18px;
  border-radius: var(--trainer-radius);
}

.trainer-workspace-card strong { display: block; margin-block-start: 16px; color: var(--trainer-ink); font-size: 20px; line-height: 1.25; }
.trainer-workspace-card small { display: block; margin-block-start: 6px; color: var(--trainer-muted); font-size: 12px; }
.trainer-card-eyebrow { color: var(--trainer-muted); letter-spacing: 0; }
.trainer-card-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 10px; color: var(--color-primary); background: var(--trainer-blue-soft); font-size: 18px; }
.trainer-card-icon--violet { color: #7357d5; background: var(--trainer-violet-soft); }
.trainer-card-icon--orange { color: #c26b27; background: rgba(194, 107, 39, .12); }
.trainer-card-icon--green { color: #168460; background: rgba(28, 163, 119, .11); font-size: 10px; font-weight: 800; }
.trainer-workspace-card--metric strong { margin-block-start: 10px; font-size: 27px; }

.trainer-workspace-main-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .75fr); gap: 14px; margin-block-start: 14px; align-items: start; }

.trainer-workspace-panel { min-width: 0; padding: clamp(18px, 2.5vw, 26px); border-radius: 22px; }

.trainer-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.trainer-panel-header h2 { margin: 7px 0 0; color: var(--trainer-ink); font-size: 25px; line-height: 1.2; }
.trainer-panel-header p { margin: 7px 0 0; color: var(--trainer-muted); font-size: 13px; line-height: 1.6; }
.trainer-add-client { flex: 0 0 auto; white-space: nowrap; }
.trainer-add-client span { margin-inline-end: 5px; font-size: 18px; line-height: 0; }

.trainer-clients-toolbar { display: flex; gap: 9px; margin-block-start: 21px; }
.trainer-search { display: flex; min-width: 0; flex: 1; align-items: center; gap: 8px; padding-inline: 12px; border: 1px solid var(--trainer-line); border-radius: 12px; color: var(--trainer-muted); background: var(--color-surface-muted); }
.trainer-search:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--trainer-blue-soft); }
.trainer-search input { width: 100%; min-width: 0; min-height: 42px; border: 0; outline: 0; color: var(--color-text); background: transparent; }
.trainer-inline-message { min-height: 22px; margin-block-start: 9px; color: var(--color-primary); font-size: 13px; }
.trainer-inline-message.is-error, .trainer-form-message.is-error { color: #c33b54; }

.trainer-clients-list { display: grid; gap: 8px; margin-block-start: 4px; }
.trainer-client-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(130px, .8fr) repeat(3, minmax(64px, .4fr)) auto; gap: 14px; align-items: center; min-height: 70px; padding: 10px 12px; border: 1px solid transparent; border-bottom-color: var(--trainer-line); transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease; }
.trainer-client-row:hover { border-color: var(--trainer-line); border-radius: 13px; background: var(--trainer-blue-soft); transform: translateY(-1px); }
.trainer-client-name { min-width: 0; }
.trainer-client-name strong { display: block; overflow: hidden; color: var(--trainer-ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.trainer-client-name span, .trainer-client-stat span { display: block; margin-block-start: 4px; color: var(--trainer-muted); font-size: 12px; }
.trainer-client-goal { overflow: hidden; color: var(--color-text-soft); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.trainer-client-stat { color: var(--trainer-ink); font-variant-numeric: tabular-nums; text-align: center; }
.trainer-client-actions { display: flex; gap: 6px; justify-content: flex-end; }
.trainer-client-actions button { min-height: 36px; padding-inline: 10px; border: 1px solid var(--trainer-line); border-radius: 9px; color: var(--color-primary); background: var(--color-surface); cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
.trainer-client-actions button:hover { border-color: var(--color-primary); background: var(--trainer-blue-soft); }
.trainer-empty-state { padding: 32px 16px; border: 1px dashed var(--trainer-line); border-radius: 14px; color: var(--trainer-muted); text-align: center; }
.trainer-empty-state strong { display: block; margin-block-end: 6px; color: var(--trainer-ink); }

.trainer-priority-list { display: grid; gap: 4px; margin-block-start: 20px; }
.trainer-priority-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--trainer-line); }
.trainer-priority-icon { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 11px; font-size: 18px; }
.trainer-priority-icon--blue { color: #146df0; background: var(--trainer-blue-soft); }
.trainer-priority-icon--green { color: #168460; background: rgba(28, 163, 119, .11); }
.trainer-priority-icon--violet { color: #7357d5; background: var(--trainer-violet-soft); }
.trainer-priority-item strong { display: block; color: var(--trainer-ink); font-size: 21px; font-variant-numeric: tabular-nums; }
.trainer-priority-item span:not(.trainer-priority-icon) { display: block; margin-block-start: 2px; color: var(--trainer-muted); font-size: 12px; }
.trainer-availability-note { display: flex; gap: 10px; margin-block-start: 20px; padding: 13px; border-radius: 13px; color: var(--color-primary); background: var(--trainer-blue-soft); }
.trainer-availability-note p { margin: 0; color: var(--color-text-soft); font-size: 12px; line-height: 1.7; }

.trainer-operations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-block-start: 14px; }
.trainer-operations-panel { min-width: 0; }
.trainer-payments-panel { margin-block-start: 14px; }
.trainer-reports-panel { margin-block-start: 14px; }
.trainer-reports-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; margin-block-start: 12px; }
.trainer-report-stat { min-width: 0; padding: 13px 12px; border: 1px solid var(--trainer-line); border-radius: 13px; background: var(--color-surface-muted); }
.trainer-report-stat span { display: block; overflow: hidden; color: var(--trainer-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.trainer-report-stat strong { display: block; margin-block-start: 8px; overflow: hidden; color: var(--trainer-ink); font-size: 17px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.trainer-compact-list { display: grid; gap: 0; margin-block-start: 9px; }
.trainer-compact-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--trainer-line); }
.trainer-compact-row:last-child { border-bottom: 0; }
.trainer-compact-row-main { min-width: 0; }
.trainer-compact-row-main strong { display: block; overflow: hidden; color: var(--trainer-ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.trainer-compact-row-main span { display: block; margin-block-start: 4px; overflow: hidden; color: var(--trainer-muted); font-size: 12px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.trainer-compact-row-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.trainer-status-pill { display: inline-flex; min-height: 26px; align-items: center; padding-inline: 9px; border: 1px solid var(--trainer-line); border-radius: 999px; color: var(--trainer-muted); background: var(--color-surface-muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.trainer-status-pill--active, .trainer-status-pill--scheduled { border-color: rgba(24, 146, 103, .24); color: #137b5b; background: rgba(24, 146, 103, .09); }
.trainer-status-pill--completed { border-color: rgba(21, 111, 244, .22); color: var(--color-primary); background: var(--trainer-blue-soft); }
.trainer-status-pill--cancelled, .trainer-status-pill--archived { color: var(--trainer-muted); }
.trainer-status-pill--no_show { border-color: rgba(194, 107, 39, .24); color: #a65c22; background: rgba(194, 107, 39, .09); }
.trainer-inline-action { min-height: 32px; padding-inline: 9px; border: 1px solid var(--trainer-line); border-radius: 8px; color: var(--color-primary); background: var(--color-surface); cursor: pointer; font: inherit; font-size: 11px; font-weight: 800; }
.trainer-inline-action:hover { border-color: var(--color-primary); background: var(--trainer-blue-soft); }

.trainer-pagination { display: flex; justify-content: center; gap: 8px; margin-block-start: 16px; }
.trainer-pagination button { min-width: 36px; min-height: 34px; border: 1px solid var(--trainer-line); border-radius: 9px; color: var(--color-primary); background: var(--color-surface); cursor: pointer; font: inherit; }

.trainer-client-dialog { width: min(620px, calc(100% - 28px)); max-height: calc(100dvh - 28px); box-sizing: border-box; overflow: auto; padding: 0; border: 1px solid var(--trainer-line); border-radius: 22px; color: var(--color-text); background: var(--color-surface); box-shadow: 0 28px 90px rgba(7, 28, 57, .28); overscroll-behavior: contain; }
.trainer-client-dialog::backdrop { background: rgba(7, 25, 50, .52); backdrop-filter: blur(3px); }
.trainer-client-dialog form, .trainer-client-details { padding: 23px; }
.trainer-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-block-end: 17px; border-bottom: 1px solid var(--trainer-line); }
.trainer-dialog-header h2 { margin: 6px 0 0; color: var(--trainer-ink); font-size: 23px; }
.trainer-dialog-close { width: 38px; height: 38px; border: 1px solid var(--trainer-line); border-radius: 10px; color: var(--trainer-muted); background: transparent; cursor: pointer; font-size: 24px; line-height: 1; }
.trainer-dialog-close:hover { color: var(--color-primary); background: var(--trainer-blue-soft); }
.trainer-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-block-start: 19px; }
.trainer-form-grid label { display: grid; gap: 7px; color: var(--trainer-ink); font-size: 13px; font-weight: 700; }
.trainer-form-grid input, .trainer-form-grid select, .trainer-form-grid textarea { width: 100%; box-sizing: border-box; min-height: 42px; padding: 9px 11px; border: 1px solid var(--trainer-line); border-radius: 10px; color: var(--color-text); background: var(--color-surface-muted); font: inherit; font-size: 14px; resize: vertical; }
.trainer-form-grid input:focus, .trainer-form-grid select:focus, .trainer-form-grid textarea:focus { border-color: var(--color-primary); outline: 0; box-shadow: 0 0 0 3px var(--trainer-blue-soft); }
.trainer-form-field--wide { grid-column: 1 / -1; }
.trainer-form-message { min-height: 22px; margin: 12px 0 0; font-size: 13px; }
.trainer-dialog-actions { display: flex; justify-content: flex-start; gap: 9px; margin-block-start: 12px; }
.trainer-client-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-block-start: 19px; }
.trainer-detail-stat { padding: 13px; border-radius: 12px; background: var(--color-surface-muted); }
.trainer-detail-stat span { display: block; color: var(--trainer-muted); font-size: 12px; }
.trainer-detail-stat strong { display: block; margin-block-start: 5px; color: var(--trainer-ink); font-size: 18px; }
.trainer-detail-note { margin-block-start: 14px; color: var(--color-text-soft); line-height: 1.8; }
.trainer-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 16px; padding-block-start: 14px; border-top: 1px solid var(--trainer-line); }
.trainer-timeline-list { max-height: min(62vh, 560px); overflow: auto; }
.trainer-timeline-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--trainer-line); }
.trainer-timeline-item:last-child { border-bottom: 0; }
.trainer-timeline-dot { width: 9px; height: 9px; margin-block-start: 6px; border: 2px solid var(--color-primary); border-radius: 50%; background: var(--color-surface); }
.trainer-timeline-item strong { display: block; color: var(--trainer-ink); font-size: 13px; }
.trainer-timeline-item span { display: block; margin-block-start: 3px; color: var(--trainer-muted); font-size: 11px; }
.trainer-timeline-item p { margin: 5px 0 0; color: var(--color-text-soft); font-size: 12px; line-height: 1.6; }

html[data-theme="dark"] .trainer-workspace-header h1,
html[data-theme="dark"] .trainer-workspace-card strong,
html[data-theme="dark"] .trainer-panel-header h2,
html[data-theme="dark"] .trainer-client-name strong,
html[data-theme="dark"] .trainer-priority-item strong,
html[data-theme="dark"] .trainer-dialog-header h2,
html[data-theme="dark"] .trainer-detail-stat strong,
html[data-theme="dark"] .trainer-workspace-brand,
html[data-theme="dark"] .trainer-form-grid label,
html[data-theme="dark"] .trainer-report-stat strong { color: #eaf2ff; }

html[data-theme="dark"] .trainer-workspace-page { background: radial-gradient(circle at 5% 0%, rgba(41, 127, 248, .14), transparent 26rem), var(--color-bg); }
html[data-theme="dark"] .trainer-workspace-header,
html[data-theme="dark"] .trainer-workspace-card,
html[data-theme="dark"] .trainer-workspace-panel { box-shadow: 0 16px 40px rgba(0, 0, 0, .16); }

@media (max-width: 980px) {
  .trainer-workspace-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trainer-workspace-main-grid { grid-template-columns: 1fr; }
  .trainer-operations-grid { grid-template-columns: 1fr; }
  .trainer-reports-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .trainer-workspace-shell { width: min(100% - 24px, 600px); }
  .trainer-workspace-header { flex-direction: column; }
  .trainer-workspace-header-side { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .trainer-workspace-actions { margin-block-start: 0; }
  .trainer-workspace-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trainer-compact-row { align-items: flex-start; }
  .trainer-compact-row-actions { flex-wrap: wrap; justify-content: flex-end; }
  .trainer-client-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .trainer-client-goal { grid-column: 1 / -1; }
  .trainer-client-stat { display: none; }
  .trainer-client-actions { grid-column: 2; grid-row: 1; }
}

@media (max-width: 480px) {
  .trainer-workspace-shell { width: min(100% - 20px, 420px); padding-block: 14px 28px; }
  .trainer-workspace-header { padding: 18px; border-radius: 20px; }
  .trainer-workspace-header-side { align-items: flex-start; flex-direction: column; gap: 12px; }
  .trainer-workspace-actions { justify-content: flex-start; }
  .trainer-workspace-summary { gap: 8px; }
  .trainer-workspace-card { min-height: 104px; padding: 14px; }
  .trainer-workspace-card strong { margin-block-start: 12px; font-size: 17px; }
  .trainer-workspace-card--metric strong { font-size: 23px; }
  .trainer-workspace-panel { padding: 16px; border-radius: 18px; }
  .trainer-reports-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trainer-panel-header { flex-direction: column; gap: 14px; }
  .trainer-add-client { width: 100%; }
  .trainer-clients-toolbar { align-items: stretch; }
  .trainer-clients-toolbar .btn { flex: 0 0 auto; }
  .trainer-form-grid { grid-template-columns: 1fr; }
  .trainer-form-field--wide { grid-column: auto; }
  .trainer-detail-actions .btn { flex: 1 1 calc(50% - 8px); }
  .trainer-client-dialog form, .trainer-client-details { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .trainer-workspace-page *, .trainer-workspace-page *::before, .trainer-workspace-page *::after { transition: none; animation: none; }
}

/* Trainer Studio composition: this page has its own product shell, not a
   reduced copy of the Gym dashboard. These rules are intentionally scoped to
   the trainer surface so the existing Gym workspace remains unchanged. */
.trainer-workspace-page {
  --trainer-indigo: #5d5ce2;
  --trainer-teal: #14b8a6;
  background:
    radial-gradient(circle at 93% 2%, rgba(93, 92, 226, .16), transparent 25rem),
    radial-gradient(circle at 5% 32%, rgba(20, 184, 166, .08), transparent 21rem),
    var(--color-bg);
}

.trainer-workspace-shell { width: min(1180px, calc(100% - 48px)); padding-block: 28px 64px; }
.trainer-workspace-header {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 46px);
  border: 0;
  border-radius: 30px;
  color: #fff;
  background: linear-gradient(120deg, #122e58 0%, #263e91 57%, #5d5ce2 100%);
  box-shadow: 0 24px 56px rgba(28, 49, 111, .22);
}
.trainer-workspace-header::after { content: ''; position: absolute; width: 290px; height: 290px; inset-block-start: -150px; inset-inline-start: -70px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,.035), 0 0 0 58px rgba(255,255,255,.025); pointer-events: none; }
.trainer-workspace-intro { position: relative; z-index: 1; max-width: 690px; }
.trainer-product-mark { display: flex; align-items: center; gap: 12px; }
.trainer-product-mark > div { display: grid; gap: 2px; }
.trainer-workspace-header .trainer-workspace-kicker { margin: 0; color: rgba(255,255,255,.68); font-size: 10px; letter-spacing: .16em; }
.trainer-product-mark strong { color: #fff; font-size: 14px; }
.trainer-workspace-header h1 { max-width: 620px; margin-block-start: 25px; color: #fff; font-size: clamp(32px, 4.6vw, 58px); letter-spacing: -.04em; }
.trainer-workspace-header p { color: rgba(255,255,255,.78); }
.trainer-workspace-message { color: #d9fff7; }
.trainer-workspace-brand-mark { width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.28); color: #fff; background: rgba(255,255,255,.14); box-shadow: none; }
.trainer-workspace-header-side { position: relative; z-index: 1; min-width: 220px; }
.trainer-workspace-context { display: inline-flex; align-items: center; gap: 8px; color: rgba(255,255,255,.83); font-size: 12px; font-weight: 800; }
.trainer-context-dot, .trainer-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #55e2c2; box-shadow: 0 0 0 4px rgba(85,226,194,.15); }
.trainer-workspace-actions { margin-block-start: 26px; }
.trainer-workspace-header .theme-toggle-button, .trainer-workspace-header .btn { border-color: rgba(255,255,255,.25); color: #fff; background: rgba(255,255,255,.12); }
.trainer-workspace-header .theme-toggle-button:hover, .trainer-workspace-header .btn:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.2); }

.trainer-workspace-nav { display: flex; gap: 5px; width: fit-content; max-width: 100%; margin: 15px auto 0; padding: 5px; border: 1px solid var(--trainer-line); border-radius: 16px; background: color-mix(in srgb, var(--color-surface) 92%, var(--trainer-indigo)); box-shadow: 0 10px 25px rgba(23, 47, 88, .07); overflow-x: auto; scrollbar-width: none; }
.trainer-workspace-nav::-webkit-scrollbar { display: none; }
.trainer-nav-link { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; min-height: 38px; padding-inline: 15px; border-radius: 11px; color: var(--trainer-muted); font-size: 12px; font-weight: 800; text-decoration: none; transition: color 160ms ease, background-color 160ms ease, transform 160ms ease; }
.trainer-nav-link:hover { color: var(--trainer-indigo); background: rgba(93,92,226,.08); transform: translateY(-1px); }
.trainer-nav-link.is-active { color: #fff; background: var(--trainer-indigo); box-shadow: 0 6px 14px rgba(93,92,226,.24); }
.trainer-nav-link span { font-size: 15px; line-height: 1; }

.trainer-welcome-strip { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-block-start: 22px; padding: 20px 23px; border-inline-start: 4px solid var(--trainer-teal); border-radius: 17px; background: color-mix(in srgb, var(--color-surface) 94%, var(--trainer-teal)); box-shadow: 0 8px 22px rgba(23, 47, 88, .05); }
.trainer-welcome-strip h2 { margin: 6px 0 0; color: var(--trainer-ink); font-size: clamp(19px, 2.2vw, 25px); }
.trainer-welcome-strip h2 span { color: var(--trainer-indigo); }
.trainer-welcome-strip p { margin: 5px 0 0; color: var(--trainer-muted); font-size: 13px; }
.trainer-welcome-meta { flex: 0 0 auto; }
.trainer-welcome-meta .trainer-status-pill { background: rgba(20,184,166,.08); border-color: rgba(20,184,166,.22); color: #138d80; }
.trainer-live-dot { display: inline-block; margin-inline-end: 7px; vertical-align: middle; }

.trainer-workspace-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-block-start: 12px; }
.trainer-workspace-card { min-height: 128px; padding: 17px; border-color: var(--trainer-line); border-radius: 17px; background: var(--color-surface); box-shadow: 0 8px 22px rgba(23, 47, 88, .05); }
.trainer-workspace-card--metric { display: flex; flex-direction: column; }
.trainer-workspace-card--metric .trainer-card-eyebrow { margin-block-start: 13px; order: 2; }
.trainer-workspace-card--metric strong { order: 3; margin-block-start: 5px; color: var(--trainer-ink); font-size: 28px; letter-spacing: -.035em; }
.trainer-workspace-card--metric small { order: 4; margin-block-start: 2px; }
.trainer-workspace-card--primary { border-color: rgba(93,92,226,.4); background: linear-gradient(145deg, rgba(93,92,226,.11), var(--color-surface) 64%); }
.trainer-card-icon { width: 34px; height: 34px; border-radius: 11px; color: var(--trainer-indigo); background: rgba(93,92,226,.12); }
.trainer-card-icon--blue { color: #2d76d6; background: rgba(45,118,214,.11); }

.trainer-quick-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-block-start: 22px; padding: 18px 21px; border: 1px solid var(--trainer-line); border-radius: 19px; background: var(--color-surface); box-shadow: 0 8px 22px rgba(23, 47, 88, .05); }
.trainer-quick-actions h2 { margin: 5px 0 0; color: var(--trainer-ink); font-size: 19px; }
.trainer-quick-actions-list { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 8px; flex: 1; max-width: 720px; }
.trainer-quick-action { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid var(--trainer-line); border-radius: 13px; color: var(--color-text); background: var(--color-surface-muted); cursor: pointer; text-align: start; font: inherit; transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease; }
.trainer-quick-action:hover, .trainer-quick-action:focus-visible { border-color: rgba(93,92,226,.42); background: rgba(93,92,226,.07); box-shadow: 0 7px 16px rgba(93,92,226,.1); transform: translateY(-1px); outline: none; }
.trainer-quick-action--primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--trainer-indigo), #7472ed); }
.trainer-quick-action--primary:hover, .trainer-quick-action--primary:focus-visible { color: #fff; background: linear-gradient(135deg, #514fcf, #6866e4); }
.trainer-quick-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; color: var(--trainer-indigo); background: rgba(93,92,226,.12); font-size: 18px; font-weight: 900; }
.trainer-quick-action--primary .trainer-quick-icon { color: var(--trainer-indigo); background: rgba(255,255,255,.88); }
.trainer-quick-action strong, .trainer-quick-action small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trainer-quick-action strong { font-size: 12px; }
.trainer-quick-action small { margin-block-start: 3px; color: var(--trainer-muted); font-size: 10px; }
.trainer-quick-action--primary small { color: rgba(255,255,255,.75); }
.trainer-quick-arrow { color: var(--trainer-muted); font-size: 17px; }
.trainer-quick-action--primary .trainer-quick-arrow { color: rgba(255,255,255,.85); }

.trainer-workspace-main-grid { grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 12px; margin-block-start: 12px; }
.trainer-workspace-panel { padding: 22px; border-color: var(--trainer-line); border-radius: 19px; background: var(--color-surface); box-shadow: 0 8px 22px rgba(23, 47, 88, .05); }
.trainer-panel-header h2 { margin-block-start: 5px; color: var(--trainer-ink); font-size: 22px; }
.trainer-panel-header p { margin-block-start: 5px; }
.trainer-schedule-panel { min-height: 288px; }
.trainer-schedule-list { margin-block-start: 15px; }
.trainer-schedule-list .trainer-compact-row { padding-block: 14px; }
.trainer-clients-panel { margin-block-start: 12px; }
.trainer-add-client-secondary { white-space: nowrap; }
.trainer-operations-grid { gap: 12px; margin-block-start: 12px; }
.trainer-payments-panel, .trainer-reports-panel { margin-block-start: 12px; }
.trainer-reports-grid { gap: 8px; margin-block-start: 15px; }
.trainer-report-stat { padding: 14px; border-radius: 13px; background: var(--color-surface-muted); }

html[data-theme="dark"] .trainer-workspace-page { background: radial-gradient(circle at 93% 2%, rgba(113,111,255,.17), transparent 25rem), var(--color-bg); }
html[data-theme="dark"] .trainer-workspace-card, html[data-theme="dark"] .trainer-workspace-panel, html[data-theme="dark"] .trainer-quick-actions, html[data-theme="dark"] .trainer-welcome-strip, html[data-theme="dark"] .trainer-workspace-nav { box-shadow: 0 14px 34px rgba(0,0,0,.17); }
html[data-theme="dark"] .trainer-welcome-strip h2, html[data-theme="dark"] .trainer-quick-actions h2, html[data-theme="dark"] .trainer-workspace-card--metric strong { color: #ecf3ff; }
html[data-theme="dark"] .trainer-nav-link.is-active { color: #fff; }

@media (max-width: 1020px) {
  .trainer-workspace-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trainer-workspace-main-grid { grid-template-columns: 1fr; }
  .trainer-quick-actions { align-items: stretch; flex-direction: column; }
  .trainer-quick-actions-list { width: 100%; max-width: none; }
}
@media (max-width: 720px) {
  .trainer-workspace-shell { width: min(100% - 24px, 620px); padding-block: 14px 42px; }
  .trainer-workspace-header { padding: 25px 21px; border-radius: 23px; }
  .trainer-workspace-header-side { width: 100%; min-width: 0; margin-block-start: 8px; }
  .trainer-workspace-actions { justify-content: flex-start; margin-block-start: 15px; }
  .trainer-workspace-nav { width: calc(100% - 4px); margin-inline: 2px; justify-content: flex-start; }
  .trainer-welcome-strip { align-items: flex-start; flex-direction: column; padding: 17px; }
  .trainer-workspace-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trainer-quick-actions { padding: 16px; }
  .trainer-quick-actions-list { grid-template-columns: 1fr; }
  .trainer-workspace-panel { padding: 17px; }
  .trainer-panel-header { flex-direction: row; }
  .trainer-add-client-secondary { flex: 0 0 auto; }
}
@media (max-width: 480px) {
  .trainer-workspace-header h1 { font-size: 34px; }
  .trainer-workspace-card { min-height: 112px; padding: 14px; }
  .trainer-workspace-card--metric strong { font-size: 24px; }
  .trainer-panel-header { flex-direction: column; gap: 11px; }
  .trainer-add-client-secondary { width: 100%; }
  .trainer-compact-row { align-items: flex-start; }
  .trainer-compact-row-actions { flex-wrap: wrap; justify-content: flex-end; }
  .trainer-reports-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/responsive.css */
@media (max-width: 1199px){
  .overview-grid,
.stats-grid,
.kpi-grid,
.metrics-grid,
.management-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }








}


@media (max-width: 767px){
  html{
    scroll-padding-top: 224px;
  }

  .table-cards-container{
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
    direction: rtl;
  }

  .table-card-layout{
    display: block;
    width: 100%;
    min-width: 0 !important;
    table-layout: auto;
    direction: rtl;
  }

  .table-card-layout > thead{
    display: none;
  }

  .table-card-layout > tbody{
    display: grid;
    gap: var(--space-5);
  }

  .table-card-layout > tbody > tr{
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    overflow: visible;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-xs);
  }

  .table-card-layout > tbody > tr:nth-child(even){
    background: var(--color-surface);
  }

  .table-card-layout > tbody > tr:hover{
    background: var(--color-primary-soft);
  }

  .table-card-layout > tbody > tr:hover{
    border-color: var(--border-focus);
    box-shadow: var(--shadow-sm);
  }

  .table-card-layout > tbody > tr > td{
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-3);
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    text-align: start;
    overflow-wrap: anywhere;
  }

  .table-card-layout > tbody > tr > td::before{
    min-width: 0;
    color: var(--color-text-muted);
    content: attr(data-label);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
    line-height: 1.5;
    text-align: start;
  }

  .table-card-layout > tbody > tr > td > *{
    min-width: 0;
    max-width: 100%;
  }

  .table-card-layout > tbody > tr > td:last-child{
    position: static !important;
    z-index: auto;
    min-width: 0 !important;
    border-bottom: 0;
    background: transparent !important;
    box-shadow: none !important;
  }


  .table-card-layout > tbody > tr > td{
    min-inline-size: 0;
  }

  .table-card-layout > tbody > tr > td:last-child .table-actions,
.table-card-layout > tbody > tr > td:last-child .row-actions,
.table-card-layout > tbody > tr > td:last-child .action-group,
.table-card-layout > tbody > tr > td:last-child .members-actions{
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .table-card-layout > tbody > tr > td[colspan]{
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
  }

  .table-card-layout > tbody > tr > td[colspan]::before{
    display: none;
  }

  .table-card-layout .table-actions,
.table-card-layout .row-actions,
.table-card-layout .members-actions,
.table-card-layout .action-group,
.table-card-layout .library-row-actions{
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .table-card-layout .table-actions .btn,
.table-card-layout .row-actions .btn,
.table-card-layout .members-actions .btn,
.table-card-layout .action-group .btn,
.table-card-layout .library-row-actions .btn{
    flex: 0 0 auto;
  }


  .table-card-layout.dashboard-day-pass-table > tbody > tr,
.table-card-layout.day-pass-table > tbody > tr{
    height: auto !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child,
.table-card-layout.day-pass-table > tbody > tr > td:first-child,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:last-child,
.table-card-layout.day-pass-table > tbody > tr > td:last-child{
    grid-column: 1 / -1;
  }

  .table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child,
.table-card-layout.day-pass-table > tbody > tr > td:first-child{
    display: block;
    padding-block: var(--space-3);
    border-bottom: 0;
    text-align: start;
  }

  .table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child::before,
.table-card-layout.day-pass-table > tbody > tr > td:first-child::before,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:last-child::before,
.table-card-layout.day-pass-table > tbody > tr > td:last-child::before{
    display: none;
  }

  .table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child strong,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child small,
.table-card-layout.day-pass-table > tbody > tr > td:first-child strong,
.table-card-layout.day-pass-table > tbody > tr > td:first-child small{
    display: block;
    max-width: 100%;
    margin-inline-start: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .table-card-layout.dashboard-day-pass-table > tbody > tr > td:last-child,
.table-card-layout.day-pass-table > tbody > tr > td:last-child{
    display: block;
    padding-top: var(--space-3);
  }

  .table-card-layout.dashboard-day-pass-table .day-pass-actions,
.table-card-layout.day-pass-table .day-pass-actions{
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-2);
    flex-wrap: wrap;
  }

  .table-card-layout.dashboard-day-pass-table .day-pass-action-button,
.table-card-layout.day-pass-table .day-pass-action-button{
    flex: 0 0 auto;
  }
}

@media (max-width: 991px){
  .page{
    width: min(100% - 24px, 900px);
    padding-top: var(--space-6);
  }













  .dashboard-hero,
.dashboard-page-actions{
    grid-template-columns: 1fr;
  }

  .dashboard-hero-visual{
    min-height: 180px;
  }
}

@media (max-width: 767px){
  .page{
    width: calc(100% - 24px);
    padding-bottom: var(--space-9);
  }



  .header-status{
    display: none;
  }







  #topAddMemberButton,
#topPricingButton,
#backupButton{
    display: none;
  }



  .page-header,
.section-heading,
.members-toolbar,
.toolbar{
    align-items: stretch;
    flex-direction: column;
  }

  .page-header-actions,
.members-toolbar-controls,
.actions-row,
.form-actions{
    width: 100%;
  }

  .page-header-actions > *,
.actions-row > *,
.form-actions > *{
    flex: 1 1 auto;
  }




















  .overview-grid,
.stats-grid,
.kpi-grid,
.metrics-grid,
.management-grid,
.three-column-grid,
.two-column-grid,
.content-grid-two,
.dashboard-grid,
.form-grid,
.field-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-span-2,
.form-field-full{
    grid-column: 1 / -1;
  }

  .panel,
.card,
.shadow-panel{
    border-radius: var(--radius-lg);
  }

  .table-scroll,
.table-wrap,
.data-table-wrap{
    margin-inline: calc(var(--space-4) * -1);
    width: calc(100% + var(--space-8));
    padding-inline: var(--space-4);
  }

  .data-table,
.members-table,
.history-table,
table{
    min-width: 720px;
  }

  .modal,
dialog{
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
  }
}




@media (max-width: 379px){
  .overview-grid,
.stats-grid,
.kpi-grid,
.metrics-grid,
.management-grid{
    grid-template-columns: 1fr;
  }

  .page{
    width: calc(100% - 16px);
  }



  .btn{
    font-size: var(--font-sm);
  }
}

@media (prefers-reduced-motion: reduce){
  *,
*::before,
*::after{
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}












@media (min-width: 1200px){














































  .page{
    box-sizing: border-box;
    grid-column: 2;
    grid-row: 2;
    width: min(1520px, calc(100% - 48px));
    max-width: none;
    margin-inline: auto;
    padding: 30px 0 56px;
  }

  .page .panel,
.page .store-card,
.page .dashboard-store-summary{
    box-shadow: var(--shadow-card);
  }
}


@media (max-width: 1199px){










  .page{
    width: min(100% - 24px, 1440px);
    margin-inline: auto;
  }
}


@media (max-width: 767px){
  .table-cards-container,
.table-cards-container.table-scroll,
.table-cards-container.table-wrap,
.table-cards-container.data-table-wrap,
.table-cards-container.history-scroll,
.table-cards-container.reports-table-wrap,
.table-cards-container.pricing-table-scroll,
.table-cards-container.pricing-table-wrap,
.table-cards-container.library-table-wrap,
.table-cards-container.external-trainees-table-wrap,
.table-cards-container.profile-table-wrap,
.table-cards-container.backup-history-wrap,
.table-cards-container.backup-count-table-wrap,
.table-cards-container.attendance-table-wrap{
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
    direction: rtl;
  }


  .table-card-layout > tbody > tr > td:last-child{
    grid-template-columns: minmax(0, 1fr);
  }

  .table-card-layout .member-action-row{
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--space-1);
    margin: 0;
  }

  .table-card-layout .member-quick-actions{
    display: flex;
    order: 1;
    width: auto;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 100px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-1);
    overflow: visible;
  }

  .table-card-layout .member-action-row > .table-actions{
    display: flex;
    order: 2;
    width: auto;
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-1);
    overflow: visible;
  }


  .table-card-layout > tbody > tr > td:last-child .member-action-row > .table-actions{
    width: auto;
    flex: 1 1 auto;
    flex-wrap: nowrap;
  }

  .table-card-layout .member-quick-actions > .member-attendance-quick,
.table-card-layout .member-quick-actions > .member-attendance-status{
    display: inline-flex;
    width: 100px;
    min-width: 90px;
    max-width: 110px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    flex: 1 1 100px;
    white-space: nowrap;
  }

  .table-card-layout .member-action-row > .table-actions > .table-action-visible,
.table-card-layout .member-action-row > .table-actions .action-menu{
    display: inline-grid;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    max-width: 40px;
    flex: 0 0 40px;
    place-items: center;
  }

  .table-card-layout .member-action-row > .table-actions > .table-action-visible{
    padding: 0;
    font-size: 0;
  }

  .table-card-layout .member-action-row > .table-actions > .table-action-visible .action-icon{
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
  }

  .table-card-layout .member-action-row > .table-actions > .table-action-visible[data-action="renew"]{
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    flex: 0 0 40px;
  }

  .table-card-layout .member-action-row > .table-actions .action-menu{
    flex: 0 0 40px;
  }

  .table-card-layout .member-action-row > .table-actions .action-menu-toggle{
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }

  .table-card-layout .member-action-row > .table-actions .table-action-label{
    display: none;
  }

  .table-card-layout .table-actions > .btn,
.table-card-layout .row-actions > .btn,
.table-card-layout .action-group > .btn{
    max-width: 100%;
  }


  .table-card-layout > tbody > tr{
    gap: 0;
    padding: 10px 12px;
  }

  .table-card-layout > tbody > tr > td{
    grid-template-columns: minmax(76px, 30%) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-2);
    padding: 7px 0;
    line-height: 1.35;
  }

  .table-card-layout > tbody > tr > td::before{
    line-height: 1.35;
  }

  .table-card-layout > tbody > tr > td:last-child{
    align-items: start;
    padding-top: 10px;
  }
}

@media (max-width: 390px){
  .table-card-layout .member-action-row{
    gap: 4px;
  }

  .table-card-layout .member-quick-actions,
.table-card-layout .member-action-row > .table-actions{
    gap: 4px;
  }

  .table-card-layout .member-quick-actions > .member-attendance-quick,
.table-card-layout .member-quick-actions > .member-attendance-status{
    width: 84px;
    min-width: 78px;
    max-width: 90px;
    flex-basis: 84px;
  }

  .table-card-layout .member-action-row > .table-actions > .table-action-visible,
.table-card-layout .member-action-row > .table-actions .action-menu,
.table-card-layout .member-action-row > .table-actions .action-menu-toggle{
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    flex-basis: 36px;
  }
}


@media (max-width: 767px){
  .stat-card,
.management-card,
.library-card,
.finance-card,
.attendance-card,
.attendance-entry-card,
.attendance-summary-card,
.external-trainee-card,
.program-card,
.diet-card,
.exercise-card,
.food-card,
.muscle-card,
.table-card-layout > tbody > tr{
    min-width: 0;
    border: 1px solid var(--color-border-soft);
    border-radius: 20px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }

  .card-grid,
.library-grid,
.exercise-grid,
.food-grid,
.program-grid{
    gap: var(--space-3);
  }

  .table-card-layout > tbody > tr{
    padding: var(--space-4);
  }

  .table-card-layout > tbody > tr:hover{
    border-color: var(--border-focus);
    box-shadow: var(--shadow-primary);
  }


  .table-card-layout > tbody > tr{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-3);
    row-gap: 0;
  }

  .table-card-layout > tbody > tr > td.mobile-card-primary,
.table-card-layout > tbody > tr > td.mobile-card-actions,
.table-card-layout > tbody > tr > td:first-child,
.table-card-layout > tbody > tr > td[colspan]{
    grid-column: 1 / -1;
  }

  .table-card-layout > tbody > tr > td:not(.mobile-card-primary):not(.mobile-card-actions):not([colspan]){
    grid-template-columns: minmax(64px, 42%) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-2);
  }

  .table-card-layout > tbody > tr > td.mobile-card-actions{
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--space-3);
  }

  .table-card-layout > tbody > tr > td[colspan]{
    grid-template-columns: minmax(0, 1fr);
  }


  .members-table.table-card-layout > tbody > tr{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "identity identity"
      "status status"
      "subscription expiry"
      "freeze account"
      "actions actions";
    column-gap: var(--space-3);
    row-gap: var(--space-3);
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(1){ grid-area: identity; }
  .members-table.table-card-layout > tbody > tr > td:nth-child(2){ grid-area: subscription; }
  .members-table.table-card-layout > tbody > tr > td:nth-child(3){ grid-area: status; }
  .members-table.table-card-layout > tbody > tr > td:nth-child(4){ grid-area: expiry; }
  .members-table.table-card-layout > tbody > tr > td:nth-child(5){ grid-area: freeze; }
  .members-table.table-card-layout > tbody > tr > td:nth-child(6){ grid-area: account; }
  .members-table.table-card-layout > tbody > tr > td:nth-child(7){ grid-area: actions; }

  .members-table.table-card-layout > tbody > tr > td:first-child{
    position: relative;
    display: block;
    padding: var(--space-7) 0 var(--space-3);
    border-bottom: 0;
    text-align: start;
  }

  .members-table.table-card-layout > tbody > tr > td:first-child::before{
    display: none;
  }

  .members-table.table-card-layout > tbody > tr > td:first-child::after{
    position: absolute;
    inset-block-start: var(--space-4);
    inset-inline-end: 0;
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-pill);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    content: "Ø¹Ø¶Ùˆ";
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
    padding: 2px var(--space-2);
  }

  .members-table.table-card-layout > tbody > tr > td:first-child .table-member-name{
    display: block;
    max-width: 100%;
    overflow: visible;
    overflow-wrap: anywhere;
    font-size: var(--font-lg);
    font-weight: var(--weight-bold);
    line-height: 1.55;
    text-align: start;
    text-overflow: clip;
    white-space: normal;
  }

  .members-table.table-card-layout > tbody > tr > td:first-child .table-member-phone,
.members-table.table-card-layout > tbody > tr > td:first-child .table-sub{
    margin-inline: 0;
    text-align: start;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(3){
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    padding: var(--space-3);
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(3) .badge{
    border: 0;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(3):has(.badge.expiring_soon){
    border-color: var(--warning-border);
    background: var(--color-warning-soft);
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(3):has(.badge.active){
    border-color: var(--success-border);
    background: var(--color-success-soft);
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(3):has(.badge.expired),
.members-table.table-card-layout > tbody > tr > td:nth-child(3):has(.badge.cancelled){
    border-color: var(--danger-border);
    background: var(--color-danger-soft);
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(3):has(.badge.frozen){
    border-color: var(--primary-border);
    background: var(--color-info-soft);
  }

  .members-table.table-card-layout > tbody > tr > td:first-child,
.members-table.table-card-layout > tbody > tr > td:last-child{
    grid-column: 1 / -1;
  }


  .members-table.table-card-layout > tbody > tr > td:nth-child(2),
.members-table.table-card-layout > tbody > tr > td:nth-child(4),
.members-table.table-card-layout > tbody > tr > td:nth-child(5),
.members-table.table-card-layout > tbody > tr > td:nth-child(6){
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    align-items: start;
    min-height: 82px;
    gap: var(--space-1);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: var(--space-3);
    text-align: start;
    white-space: normal;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(2) > .table-main,
.members-table.table-card-layout > tbody > tr > td:nth-child(2) > .table-sub,
.members-table.table-card-layout > tbody > tr > td:nth-child(4) > .table-main,
.members-table.table-card-layout > tbody > tr > td:nth-child(4) > .table-sub,
.members-table.table-card-layout > tbody > tr > td:nth-child(5) > .freeze-usage,
.members-table.table-card-layout > tbody > tr > td:nth-child(6) > .table-money,
.members-table.table-card-layout > tbody > tr > td:nth-child(6) > .table-sub{
    grid-column: 1;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    overflow: visible;
    white-space: normal;
    text-align: start;
    text-overflow: clip;
    width: 100%;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(2) > .table-main,
.members-table.table-card-layout > tbody > tr > td:nth-child(4) > .table-main,
.members-table.table-card-layout > tbody > tr > td:nth-child(6) > .table-money{
    display: block;
    justify-self: stretch;
    inline-size: 100%;
    max-inline-size: none;
    font-size: var(--font-md);
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(5) > .freeze-usage{
    display: inline-flex;
    width: 100%;
    align-items: baseline;
    gap: var(--space-2);
    direction: ltr;
    unicode-bidi: isolate;
    white-space: nowrap;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(5) > .freeze-usage > strong{
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(5) > .freeze-usage > span{
    color: var(--color-text-muted);
    direction: rtl;
    unicode-bidi: isolate;
    white-space: normal;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(6) > .table-money{
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    overflow: visible;
    white-space: nowrap;
    text-overflow: clip;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(6) > .table-sub.has-debt{
    overflow: visible;
    white-space: nowrap;
    text-overflow: clip;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(2)::before,
.members-table.table-card-layout > tbody > tr > td:nth-child(4)::before,
.members-table.table-card-layout > tbody > tr > td:nth-child(5)::before,
.members-table.table-card-layout > tbody > tr > td:nth-child(6)::before{
    display: block;
    color: var(--color-primary);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
    letter-spacing: 0.01em;
    line-height: 1.35;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(2) > .table-main,
.members-table.table-card-layout > tbody > tr > td:nth-child(4) > .table-main,
.members-table.table-card-layout > tbody > tr > td:nth-child(5) > .freeze-usage,
.members-table.table-card-layout > tbody > tr > td:nth-child(6) > .table-money{
    color: var(--color-navy);
    font-weight: var(--weight-bold);
    line-height: 1.45;
  }

  .members-table.table-card-layout > tbody > tr > td:last-child{
    grid-template-columns: minmax(0, 1fr);
  }

  .members-table.table-card-layout .member-action-row{
    gap: var(--space-2);
  }
}


@media (max-width: 390px){
  .members-table.table-card-layout > tbody > tr{
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "identity"
      "status"
      "subscription"
      "expiry"
      "freeze"
      "account"
      "actions";
  }

  .members-table.table-card-layout > tbody > tr > td:not(:first-child):not(:last-child){
    grid-column: 1;
  }

  .members-table.table-card-layout > tbody > tr > td:nth-child(3){
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 767px){
  .table-card-layout.day-pass-table > tbody,
.table-card-layout.dashboard-day-pass-table > tbody{
    gap: var(--space-3);
  }

  .table-card-layout.day-pass-table > tbody > tr,
.table-card-layout.dashboard-day-pass-table > tbody > tr{
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }

  .table-card-layout.day-pass-table > tbody > tr:hover,
.table-card-layout.dashboard-day-pass-table > tbody > tr:hover{
    border-color: var(--border-focus);
    background: var(--color-primary-soft);
    box-shadow: var(--shadow-primary);
    transform: translateY(-1px);
  }

  .table-card-layout.day-pass-table > tbody > tr > td,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td{
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 42px;
    border-bottom: 1px solid var(--color-border-soft);
    padding: 9px var(--space-4);
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table-card-layout.day-pass-table > tbody > tr > td::before,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td::before{
    display: block;
    min-width: 0;
    color: var(--color-text-muted);
    content: attr(data-label);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
    line-height: 1.4;
    text-align: start;
  }

  .table-card-layout.day-pass-table > tbody > tr > td > *,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td > *{
    min-width: 0;
    max-width: 100%;
    justify-self: end;
  }

  .table-card-layout.day-pass-table > tbody > tr > td:first-child,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child{
    position: relative;
    display: block;
    min-height: 0;
    border-bottom-color: var(--primary-border);
    border-inline-start: 3px solid var(--color-primary);
    background: linear-gradient(180deg, var(--color-surface-muted), var(--color-surface));
    padding: var(--space-4);
    text-align: start;
  }

  .table-card-layout.day-pass-table > tbody > tr > td:first-child::before,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child::before{
    display: none;
  }

  .table-card-layout.day-pass-table > tbody > tr > td:first-child strong,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child strong{
    display: block;
    max-width: 100%;
    color: var(--color-text);
    font-size: var(--font-md);
    font-weight: var(--weight-extrabold);
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .table-card-layout.day-pass-table > tbody > tr > td:first-child small,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:first-child small{
    display: block;
    max-width: 100%;
    margin-top: 3px;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .table-card-layout.day-pass-table > tbody > tr > td:nth-child(2) .day-pass-type-badge,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:nth-child(2) .day-pass-type-badge{
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .table-card-layout.day-pass-table > tbody > tr > td.day-pass-amount,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td.day-pass-amount{
    color: var(--color-success);
    font-size: var(--font-md);
    font-weight: var(--weight-extrabold);
    white-space: nowrap;
  }

  .table-card-layout.day-pass-table > tbody > tr > td:last-child,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:last-child{
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    min-height: 0;
    border-bottom: 0;
    background: var(--color-surface-muted) !important;
    padding: var(--space-3) var(--space-4);
  }

  .table-card-layout.day-pass-table > tbody > tr > td:last-child::before,
.table-card-layout.dashboard-day-pass-table > tbody > tr > td:last-child::before{
    display: block;
    color: var(--color-primary);
    font-size: var(--font-xs);
    font-weight: var(--weight-bold);
  }

  .table-card-layout.day-pass-table .day-pass-actions,
.table-card-layout.dashboard-day-pass-table .day-pass-actions{
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-2);
    flex-wrap: nowrap;
  }

  .table-card-layout.day-pass-table .day-pass-action-button,
.table-card-layout.dashboard-day-pass-table .day-pass-action-button{
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    flex: 0 0 40px;
  }
}












.page{
  box-sizing: border-box;
  width: min(1520px, calc(100% - 48px));
  max-width: none;
  margin-inline: auto;
  padding-top: 32px;
}


@media (min-width: 1200px){






  .page{
    grid-column: 2;
    grid-row: 1;
  }
}

.smart-assistant-panel{
  left: 24px;
  right: auto;
  inset-inline-start: auto;
  inset-inline-end: auto;
}



.smart-assistant-panel{
  bottom: 88px;
}

@media (max-width: 767px){
  .page{
    width: calc(100% - 24px);
    padding-top: 18px;
  }



  .smart-assistant-panel{
    right: 10px;
    left: 10px;
    bottom: max(78px, calc(62px + env(safe-area-inset-bottom, 0px)));
  }
}


@media (min-width: 1200px){




























  @keyframes sidebar-tab-label-in{
    from{
      opacity: 0;
      transform: translateX(6px);
    }
    to{
      opacity: 1;
      transform: translateX(0);
    }
  }
}









@media (min-width: 1200px){
























































  .page{
    box-sizing: border-box;
    grid-column: 2;
    grid-row: 2;
    width: min(100%, 1520px);
    max-width: none;
    min-width: 0;
    margin-inline: auto;
    padding: 30px clamp(20px, 3vw, 48px) 56px;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/theme.css */
html[data-theme="dark"]{
  background: var(--bg-app);
  color-scheme: dark;
}

html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .page,
html[data-theme="dark"] .gym-page-bg{
  background-color: var(--bg-app);
  color: var(--text-primary);
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-slate-100,
html[data-theme="dark"] .bg-slate-50{
  background-color: var(--bg-card);
}

html[data-theme="dark"] .bg-slate-950,
html[data-theme="dark"] .gym-topbar-bg{
  background-color: var(--bg-header);
}

html[data-theme="dark"] .text-slate-900,
html[data-theme="dark"] .text-gray-900{
  color: var(--text-primary);
}

html[data-theme="dark"] .text-white{
  color: var(--text-on-primary);
}

html[data-theme="dark"] .border-slate-200,
html[data-theme="dark"] .border-slate-800,
html[data-theme="dark"] .border-blue-200{
  border-color: var(--border-primary);
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .shadow-panel,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .management-card,
html[data-theme="dark"] .library-card,
html[data-theme="dark"] .finance-card,
html[data-theme="dark"] .attendance-card,
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .members-panel,
html[data-theme="dark"] .history-panel,
html[data-theme="dark"] .data-table-panel,
html[data-theme="dark"] .content-panel,
html[data-theme="dark"] .section-card{
  border-color: var(--border-primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] .panel-header,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .panel-footer,
html[data-theme="dark"] .card-footer{
  border-color: var(--border-secondary);
}

html[data-theme="dark"] .stat-card:hover,
html[data-theme="dark"] .management-card:hover,
html[data-theme="dark"] .library-card:hover,
html[data-theme="dark"] .card:hover,
html[data-theme="dark"] .content-card:hover{
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] strong,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .page-title{
  color: var(--text-primary);
}

html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] .card-subtitle,
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .stat-caption,
html[data-theme="dark"] .table-secondary,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .help-text{
  color: var(--text-muted);
}

html[data-theme="dark"] .topgym-nav{
  border-color: var(--border-secondary);
  background: linear-gradient(180deg, var(--bg-sidebar), var(--bg-app));
  color: var(--sidebar-text);
}

html[data-theme="dark"] .theme-toggle-button{
  color: var(--text-secondary);
}

html[data-theme="dark"] .theme-toggle-button:hover{
  border-color: var(--border-hover);
  background: var(--primary-soft);
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn.btn-primary{
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}

html[data-theme="dark"] .btn-primary:hover:not(:disabled),
html[data-theme="dark"] .btn.btn-primary:hover:not(:disabled){
  background: var(--primary-hover);
  box-shadow: var(--shadow-primary-strong);
}

html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn.btn-light{
  border-color: var(--border-hover);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

html[data-theme="dark"] .btn-light:hover:not(:disabled),
html[data-theme="dark"] .btn-secondary:hover:not(:disabled){
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text-primary);
}

html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .btn-link{
  color: var(--text-primary-soft);
}

html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .danger-action,
html[data-theme="dark"] .btn.btn-danger{
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .btn-danger:hover:not(:disabled),
html[data-theme="dark"] .danger-action:hover:not(:disabled){
  border-color: var(--danger);
  background: var(--danger);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .btn-icon,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .action-button,
html[data-theme="dark"] button[data-action]{
  border-color: var(--border-primary);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

html[data-theme="dark"] .btn-icon:hover:not(:disabled),
html[data-theme="dark"] .icon-button:hover:not(:disabled),
html[data-theme="dark"] .action-button:hover:not(:disabled),
html[data-theme="dark"] button[data-action]:hover:not(:disabled){
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text-primary-soft);
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .filter-input,
html[data-theme="dark"] input[type="file"]{
  border-color: var(--border-primary);
  background: var(--bg-input);
  color: var(--text-primary);
  color-scheme: dark;
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):hover,
html[data-theme="dark"] select:hover,
html[data-theme="dark"] textarea:hover,
html[data-theme="dark"] input[type="file"]:hover{
  border-color: var(--border-hover);
  background: var(--bg-card);
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .search-input:focus,
html[data-theme="dark"] .filter-input:focus{
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{
  color: var(--text-disabled);
}

html[data-theme="dark"] option,
html[data-theme="dark"] optgroup{
  background: var(--bg-input);
  color: var(--text-primary);
}

html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"]{
  accent-color: var(--primary);
}

html[data-theme="dark"] .form-field > label,
html[data-theme="dark"] .field > label,
html[data-theme="dark"] .auth-field > label,
html[data-theme="dark"] label.form-label{
  color: var(--text-secondary);
}

html[data-theme="dark"] thead,
html[data-theme="dark"] .table-head,
html[data-theme="dark"] th{
  background: var(--table-header-bg);
  color: var(--text-secondary);
}

html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] tbody td,
html[data-theme="dark"] .table-row{
  border-color: var(--border-secondary);
  color: var(--text-secondary);
}

html[data-theme="dark"] tbody tr,
html[data-theme="dark"] .table-row{
  background: transparent;
}

html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .table-row:hover,
html[data-theme="dark"] .member-feedback-table tbody tr:hover{
  background: var(--primary-soft);
}

html[data-theme="dark"] .table-main,
html[data-theme="dark"] .table-money,
html[data-theme="dark"] .table-member-name,
html[data-theme="dark"] td strong,
html[data-theme="dark"] .member-name,
html[data-theme="dark"] .table-primary{
  color: var(--text-primary);
}

html[data-theme="dark"] .table-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .table-wrap::-webkit-scrollbar-thumb,
html[data-theme="dark"] .data-table-wrap::-webkit-scrollbar-thumb,
html[data-theme="dark"] ::-webkit-scrollbar-thumb{
  background: var(--scrollbar-thumb);
}

html[data-theme="dark"] .table-scroll::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .table-wrap::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .data-table-wrap::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{
  background: var(--border-hover);
}

html[data-theme="dark"] .pagination,
html[data-theme="dark"] .members-pagination,
html[data-theme="dark"] .table-pagination,
html[data-theme="dark"] .coaching-pagination,
html[data-theme="dark"] .library-pagination,
html[data-theme="dark"] .members-page-size,
html[data-theme="dark"] .pagination-info{
  border-color: var(--border-secondary);
  background: var(--bg-card);
  color: var(--text-muted);
}

html[data-theme="dark"] .pagination button,
html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination-page,
html[data-theme="dark"] .members-pagination button,
html[data-theme="dark"] .library-pagination button,
html[data-theme="dark"] .coaching-pagination button{
  border-color: var(--border-primary);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

html[data-theme="dark"] .pagination button:hover:not(:disabled),
html[data-theme="dark"] .pagination a:hover,
html[data-theme="dark"] .pagination-page:hover,
html[data-theme="dark"] .members-pagination button:hover:not(:disabled),
html[data-theme="dark"] .library-pagination button:hover:not(:disabled),
html[data-theme="dark"] .coaching-pagination button:hover:not(:disabled){
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text-primary-soft);
}

html[data-theme="dark"] .pagination button.active,
html[data-theme="dark"] .pagination-page.active,
html[data-theme="dark"] .members-pagination button.active{
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}

html[data-theme="dark"] dialog,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-dialog,
html[data-theme="dark"] [role="dialog"],
html[data-theme="dark"] .swal2-popup,
html[data-theme="dark"] .dropdown,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .more-menu,
html[data-theme="dark"] [data-dropdown-menu],
html[data-theme="dark"] .action-menu-panel,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .drawer,
html[data-theme="dark"] .side-panel{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-popup);
}

html[data-theme="dark"] dialog::backdrop,
html[data-theme="dark"] .modal-backdrop,
html[data-theme="dark"] .modal-overlay,
html[data-theme="dark"] .portal-library-modal{
  background: var(--overlay);
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .dialog-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .dialog-footer,
html[data-theme="dark"] dialog .details-dialog-head,
html[data-theme="dark"] dialog .dialog-actions{
  border-color: var(--border-secondary);
  background: var(--bg-card);
}

html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .dialog-title,
html[data-theme="dark"] .details-dialog-head h3,
html[data-theme="dark"] .details-dialog-head h4,
html[data-theme="dark"] .swal2-title{
  color: var(--text-primary);
}

html[data-theme="dark"] .modal-close,
html[data-theme="dark"] .dialog-close,
html[data-theme="dark"] [data-modal-close],
html[data-theme="dark"] .swal2-close{
  color: var(--text-muted);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .action-menu button:hover,
html[data-theme="dark"] .more-menu button:hover,
html[data-theme="dark"] [data-dropdown-menu] button:hover,
html[data-theme="dark"] [data-dropdown-item]:hover{
  background: var(--primary-soft);
  color: var(--text-primary-soft);
}

html[data-theme="dark"] .toast,
html[data-theme="dark"] .toast-item{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-popup);
}

html[data-theme="dark"] .alert,
html[data-theme="dark"] .notice,
html[data-theme="dark"] .auth-message,
html[data-theme="dark"] .error-message,
html[data-theme="dark"] .success-message,
html[data-theme="dark"] .info-message{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-secondary);
}

html[data-theme="dark"] .alert-success,
html[data-theme="dark"] .success-message,
html[data-theme="dark"] .alert-card.active,
html[data-theme="dark"] .alert-card.active .alert-card-icon,
html[data-theme="dark"] .alert-card.active .alert-status{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .alert-warning,
html[data-theme="dark"] .alert-card.expiring_soon,
html[data-theme="dark"] .alert-card.expiring_soon .alert-card-icon,
html[data-theme="dark"] .alert-card.expiring_soon .alert-status{
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .alert-danger,
html[data-theme="dark"] .error-message,
html[data-theme="dark"] .alert-card.expired,
html[data-theme="dark"] .alert-card.expired .alert-card-icon,
html[data-theme="dark"] .alert-card.expired .alert-status{
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .alert-info,
html[data-theme="dark"] .info-message,
html[data-theme="dark"] .alert-card.frozen,
html[data-theme="dark"] .alert-card.frozen .alert-card-icon,
html[data-theme="dark"] .alert-card.frozen .alert-status{
  border-color: var(--info-border);
  background: var(--info-soft);
  color: var(--info-text);
}

html[data-theme="dark"] .badge,
html[data-theme="dark"] .status-badge,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .tag{
  border-color: var(--border-primary);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

html[data-theme="dark"] .skeleton,
html[data-theme="dark"] .skeleton-row,
html[data-theme="dark"] .skeleton-line{
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--border-secondary) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
}

html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .no-data,
html[data-theme="dark"] .not-found-state,
html[data-theme="dark"] .table-empty,
html[data-theme="dark"] .table-loading{
  border-color: var(--border-hover);
  background: var(--bg-card);
  color: var(--text-muted);
}

html[data-theme="dark"] .dashboard-hero,
html[data-theme="dark"] .dashboard-hero-visual,
html[data-theme="dark"] .dashboard-store-summary,
html[data-theme="dark"] .monthly-finance-snapshot,
html[data-theme="dark"] .management-shortcuts,
html[data-theme="dark"] .backup-management-panel,
html[data-theme="dark"] .backup-history-section,
html[data-theme="dark"] .auth-users-panel,
html[data-theme="dark"] .backup-history-block,
html[data-theme="dark"] .management-shortcut,
html[data-theme="dark"] .dashboard-store-summary-grid article,
html[data-theme="dark"] .monthly-finance-snapshot-metric,
html[data-theme="dark"] .monthly-finance-metric{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
}

html[data-theme="dark"] .dashboard-hero-visual{
  background: radial-gradient(circle at 50% 45%, var(--bg-elevated), var(--bg-input));
}

html[data-theme="dark"] .dashboard-hero-visual::before,
html[data-theme="dark"] .dashboard-hero-visual::after,
html[data-theme="dark"] .dashboard-hero-visual-ring{
  border-color: var(--primary-border);
}

html[data-theme="dark"] .dashboard-hero-visual-logo{
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}

html[data-theme="dark"] .dashboard-hero-stat + .dashboard-hero-stat{
  border-inline-start-color: var(--border-secondary);
}

html[data-theme="dark"] .dashboard-hero-pulse b{
  background: var(--primary-hover);
}

html[data-theme="dark"] .dashboard-hero-pulse b:nth-child(4){
  background: var(--primary);
}

html[data-theme="dark"] .management-shortcut:hover{
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

html[data-theme="dark"] .backup-history-status.success,
html[data-theme="dark"] .auth-status-badge.active,
html[data-theme="dark"] .auth-status-badge.enabled{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .backup-history-status.error,
html[data-theme="dark"] .auth-status-badge.disabled,
html[data-theme="dark"] .auth-status-badge.suspended{
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .dashboard-store-summary-icon,
html[data-theme="dark"] .store-page-icon,
html[data-theme="dark"] .store-tab-icon{
  background: var(--primary-soft);
  color: var(--primary-hover);
}

html[data-theme="dark"] .attendance-entry-card,
html[data-theme="dark"] .attendance-member-preview,
html[data-theme="dark"] .attendance-list-head,
html[data-theme="dark"] .attendance-table-wrap,
html[data-theme="dark"] .attendance-summary-card,
html[data-theme="dark"] .day-pass-panel,
html[data-theme="dark"] .day-pass-form,
html[data-theme="dark"] .day-pass-table-wrap,
html[data-theme="dark"] .member-qr-card,
html[data-theme="dark"] .qr-reader-dialog{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
}

html[data-theme="dark"] .attendance-entry-card,
html[data-theme="dark"] .day-pass-panel{
  background: linear-gradient(145deg, var(--bg-card), var(--bg-surface));
}

html[data-theme="dark"] .attendance-table th,
html[data-theme="dark"] .day-pass-table th,
html[data-theme="dark"] .day-pass-pricing-table th{
  background: var(--table-header-bg);
  color: var(--text-secondary);
}

html[data-theme="dark"] .attendance-source.phone,
html[data-theme="dark"] .attendance-source.qr,
html[data-theme="dark"] .attendance-status,
html[data-theme="dark"] .attendance-status.complete{
  border-color: var(--border-primary);
}

html[data-theme="dark"] .attendance-source.qr{
  background: var(--primary-soft);
  color: var(--primary-hover);
}

html[data-theme="dark"] .attendance-status{
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .attendance-status.complete{
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .member-qr-card canvas{
  background: var(--qr-paper);
}

html[data-theme="dark"] .coaching-builder-dialog.builder-mode-diet > form.dialog-body > .details-dialog-head,
html[data-theme="dark"] .coaching-builder-dialog.builder-mode-workout > form.dialog-body > .details-dialog-head{
  background: linear-gradient(135deg, var(--builder-stage-bg), var(--bg-card) 68%);
}

html[data-theme="dark"] .coaching-builder-ai-tools,
html[data-theme="dark"] .external-trainees-table-wrap,
html[data-theme="dark"] .coaching-summary-card,
html[data-theme="dark"] .coaching-system-card,
html[data-theme="dark"] .coaching-profile-content,
html[data-theme="dark"] .coaching-builder-content,
html[data-theme="dark"] .builder-stage,
html[data-theme="dark"] .builder-calculator,
html[data-theme="dark"] .builder-target-panel,
html[data-theme="dark"] .builder-routine,
html[data-theme="dark"] .builder-meal,
html[data-theme="dark"] .builder-meal-row,
html[data-theme="dark"] .builder-day-panel,
html[data-theme="dark"] .review-block,
html[data-theme="dark"] .exercise-selector,
html[data-theme="dark"] .meal-selector,
html[data-theme="dark"] .program-day-card,
html[data-theme="dark"] .meal-card,
html[data-theme="dark"] .builder-exercise,
html[data-theme="dark"] .builder-food,
html[data-theme="dark"] .builder-exercise-row,
html[data-theme="dark"] .builder-food-row{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
}

html[data-theme="dark"] .coaching-builder-ai-tools{
  background: linear-gradient(135deg, var(--primary-soft), var(--bg-card));
}

html[data-theme="dark"] .coaching-builder-ai-tools > div:first-child span,
html[data-theme="dark"] .builder-stage-heading > div > span,
html[data-theme="dark"] .builder-builder-head > div > span,
html[data-theme="dark"] .builder-section-title > div > span{
  color: var(--primary-hover);
}

html[data-theme="dark"] .external-trainees-table th,
html[data-theme="dark"] .auth-users-table th{
  background: var(--table-header-bg);
}

html[data-theme="dark"] .coaching-action-workout,
html[data-theme="dark"] .system-type.workout,
html[data-theme="dark"] .trainee-badge{
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

html[data-theme="dark"] .coaching-action-diet,
html[data-theme="dark"] .system-type.diet{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .system-status.active{
  border-color: var(--success-border);
  color: var(--success-text);
}

html[data-theme="dark"] .system-status.draft{
  border-color: var(--warning-border);
  color: var(--warning-text);
}

html[data-theme="dark"] .system-status.completed{
  border-color: var(--primary-border);
  color: var(--primary-hover);
}

html[data-theme="dark"] .builder-dialog-actions{
  background: var(--bg-card);
}

html[data-theme="dark"] .builder-step.active,
html[data-theme="dark"] .builder-step.complete,
html[data-theme="dark"] .builder-progress-track > span.active,
html[data-theme="dark"] .builder-progress-track > span.complete{
  color: var(--primary-hover);
}

html[data-theme="dark"] .expense-summary-card,
html[data-theme="dark"] .expenses-tab-panel,
html[data-theme="dark"] .expense-row,
html[data-theme="dark"] .library-type-tabs,
html[data-theme="dark"] .library-toolbar,
html[data-theme="dark"] .library-table-wrap,
html[data-theme="dark"] .library-detail-hero,
html[data-theme="dark"] .library-detail-item,
html[data-theme="dark"] .reports-tabs,
html[data-theme="dark"] .reports-filters,
html[data-theme="dark"] .report-kpi,
html[data-theme="dark"] .report-card,
html[data-theme="dark"] .report-summary-chip,
html[data-theme="dark"] .reports-table-wrap{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
}

html[data-theme="dark"] .expense-summary-card,
html[data-theme="dark"] .expenses-tab-panel{
  background: linear-gradient(135deg, var(--danger-soft), var(--bg-card));
}

html[data-theme="dark"] .library-type-tab,
html[data-theme="dark"] .library-filter,
html[data-theme="dark"] .library-message,
html[data-theme="dark"] .library-detail-item,
html[data-theme="dark"] .report-summary-chip,
html[data-theme="dark"] .reports-table tbody tr:nth-child(even){
  background: var(--bg-elevated);
}

html[data-theme="dark"] .library-type-tab.active,
html[data-theme="dark"] .library-type-tab[aria-selected="true"],
html[data-theme="dark"] .reports-tab[aria-selected="true"]{
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .library-data-table thead th,
html[data-theme="dark"] .reports-table thead th,
html[data-theme="dark"] .day-pass-pricing-table th{
  background: var(--table-header-bg);
}

html[data-theme="dark"] .library-table-badge,
html[data-theme="dark"] .reports-status-badge{
  border-color: var(--border-primary);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

html[data-theme="dark"] .library-table-badge.positive,
html[data-theme="dark"] .reports-status-badge.active,
html[data-theme="dark"] .reports-status-badge.success,
html[data-theme="dark"] .reports-status-badge.completed,
html[data-theme="dark"] .reports-status-badge.paid{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .library-table-badge.warning,
html[data-theme="dark"] .reports-status-badge.pending,
html[data-theme="dark"] .reports-status-badge.draft,
html[data-theme="dark"] .reports-status-badge.expiring_soon{
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .reports-status-badge.expired,
html[data-theme="dark"] .reports-status-badge.failed,
html[data-theme="dark"] .reports-status-badge.archived{
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .reports-status-badge.frozen,
html[data-theme="dark"] .reports-status-badge.paused{
  border-color: var(--info-border);
  background: var(--info-soft);
  color: var(--info-text);
}

html[data-theme="dark"] .member-card,
html[data-theme="dark"] .members-mobile-card,
html[data-theme="dark"] .member-list-card,
html[data-theme="dark"] .membership-portal-code-card,
html[data-theme="dark"] .pricing-summary,
html[data-theme="dark"] .type-preview,
html[data-theme="dark"] .pricing-column-hint,
html[data-theme="dark"] .day-pass-pricing-section,
html[data-theme="dark"] .details-summary-card,
html[data-theme="dark"] .financial-summary-card,
html[data-theme="dark"] .event-item,
html[data-theme="dark"] .member-detail-stat{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
}

html[data-theme="dark"] .membership-portal-code-value,
html[data-theme="dark"] .member-dialog .section-heading,
html[data-theme="dark"] .member-expiry-banner,
html[data-theme="dark"] .member-detail-stat-icon{
  border-color: var(--border-secondary);
  background: var(--bg-elevated);
}

html[data-theme="dark"] .membership-portal-code-value code{
  color: var(--primary-hover);
}

html[data-theme="dark"] #pricingDialog .pricing-table th,
html[data-theme="dark"] #membershipTypesDialog .membership-types-table th{
  background: var(--table-header-bg);
  color: var(--text-secondary);
}

html[data-theme="dark"] #pricingDialog .pricing-table tbody tr:hover td,
html[data-theme="dark"] #membershipTypesDialog .membership-types-table tbody tr:hover td{
  background: var(--primary-soft);
}

html[data-theme="dark"] .type-status,
html[data-theme="dark"] .day-pass-type-status{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .type-status.off,
html[data-theme="dark"] .day-pass-type-status.inactive{
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .store-subnav,
html[data-theme="dark"] .store-card,
html[data-theme="dark"] .store-form-card,
html[data-theme="dark"] .store-product-card,
html[data-theme="dark"] .store-customer-results,
html[data-theme="dark"] .store-customer-result,
html[data-theme="dark"] .store-selected-customer,
html[data-theme="dark"] .store-cart-line,
html[data-theme="dark"] .store-report-summary article,
html[data-theme="dark"] .store-subnav-button{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
}

html[data-theme="dark"] .store-subnav-button:hover,
html[data-theme="dark"] .store-subnav-button:focus-visible,
html[data-theme="dark"] .store-product-card:hover,
html[data-theme="dark"] .store-product-card:focus-visible,
html[data-theme="dark"] .store-customer-result:hover,
html[data-theme="dark"] .store-customer-result:focus-visible,
html[data-theme="dark"] .store-table tbody tr:hover{
  border-color: var(--border-hover);
  background: var(--primary-soft);
}

html[data-theme="dark"] .store-subnav-button.is-active,
html[data-theme="dark"] .store-subnav-button[aria-selected="true"]{
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .store-search-field input,
html[data-theme="dark"] .store-customer-picker input,
html[data-theme="dark"] .store-form-grid input,
html[data-theme="dark"] .store-form-grid select,
html[data-theme="dark"] .store-form-grid textarea,
html[data-theme="dark"] .store-checkout-form input,
html[data-theme="dark"] .store-checkout-form select,
html[data-theme="dark"] .store-checkout-form textarea,
html[data-theme="dark"] .store-report-filters input,
html[data-theme="dark"] .store-cart-quantity input,
html[data-theme="dark"] .store-cart-quantity button,
html[data-theme="dark"] .store-cart-remove{
  border-color: var(--border-primary);
  background: var(--bg-input);
  color: var(--text-primary);
}

html[data-theme="dark"] .store-table th{
  background: var(--table-header-bg);
  color: var(--text-secondary);
}

html[data-theme="dark"] .store-table td{
  border-bottom-color: var(--border-secondary);
}

html[data-theme="dark"] .store-status{
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .store-status.warning{
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .store-status.danger{
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .dashboard-hero,
html[data-theme="dark"] .monthly-finance-card,
html[data-theme="dark"] .dashboard-day-pass-card,
html[data-theme="dark"] .attendance-entry-card,
html[data-theme="dark"] .attendance-insights,
html[data-theme="dark"] .coaching-section,
html[data-theme="dark"] .coaching-header,
html[data-theme="dark"] .coaching-profile,
html[data-theme="dark"] .library-section,
html[data-theme="dark"] .reports-section,
html[data-theme="dark"] .expenses-section,
html[data-theme="dark"] .memberships-section,
html[data-theme="dark"] .permissions-section,
html[data-theme="dark"] .store-section,
html[data-theme="dark"] .intelligence-section,
html[data-theme="dark"] .member-feedback-section{
  background: var(--bg-app);
  color: var(--text-primary);
}

html[data-theme="dark"] .dashboard-hero,
html[data-theme="dark"] .monthly-finance-card,
html[data-theme="dark"] .dashboard-day-pass-card,
html[data-theme="dark"] .attendance-entry-card,
html[data-theme="dark"] .coaching-header,
html[data-theme="dark"] .intelligence-page-header,
html[data-theme="dark"] .intelligence-card,
html[data-theme="dark"] .intelligence-stat-card,
html[data-theme="dark"] .intelligence-plan-result,
html[data-theme="dark"] .intelligence-priority,
html[data-theme="dark"] .reports-filter-panel,
html[data-theme="dark"] .store-card,
html[data-theme="dark"] .library-card,
html[data-theme="dark"] .external-trainee-card{
  border-color: var(--border-primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] .intelligence-page-heading h3,
html[data-theme="dark"] .intelligence-card-head h4,
html[data-theme="dark"] .intelligence-result-head h4,
html[data-theme="dark"] .intelligence-stat-card strong,
html[data-theme="dark"] .intelligence-priority strong,
html[data-theme="dark"] .intelligence-answer p,
html[data-theme="dark"] .intelligence-table td,
html[data-theme="dark"] .intelligence-member-cell strong,
html[data-theme="dark"] .intelligence-result-metrics b,
html[data-theme="dark"] .intelligence-plan-preview-list strong,
html[data-theme="dark"] .intelligence-empty-result strong{
  color: var(--text-primary);
}

html[data-theme="dark"] .intelligence-page-heading p,
html[data-theme="dark"] .intelligence-card-head p,
html[data-theme="dark"] .intelligence-result-head p,
html[data-theme="dark"] .intelligence-stat-card > span,
html[data-theme="dark"] .intelligence-stat-card small,
html[data-theme="dark"] .intelligence-priority small,
html[data-theme="dark"] .intelligence-answer p,
html[data-theme="dark"] .intelligence-table th,
html[data-theme="dark"] .intelligence-table td small,
html[data-theme="dark"] .intelligence-plan-preview-list small,
html[data-theme="dark"] .intelligence-empty-result,
html[data-theme="dark"] .intelligence-human-review-note{
  color: var(--text-muted);
}

html[data-theme="dark"] .intelligence-card-mark,
html[data-theme="dark"] .intelligence-plan-type,
html[data-theme="dark"] .intelligence-result-metrics span,
html[data-theme="dark"] .intelligence-plan-preview-list article{
  border-color: var(--border-secondary);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

html[data-theme="dark"] .intelligence-plan-type button.is-active,
html[data-theme="dark"] .intelligence-prompt,
html[data-theme="dark"] .intelligence-answer{
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text-primary-soft);
}

html[data-theme="dark"] .intelligence-result-notice.warning,
html[data-theme="dark"] .intelligence-message.warning{
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .intelligence-result-notice.success,
html[data-theme="dark"] .intelligence-message.success{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .intelligence-message.error{
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .auth-screen{
  background-color: var(--bg-app);
}

html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .auth-form-panel{
  border-color: var(--border-primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-popup);
}

html[data-theme="dark"] .auth-form-heading h2,
html[data-theme="dark"] .auth-form .auth-field > label,
html[data-theme="dark"] .auth-remember{
  color: var(--text-primary);
}

html[data-theme="dark"] .auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] .auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]){
  border-color: var(--border-primary);
  background: var(--bg-input);
  color: var(--text-primary);
}

html[data-theme="dark"] .auth-form .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] .auth-form .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]):focus{
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

html[data-theme="dark"] .auth-password-toggle{
  color: var(--text-muted);
}

html[data-theme="dark"] .auth-submit{
  background: var(--primary);
  box-shadow: var(--shadow-primary);
}

html[data-theme="dark"] .auth-submit:hover:not(:disabled){
  background: var(--primary-hover);
}

html[data-theme="dark"] .member-portal-page,
html[data-theme="dark"] .member-portal-page .portal-shell{
  background: var(--bg-app);
  color: var(--text-primary);
}

html[data-theme="dark"] .portal-login,
html[data-theme="dark"] .portal-result,
html[data-theme="dark"] .portal-feedback,
html[data-theme="dark"] .portal-tool-card,
html[data-theme="dark"] .portal-anatomy-card,
html[data-theme="dark"] .portal-library-section,
html[data-theme="dark"] .portal-exercise-card,
html[data-theme="dark"] .portal-food-card,
html[data-theme="dark"] .portal-library-modal-card,
html[data-theme="dark"] .portal-detail-block,
html[data-theme="dark"] .portal-member-identity,
html[data-theme="dark"] .portal-stat,
html[data-theme="dark"] .portal-table-wrap{
  border-color: var(--border-primary);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] .portal-result-header,
html[data-theme="dark"] .portal-library-head,
html[data-theme="dark"] .portal-report-signatures{
  border-color: var(--border-secondary);
}

html[data-theme="dark"] .portal-security-note,
html[data-theme="dark"] .portal-library-filter-bar,
html[data-theme="dark"] .portal-anatomy-3d-shell,
html[data-theme="dark"] .portal-anatomy-view,
html[data-theme="dark"] .portal-detail-copy > p,
html[data-theme="dark"] .portal-food-detail-hero,
html[data-theme="dark"] .portal-food-calories,
html[data-theme="dark"] .portal-detail-stat-grid span,
html[data-theme="dark"] .portal-detail-stat-grid div,
html[data-theme="dark"] .portal-detail-block,
html[data-theme="dark"] .portal-library-selection,
html[data-theme="dark"] .portal-exercise-tags span,
html[data-theme="dark"] .portal-food-title > span,
html[data-theme="dark"] .portal-detail-tags span,
html[data-theme="dark"] .portal-macro-grid span,
html[data-theme="dark"] .portal-library-state-wide{
  border-color: var(--border-secondary);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

html[data-theme="dark"] .portal-anatomy-3d-placeholder,
html[data-theme="dark"] .portal-anatomy-3d-unavailable,
html[data-theme="dark"] .portal-exercise-media,
html[data-theme="dark"] .portal-library-state-wide{
  background: var(--bg-elevated);
  color: var(--text-muted);
}

html[data-theme="dark"] .portal-anatomy-3d-badge,
html[data-theme="dark"] .portal-anatomy-zone,
html[data-theme="dark"] .portal-muscle-chip,
html[data-theme="dark"] .portal-library-filter-bar input,
html[data-theme="dark"] .portal-library-filter-bar select,
html[data-theme="dark"] .portal-anatomy-3d-controls button,
html[data-theme="dark"] .portal-stars button,
html[data-theme="dark"] .portal-food-detail-icon{
  border-color: var(--border-primary);
  background: var(--bg-input);
  color: var(--text-secondary);
}

html[data-theme="dark"] .portal-anatomy-zone:hover,
html[data-theme="dark"] .portal-anatomy-zone:focus-visible,
html[data-theme="dark"] .portal-anatomy-zone.is-active,
html[data-theme="dark"] .portal-muscle-chip:hover,
html[data-theme="dark"] .portal-muscle-chip:focus-visible,
html[data-theme="dark"] .portal-muscle-chip.is-active,
html[data-theme="dark"] .portal-anatomy-3d-controls button:hover,
html[data-theme="dark"] .portal-anatomy-3d-controls button:focus-visible{
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text-primary-soft);
}

html[data-theme="dark"] .portal-anatomy-progress{
  background: var(--border-primary);
}

html[data-theme="dark"] .portal-anatomy-progress i{
  background: var(--primary);
}

html[data-theme="dark"] .portal-anatomy-hotspot{
  border-color: var(--text-on-primary);
  background: var(--primary);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .portal-anatomy-hotspot:hover,
html[data-theme="dark"] .portal-anatomy-hotspot:focus-visible,
html[data-theme="dark"] .portal-anatomy-hotspot.is-active{
  background: var(--primary-hover);
  box-shadow: 0 0 0 6px var(--primary-soft), var(--shadow-primary);
}

html[data-theme="dark"] .portal-food-calories,
html[data-theme="dark"] .portal-macro-grid span{
  background: var(--bg-input);
}

html[data-theme="dark"] .portal-outstanding,
html[data-theme="dark"] .portal-table .portal-debt,
html[data-theme="dark"] .portal-library-error,
html[data-theme="dark"] .portal-library-error strong,
html[data-theme="dark"] .portal-feedback-message{
  color: var(--danger-text);
}

html[data-theme="dark"] .portal-feedback-message.success{
  color: var(--success-text);
}

html[data-theme="dark"] .portal-library-loader{
  border-color: var(--border-primary);
  border-top-color: var(--primary);
}

html[data-theme="dark"] .portal-login h1,
html[data-theme="dark"] .portal-result h2,
html[data-theme="dark"] .portal-view-toolbar h3,
html[data-theme="dark"] .portal-section h3,
html[data-theme="dark"] .portal-detail-hero h4,
html[data-theme="dark"] .portal-food-detail-hero h4,
html[data-theme="dark"] .portal-library-head h3,
html[data-theme="dark"] .portal-library-head h4,
html[data-theme="dark"] .portal-library-results-head h4,
html[data-theme="dark"] .portal-exercise-title h5,
html[data-theme="dark"] .portal-food-title h5,
html[data-theme="dark"] .portal-stat strong,
html[data-theme="dark"] .portal-detail-block h4,
html[data-theme="dark"] .portal-detail-stat-grid b,
html[data-theme="dark"] .portal-food-calories strong{
  color: var(--text-primary);
}

html[data-theme="dark"] .portal-intro,
html[data-theme="dark"] .portal-result-header p:last-child,
html[data-theme="dark"] .portal-view-toolbar p:last-child,
html[data-theme="dark"] .portal-member-identity p,
html[data-theme="dark"] .portal-stat small,
html[data-theme="dark"] .portal-stat span,
html[data-theme="dark"] .portal-detail-hero p,
html[data-theme="dark"] .portal-food-detail-hero p,
html[data-theme="dark"] .portal-library-head p,
html[data-theme="dark"] .portal-library-head p,
html[data-theme="dark"] .portal-tool-card small,
html[data-theme="dark"] .portal-detail-block ul,
html[data-theme="dark"] .portal-detail-muted,
html[data-theme="dark"] .portal-library-state,
html[data-theme="dark"] .portal-library-pagination,
html[data-theme="dark"] .portal-ui-footer{
  color: var(--text-muted);
}

html[data-theme="dark"] .portal-lookup-form label,
html[data-theme="dark"] .portal-feedback-form label,
html[data-theme="dark"] .portal-rating-field legend,
html[data-theme="dark"] .portal-library-filter-bar label{
  color: var(--text-secondary);
}

html[data-theme="dark"] .portal-lookup-form input,
html[data-theme="dark"] .portal-feedback-form select,
html[data-theme="dark"] .portal-feedback-form textarea,
html[data-theme="dark"] .portal-library-filter-bar input,
html[data-theme="dark"] .portal-library-filter-bar select,
html[data-theme="dark"] .portal-anatomy-3d-controls button,
html[data-theme="dark"] .portal-stars button,
html[data-theme="dark"] .portal-muscle-chip{
  border-color: var(--border-primary);
  background: var(--bg-input);
  color: var(--text-primary);
}

html[data-theme="dark"] .portal-security-note,
html[data-theme="dark"] .portal-library-filter-bar,
html[data-theme="dark"] .portal-anatomy-3d-shell,
html[data-theme="dark"] .portal-anatomy-view,
html[data-theme="dark"] .portal-detail-copy > p,
html[data-theme="dark"] .portal-food-detail-hero,
html[data-theme="dark"] .portal-food-calories,
html[data-theme="dark"] .portal-detail-stat-grid div{
  border-color: var(--border-secondary);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

html[data-theme="dark"] .portal-security-icon,
html[data-theme="dark"] .portal-member-avatar,
html[data-theme="dark"] .portal-tool-card-print .portal-tool-icon,
html[data-theme="dark"] .portal-anatomy-selected,
html[data-theme="dark"] .portal-detail-tags span{
  background: var(--primary-soft);
  color: var(--text-primary-soft);
}

html[data-theme="dark"] .portal-status.active,
html[data-theme="dark"] .portal-tool-card-exercises .portal-tool-icon{
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .portal-status.expiring_soon,
html[data-theme="dark"] .portal-tool-card-feedback .portal-tool-icon,
html[data-theme="dark"] .portal-feedback-icon{
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .portal-status.expired,
html[data-theme="dark"] .portal-library-error,
html[data-theme="dark"] .portal-feedback-message{
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .portal-status.frozen,
html[data-theme="dark"] .portal-tool-card-foods .portal-tool-icon,
html[data-theme="dark"] .portal-food-symbol{
  background: var(--info-soft);
  color: var(--info-text);
}

html[data-theme="dark"] .portal-table th,
html[data-theme="dark"] .portal-table td{
  border-color: var(--border-secondary);
}

html[data-theme="dark"] .portal-table th{
  background: var(--table-header-bg);
  color: var(--text-secondary);
}

html[data-theme="dark"] .portal-table td{
  color: var(--text-secondary);
}

html[data-theme="dark"] .portal-library-modal-card > header{
  border-color: var(--border-secondary);
  background: var(--bg-card);
}

html[data-theme="dark"] .portal-library-modal-close{
  border-color: var(--border-primary);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

html[data-theme="dark"] .portal-anatomy-3d-shell,
html[data-theme="dark"] .portal-anatomy-view{
  background: radial-gradient(circle at 50% 42%, var(--bg-elevated), var(--bg-input) 78%);
}

.theme-toggle-button{
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle-button:hover,
.theme-toggle-button:focus-visible{
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-1px);
}

.theme-toggle-button .ui-icon{
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.theme-toggle-icon-light{
  display: none;
}

html[data-theme="dark"] .theme-toggle-icon-dark{
  display: none;
}

html[data-theme="dark"] .theme-toggle-icon-light{
  display: block;
}

.auth-shell{
  display: grid;
  gap: var(--space-3);
}

.auth-theme-toggle{
  justify-self: end;
}

.qr-member-page{
  min-height: 100vh;
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
}

.qr-member-page .qr-member-shell{
  width: min(680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.qr-member-page .qr-member-card{
  overflow: hidden;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-popup);
}

.qr-member-page .qr-member-head,
.qr-member-page .qr-member-body,
.qr-member-page .qr-member-foot{
  padding: var(--space-6);
}

.qr-member-page .qr-member-head{
  border-bottom: 1px solid var(--border-secondary);
  background: linear-gradient(135deg, var(--primary-active), var(--primary));
  color: var(--text-on-primary);
}

.qr-member-page .qr-member-head h1,
.qr-member-page .qr-member-head p{
  color: inherit;
}

.qr-member-page .qr-member-brand{
  color: var(--text-primary-soft);
  font-weight: var(--weight-extrabold);
  letter-spacing: .08em;
  direction: ltr;
}

.qr-member-page .qr-member-body{
  display: grid;
  gap: var(--space-5);
}

.qr-member-page .qr-member-identity,
.qr-member-page .qr-member-item{
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  padding: var(--space-4);
}

.qr-member-page .qr-member-identity{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.qr-member-page .qr-member-identity span,
.qr-member-page .qr-member-item span{
  display: block;
  color: var(--text-muted);
  font-size: var(--font-xs);
}

.qr-member-page .qr-member-identity strong,
.qr-member-page .qr-member-item strong{
  color: var(--text-primary);
}

.qr-member-page .qr-member-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.qr-member-page .qr-member-status{
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success-text);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.qr-member-page .qr-member-status.expired,
.qr-member-page .qr-member-status.unknown{
  background: var(--danger-soft);
  color: var(--danger-text);
}

.qr-member-page .qr-member-status.expiring_soon{
  background: var(--warning-soft);
  color: var(--warning-text);
}

.qr-member-page .qr-member-foot{
  border-top: 1px solid var(--border-secondary);
  color: var(--text-muted);
  font-size: var(--font-xs);
  text-align: center;
}

html[data-theme="dark"] .qr-member-page .theme-toggle-button{
  border-color: var(--border-primary);
  background: var(--bg-elevated);
}

@media (max-width: 560px){
  .qr-member-page .qr-member-shell{
    width: min(100% - 20px, 680px);
    padding: 20px 0;
  }

  .qr-member-page .qr-member-head,
.qr-member-page .qr-member-body,
.qr-member-page .qr-member-foot{
    padding: var(--space-4);
  }

  .qr-member-page .qr-member-grid{
    grid-template-columns: 1fr;
  }
}

.portal-shell{
  position: relative;
}

.portal-theme-toggle{
  position: static;
  z-index: auto;
  min-width: 124px;
  min-height: 42px;
  padding-inline: 13px;
  border-radius: 12px;
  gap: 8px;
  box-shadow: var(--shadow-card);
}

.portal-theme-toggle .ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.portal-theme-toggle span {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.portal-theme-toggle:active:not(:disabled) {
  transform: translateY(0);
}

html[data-theme="dark"] .member-portal-page .portal-theme-toggle {
  border-color: var(--border-primary);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

html[data-theme="dark"] .member-portal-page .portal-theme-toggle:hover,
html[data-theme="dark"] .member-portal-page .portal-theme-toggle:focus-visible {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

html[data-theme="dark"] .table-actions,
html[data-theme="dark"] .row-actions,
html[data-theme="dark"] .members-actions,
html[data-theme="dark"] .action-group,
html[data-theme="dark"] .library-row-actions,
html[data-theme="dark"] .store-row-actions,
html[data-theme="dark"] .day-pass-actions,
html[data-theme="dark"] .attendance-row-actions,
html[data-theme="dark"] .reports-debtor-actions,
html[data-theme="dark"] .reports-coaching-actions,
html[data-theme="dark"] .type-actions{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: max-content;
  flex-wrap: nowrap;
  white-space: nowrap;
}

html[data-theme="dark"] .table-actions > .btn,
html[data-theme="dark"] .row-actions > .btn,
html[data-theme="dark"] .members-actions > .btn,
html[data-theme="dark"] .action-group > .btn,
html[data-theme="dark"] .library-row-actions > .btn,
html[data-theme="dark"] .store-row-actions > .btn,
html[data-theme="dark"] .day-pass-actions > .btn,
html[data-theme="dark"] .attendance-row-actions > .btn,
html[data-theme="dark"] .reports-debtor-actions > .btn,
html[data-theme="dark"] .reports-coaching-actions > .btn,
html[data-theme="dark"] .type-actions > .btn{
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  box-shadow: none;
}

html[data-theme="dark"] .table-actions > .icon-action:not([data-action="renew"]),
html[data-theme="dark"] .table-actions > .table-action-visible:not([data-action="renew"]),
html[data-theme="dark"] .action-menu > .action-menu-toggle,
html[data-theme="dark"] .library-row-actions > .library-action-button,
html[data-theme="dark"] .day-pass-actions > .day-pass-action-button.is-compact{
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

html[data-theme="dark"] .table-actions > .icon-action[data-action="renew"],
html[data-theme="dark"] .table-actions > .table-action-visible[data-action="renew"]{
  min-width: 96px;
  padding-inline: 10px;
}

html[data-theme="dark"] .attendance-row-actions > .btn{
  min-width: 118px;
  padding-inline: 10px;
}

html[data-theme="dark"] .table-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .row-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .members-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .action-group > .btn:hover:not(:disabled),
html[data-theme="dark"] .library-row-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .store-row-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .day-pass-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .attendance-row-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .reports-debtor-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .reports-coaching-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .type-actions > .btn:hover:not(:disabled),
html[data-theme="dark"] .action-menu > .action-menu-toggle:hover:not(:disabled){
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text-primary-soft);
  transform: translateY(-1px);
}

html[data-theme="dark"] .table-actions > [data-action="renew"],
html[data-theme="dark"] .table-actions > [data-member-coaching-action="workout"],
html[data-theme="dark"] .coaching-table-action.workout{
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

html[data-theme="dark"] .table-actions > [data-action="payment"]{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .table-actions > [data-action="freeze"],
html[data-theme="dark"] .attendance-row-actions > .attendance-checkout-button,
html[data-theme="dark"] .day-pass-actions > .day-pass-void-button,
html[data-theme="dark"] .store-row-actions > [data-store-deactivate-product]{
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning-text);
}

html[data-theme="dark"] .reports-debtor-actions > .reports-whatsapp-button{
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

html[data-theme="dark"] .reports-debtor-actions > .reports-whatsapp-button:hover:not(:disabled){
  border-color: var(--success);
  background: var(--success);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .table-actions > [data-action="delete"],
html[data-theme="dark"] .library-row-actions > .library-delete,
html[data-theme="dark"] .day-pass-actions > .day-pass-delete-button,
html[data-theme="dark"] .store-row-actions > [data-store-delete-expense]{
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

html[data-theme="dark"] .table-actions > [data-action="payment"]:hover:not(:disabled){
  border-color: var(--success);
  background: var(--success);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .table-actions > [data-action="freeze"]:hover:not(:disabled),
html[data-theme="dark"] .attendance-row-actions > .attendance-checkout-button:hover:not(:disabled),
html[data-theme="dark"] .store-row-actions > [data-store-deactivate-product]:hover:not(:disabled){
  border-color: var(--warning);
  background: var(--warning);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .table-actions > [data-action="delete"]:hover:not(:disabled),
html[data-theme="dark"] .library-row-actions > .library-delete:hover:not(:disabled),
html[data-theme="dark"] .day-pass-actions > .day-pass-delete-button:hover:not(:disabled),
html[data-theme="dark"] .day-pass-actions > .day-pass-void-button:hover:not(:disabled),
html[data-theme="dark"] .store-row-actions > [data-store-delete-expense]:hover:not(:disabled){
  border-color: var(--danger);
  background: var(--danger);
  color: var(--text-on-primary);
}

html[data-theme="dark"] .member-quick-actions .member-attendance-quick,
html[data-theme="dark"] .member-quick-actions .member-attendance-status{
  min-height: 36px;
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce){
  html[data-theme="dark"] *,
html[data-theme="dark"] *::before,
html[data-theme="dark"] *::after{
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }
}

html[data-theme="light"] .theme-toggle-button{
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 4px 12px rgb(23 105 232 / 0.12);
}

html[data-theme="light"] .theme-toggle-button:hover,
html[data-theme="light"] .theme-toggle-button:focus-visible{
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-primary);
}

@media (max-width: 767px){




































  .dashboard-section-heading{
    margin-top: 2px;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/ui-foundation.css */
/*
 * Logic Fit UI foundation
 *
 * Shared presentation rules for the existing Vanilla UI. Shell navigation is
 * intentionally excluded and lives in navigation-shell.css.
 */

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

:where(button, input, select, textarea) {
  font-family: var(--font-body);
}

:where(.platform-admin-page, .member-portal-page, .public-registration-page) {
  min-height: 100dvh;
  overflow-x: clip;
}

:where(.page, .platform-content, .member-portal-page .portal-shell, .registration-shell) {
  isolation: isolate;
}

:where(.page-header, .section-heading, .panel-header, .platform-page-head,
  .portal-result-header, .registration-card-head) h1,
:where(.page-header, .section-heading, .panel-header, .platform-page-head,
  .portal-result-header, .registration-card-head) h2,
:where(.page-header, .section-heading, .panel-header, .platform-page-head,
  .portal-result-header, .registration-card-head) h3 {
  overflow-wrap: anywhere;
}

:where(.panel, .card, .shadow-panel) {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

:where(.btn, .platform-btn, .platform-link-btn, .portal-actions .btn) {
  min-height: 42px;
  font-family: var(--font-body);
  line-height: 1.35;
}

:where(button.btn, button.platform-btn, button.platform-link-btn):disabled,
:where(button.btn, button.platform-btn, button.platform-link-btn)[aria-busy="true"] {
  cursor: wait;
}

:where(.btn.is-loading, .platform-btn.is-loading, button[aria-busy="true"]) {
  pointer-events: none;
}

:where(.form-field, .field, .auth-field, .platform-field) > label {
  line-height: 1.55;
}

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea,
  .form-control, .search-input, .filter-input) {
  min-width: 0;
  color: var(--color-text);
  caret-color: var(--color-primary);
}

:where(.table-scroll, .table-wrap, .data-table-wrap, .portal-table-wrap) {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

:where(.table-scroll, .table-wrap, .data-table-wrap, .portal-table-wrap)::-webkit-scrollbar {
  height: 8px;
}

:where(.table-scroll, .table-wrap, .data-table-wrap, .portal-table-wrap)::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

:where(.table-scroll, .table-wrap, .data-table-wrap, .portal-table-wrap)::-webkit-scrollbar-thumb {
  border: 2px solid var(--scrollbar-track);
  border-radius: var(--radius-pill);
  background: var(--scrollbar-thumb);
}

:where(.empty-state, .empty, .no-data, .not-found-state) {
  min-height: 156px;
}

:where(.error-state, .page-error, .registration-error, .portal-error) {
  overflow-wrap: anywhere;
}

/* Platform Admin */
.platform-shell {
  min-height: 100dvh;
  background: var(--bg-app);
  color: var(--text-primary);
}

.platform-content {
  width: min(100%, 1440px);
}

.platform-card,
.platform-login-card {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.platform-card .card-heading,
.platform-page-head,
.directory-toolbar,
.platform-dashboard-grid {
  min-width: 0;
}

.platform-global-search > span .ui-icon,
.platform-search-field > span .ui-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.platform-table th {
  letter-spacing: 0;
}

.platform-nav-item .nav-icon .ui-icon,
.quick-actions button > span:first-child .ui-icon {
  width: 16px;
  height: 16px;
}

.quick-actions button,
.platform-nav-item,
.platform-icon-btn {
  -webkit-tap-highlight-color: transparent;
}

/* Member Portal */
.member-portal-page .portal-result {
  width: min(100%, 1120px);
  margin-inline: auto;
}

.member-portal-page .portal-section,
.member-portal-page .portal-feedback,
.member-portal-page .portal-tool-card {
  min-width: 0;
}

/* Register Gym */
.public-registration-page .registration-shell {
  width: min(100% - 32px, 1280px);
}

.public-registration-page .registration-card,
.public-registration-page .registration-aside {
  min-width: 0;
}

.registration-plan-option,
.registration-term-option,
.registration-payment-option {
  -webkit-tap-highlight-color: transparent;
}

/* Keep the native file input accessible without allowing its invisible box to
   widen the page. */
.portal-proof-picker > input[type="file"],
.registration-upload > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 767px) {
  :where(.btn, .platform-btn, .platform-link-btn, .portal-actions .btn) {
    min-height: 44px;
  }

  :where(.page, .platform-content, .member-portal-page .portal-shell,
    .public-registration-page .registration-shell) {
    width: calc(100% - 24px);
  }

  .platform-content {
    padding-inline: 12px;
  }

  .platform-page-head,
  .portal-result-header,
  .registration-card-head {
    align-items: stretch;
  }

  .platform-page-head .platform-btn,
  .platform-page-head .platform-page-actions,
  .registration-actions > *,
  .portal-actions > * {
    max-width: 100%;
  }

  .platform-page-head .platform-page-actions {
    flex-wrap: wrap;
  }

  .platform-page-head .platform-page-actions > .platform-btn {
    flex: 1 1 160px;
  }

  .registration-actions {
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  :where(dialog, .modal) {
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 380px) {
  .public-registration-page .registration-shell,
  .member-portal-page .portal-shell {
    width: calc(100% - 16px);
  }

  .platform-content {
    padding-inline: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(*, *::before, *::after) {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/design-foundation.css */
/*
 * Logic Fit product foundation
 *
 * This is the Vanilla CSS adaptation of the HeroUI patterns researched via
 * the live MCP: semantic action variants, composed surfaces, visible focus,
 * and predictable disabled/loading states. It is intentionally additive so
 * existing page contracts and business behavior remain untouched.
 */

:root {
  --ui-control-height: 44px;
  --ui-touch-target: 44px;
  --ui-content-gutter: clamp(16px, 2.6vw, 32px);
  --ui-surface-radius: var(--radius-lg);
  --ui-elevation-rest: var(--shadow-xs);
  --ui-elevation-hover: var(--shadow-sm);
}

/* Semantic focus is shared by every interactive surface. */
:where(button, a, input, select, textarea, [role="button"], [role="tab"]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  box-shadow: var(--focus-ring);
}

/* Keep controls composable: existing page-specific variants still win where
   they intentionally define a different size or layout. */
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border-color: var(--border-primary);
  background: var(--bg-input);
}

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):hover:not(:disabled) {
  border-color: var(--border-hover);
}

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus-visible {
  border-color: var(--border-focus);
  outline: 0;
}

:where(.panel, .card, .content-card, .shadow-panel, .stat-card, .management-card,
  .library-card, .finance-card, .attendance-card, .platform-card, .portal-tool-card) {
  border-color: var(--border-secondary);
  background: var(--bg-surface);
  box-shadow: var(--ui-elevation-rest);
}

:where(.panel, .card, .content-card, .shadow-panel, .platform-card, .portal-tool-card) {
  border-radius: var(--ui-surface-radius);
}

:where(.panel, .card, .content-card, .shadow-panel, .stat-card, .management-card,
  .library-card, .finance-card, .attendance-card, .platform-card, .portal-tool-card) {
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

:where(.panel, .card, .content-card, .shadow-panel, .stat-card, .management-card,
  .library-card, .finance-card, .attendance-card, .platform-card, .portal-tool-card):hover {
  border-color: var(--border-hover);
  box-shadow: var(--ui-elevation-hover);
}

/* HeroUI's semantic variant language mapped to the existing button contract. */
:where(.btn-primary, .platform-btn-primary, [data-variant="primary"]) {
  background: var(--color-primary);
  color: var(--text-on-primary);
}

:where(.btn-secondary, .btn-light, .platform-btn-secondary, [data-variant="secondary"]) {
  border-color: var(--border-primary);
  background: var(--bg-surface);
  color: var(--color-primary);
}

:where(.btn-ghost, .btn-link, [data-variant="ghost"]) {
  background: transparent;
  color: var(--color-primary);
}

:where(.btn-danger, [data-variant="danger"]) {
  background: var(--color-danger);
  color: var(--text-on-primary);
}

:where(.btn, .platform-btn, .platform-link-btn, .portal-actions .btn) {
  min-height: var(--ui-control-height);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:where(.btn, .platform-btn, .platform-link-btn, .portal-actions .btn):disabled,
:where(.btn, .platform-btn, .platform-link-btn, .portal-actions .btn)[aria-disabled="true"] {
  cursor: not-allowed;
  filter: saturate(.72);
  opacity: .56;
  transform: none;
}

:where(.btn[aria-busy="true"], .platform-btn[aria-busy="true"], .btn.is-loading,
  .platform-btn.is-loading) {
  cursor: wait;
  pointer-events: none;
}

/* Composed status surfaces keep loading, empty and error states legible in
   both themes without requiring every feature page to invent its own box. */
:where(.empty-state, .empty, .no-data, .not-found-state, .loading, .error-state,
  .page-error, .registration-error, .portal-error) {
  border-radius: var(--radius-lg);
  overflow-wrap: anywhere;
}

:where(.empty-state, .empty, .no-data, .not-found-state) {
  border: 1px dashed var(--border-primary);
  background: var(--bg-card-hover);
  color: var(--text-muted);
}

:where(.loading) {
  color: var(--text-muted);
}

:where(.error-state, .page-error, .registration-error, .portal-error) {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

:where(.badge, .chip, .status-badge, .branch-status) {
  max-width: 100%;
  overflow-wrap: anywhere;
}

:where(.table-wrap, .table-scroll, .data-table-wrap, .portal-table-wrap,
  .member-requests-table-wrap) {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

/* Do not animate if the user has requested reduced motion. */
@media (prefers-reduced-motion: reduce) {
  :where(.panel, .card, .content-card, .shadow-panel, .stat-card, .management-card,
    .library-card, .finance-card, .attendance-card, .platform-card, .portal-tool-card,
    .btn, .platform-btn) {
    transition: none;
  }
}

@media (max-width: 767px) {
  :where(.btn, .platform-btn, .platform-link-btn, .portal-actions .btn) {
    min-height: var(--ui-touch-target);
  }

  :where(.panel, .card, .content-card, .shadow-panel, .platform-card, .portal-tool-card) {
    border-radius: var(--radius-lg);
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/components/navigation-shell.css */
/*
 * Logic Fit Gym App navigation shell
 *
 * This is the single source of truth for .app-shell, .topbar and .page-tabs.
 * The layout keeps the header, navigation rail and workspace in separate
 * tracks, so the rail can expand on hover without covering the page or
 * stealing clicks from the workspace. It consumes the existing semantic
 * tokens and does not introduce a new theme.
 */

.app-shell {
  position: relative;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  overflow-x: clip;
  background: var(--bg-app);
  color: var(--text-primary);
  direction: rtl;

  /* Navigation motion is intentionally local to the shell. Keeping these
     values here prevents a sidebar refinement from changing motion elsewhere
     in the product. */
  --sidebar-rail-transition: 240ms cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-item-transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-label-transition: 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* App lifecycle states stay with the shell so release/lock transitions do not
   become a second source of navigation presentation rules. */
.auth-pending .app-shell,
.auth-locked .app-shell {
  display: none;
}

.top-gym-navigation-pending .page-tabs {
  opacity: .86;
  transition: opacity 160ms ease;
}

.app-shell > .topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: block;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--sidebar-divider);
  background: var(--bg-header);
  color: var(--sidebar-text);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  box-sizing: border-box;
  display: flex;
  width: min(100% - 48px, 1520px);
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-inline: auto;
  padding-block: 14px;
  direction: rtl;
}

.topbar-brand-area,
.topbar-controls,
.topbar-quick-actions,
.topbar-welcome,
.auth-account-bar,
.auth-account-identity,
.brand,
.header-profile,
.top-actions,
.header-search,
.header-notification,
.header-backup,
.header-refresh {
  display: flex;
  align-items: center;
}

.topbar-brand-area {
  min-width: 0;
  flex: 1 1 auto;
  gap: var(--space-4);
}

.topbar-brand-area .brand {
  min-width: 0;
  gap: var(--space-3);
}

.topbar-brand-area .brand-mark {
  display: inline-flex;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--brand-image-radius);
  background: transparent;
  color: var(--sidebar-text);
}

.topbar-brand-mark .brand-logo-primary,
.topbar-brand-mark .brand-logo-compact {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.topbar-brand-mark .brand-logo-compact {
  display: none;
}

.topbar-brand-area .brand-mark .ui-icon {
  width: 24px;
  height: 24px;
}

.topbar-brand-area .brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.topbar-brand-area .brand-copy h1,
.topbar-brand-area .brand-copy p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-brand-area .brand-copy h1 {
  color: var(--sidebar-text);
  font-family: var(--font-heading);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
  line-height: 1.35;
}

.topbar-brand-area .brand-copy p {
  max-width: 310px;
  color: var(--sidebar-text-muted);
  font-size: var(--font-xs);
  line-height: 1.45;
}

.topbar-brand-area .brand-kicker,
.topbar-section-context,
.topbar-welcome {
  display: none;
}

.topbar-controls {
  min-width: 0;
  flex: 0 1 auto;
  justify-content: flex-start;
  gap: var(--space-2);
  direction: rtl;
}

.topbar-quick-actions,
.top-actions {
  min-width: 0;
  gap: var(--space-2);
  margin: 0;
}

.topbar-quick-actions .header-search,
.topbar-quick-actions .header-notification,
.topbar-quick-actions .header-backup,
.topbar-quick-actions .header-refresh {
  min-height: 40px;
  border: 1px solid var(--sidebar-divider);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sidebar-text-muted);
  padding-inline: var(--space-2);
}

.topbar-quick-actions .header-search:hover,
.topbar-quick-actions .header-search:focus-visible,
.topbar-quick-actions .header-notification:hover,
.topbar-quick-actions .header-notification:focus-visible,
.topbar-quick-actions .header-backup:hover,
.topbar-quick-actions .header-backup:focus-visible,
.topbar-quick-actions .header-refresh:hover,
.topbar-quick-actions .header-refresh:focus-visible {
  border-color: var(--primary-border);
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}

.topbar-theme-toggle,
.kiosk-toggle-button,
.mobile-nav-toggle {
  box-sizing: border-box;
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sidebar-divider);
  border-radius: var(--radius-md);
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
  padding: 0;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.topbar-theme-toggle:hover,
.topbar-theme-toggle:focus-visible,
.kiosk-toggle-button:hover,
.kiosk-toggle-button:focus-visible,
.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus-visible {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--sidebar-text);
  transform: translateY(-1px);
}

.topbar-theme-toggle .ui-icon,
.kiosk-toggle-button .ui-icon,
.mobile-nav-toggle .ui-icon {
  width: 20px;
  height: 20px;
}

.mobile-nav-toggle {
  display: inline-flex;
}

.topbar-controls > .auth-account-bar {
  min-width: 0;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}

.topbar-controls > .auth-account-bar[hidden] {
  display: none;
}

.auth-account-identity {
  min-width: 0;
  gap: var(--space-2);
}

.auth-account-avatar {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary-border);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--text-on-primary);
  font-family: var(--font-latin);
  font-size: var(--font-xs);
  font-weight: var(--weight-extrabold);
}

.auth-account-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.auth-account-copy strong,
.auth-account-copy small {
  display: block;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-account-copy strong {
  color: var(--sidebar-text);
  font-size: var(--font-xs);
}

.auth-account-copy small {
  color: var(--sidebar-text-muted);
  font-size: 10px;
}

.auth-logout-button {
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger-text);
  padding: 0;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.auth-logout-button > span {
  display: none;
}

.auth-logout-button .ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke-width: 2.2px;
}

.auth-logout-button:hover:not(:disabled),
.auth-logout-button:focus-visible {
  border-color: var(--danger-border);
  background: var(--danger-border);
  color: var(--danger-text);
  box-shadow: 0 0 0 3px var(--danger-soft);
  transform: translateY(-1px);
}

.auth-logout-button:focus-visible {
  outline: 2px solid var(--danger-text);
  outline-offset: 2px;
}

.auth-logout-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 0 0 2px var(--danger-soft);
}

.auth-logout-button:disabled {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
  opacity: .62;
  cursor: wait;
}

/* Non-desktop navigation stays in the document flow: tablets use a compact
   tab rail, while phones use five small cards per row. This keeps every
   destination discoverable without an off-canvas layer covering controls. */
.app-shell > .page-tabs {
  position: sticky;
  top: 80px;
  z-index: var(--z-sticky);
  inset-inline: 0;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: auto;
  scrollbar-width: none;
  border-block-end: 1px solid var(--sidebar-divider);
  background: var(--bg-header);
  color: var(--sidebar-text);
  padding: 7px clamp(10px, 2vw, 24px);
  box-shadow: var(--shadow-sm);
  scroll-behavior: smooth;
  transition: background-color var(--sidebar-rail-transition), border-color var(--sidebar-rail-transition), box-shadow var(--sidebar-rail-transition);
}

.app-shell > .page-tabs::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.app-shell > .page-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.app-shell > .page-tabs::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--sidebar-text-muted);
  opacity: .52;
  background: color-mix(in srgb, var(--sidebar-text-muted) 52%, transparent);
  background-clip: padding-box;
}

.app-shell > .page-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--sidebar-text-muted);
  opacity: 1;
  background-clip: padding-box;
}

.mobile-nav-header {
  display: none;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--sidebar-divider);
}

.mobile-nav-header strong {
  color: var(--sidebar-text);
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.mobile-nav-close {
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sidebar-divider);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sidebar-text-muted);
  padding: 0;
  touch-action: manipulation;
  transition: background-color var(--sidebar-item-transition), border-color var(--sidebar-item-transition), color var(--sidebar-item-transition), transform var(--sidebar-item-transition);
}

.mobile-nav-close:hover,
.mobile-nav-close:focus-visible {
  border-color: var(--primary-border);
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
  transform: translateY(-1px);
}

.mobile-nav-close .ui-icon {
  width: 20px;
  height: 20px;
}

.app-shell > .page-tabs > .page-tab,
.app-shell > .page-tabs > .smart-assistant-launcher {
  position: relative;
  isolation: isolate;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sidebar-text-muted);
  padding: 0 var(--space-3);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  text-align: start;
  touch-action: manipulation;
  white-space: nowrap;
  transition: background-color var(--sidebar-item-transition), border-color var(--sidebar-item-transition), color var(--sidebar-item-transition), box-shadow var(--sidebar-item-transition), transform var(--sidebar-item-transition);
}

.app-shell > .page-tabs > .page-tab::before,
.app-shell > .page-tabs > .smart-assistant-launcher::before {
  position: absolute;
  z-index: 0;
  inset-block: 9px;
  inset-inline-end: 4px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--sidebar-active-text);
  content: "";
  opacity: 0;
  transform: scaleY(.55);
  transition: opacity var(--sidebar-item-transition), transform var(--sidebar-item-transition);
}

.app-shell > .page-tabs > .page-tab:hover,
.app-shell > .page-tabs > .page-tab:focus-visible,
.app-shell > .page-tabs > .smart-assistant-launcher:hover,
.app-shell > .page-tabs > .smart-assistant-launcher:focus-visible {
  border-color: var(--sidebar-divider);
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
  transform: translateX(-2px);
}

.app-shell > .page-tabs > .smart-assistant-launcher {
  position: relative;
  inset: auto;
  z-index: 0;
  min-width: 0;
  height: auto;
  box-shadow: none;
}

.app-shell > .page-tabs > .page-tab.active,
.app-shell > .page-tabs > .page-tab[aria-selected="true"],
.app-shell > .page-tabs > .smart-assistant-launcher[aria-expanded="true"] {
  border-color: var(--primary-border);
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  box-shadow: var(--sidebar-active-shadow);
}

.app-shell > .page-tabs > .page-tab.active::before,
.app-shell > .page-tabs > .page-tab[aria-selected="true"]::before,
.app-shell > .page-tabs > .smart-assistant-launcher[aria-expanded="true"]::before {
  opacity: 1;
  transform: scaleY(1);
}

.app-shell > .page-tabs > .page-tab .ui-icon,
.app-shell > .page-tabs > .smart-assistant-launcher .ui-icon {
  box-sizing: border-box;
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: currentColor;
  padding: 6px;
  stroke-width: 1.9;
  transition: background-color var(--sidebar-item-transition), border-color var(--sidebar-item-transition), color var(--sidebar-item-transition), transform var(--sidebar-item-transition);
}

.app-shell > .page-tabs > .page-tab:hover .ui-icon,
.app-shell > .page-tabs > .page-tab:focus-visible .ui-icon,
.app-shell > .page-tabs > .smart-assistant-launcher:hover .ui-icon,
.app-shell > .page-tabs > .smart-assistant-launcher:focus-visible .ui-icon {
  border-color: var(--sidebar-divider);
  background: var(--sidebar-hover-bg);
  color: var(--primary-hover);
  transform: translateX(-1px);
}

.app-shell > .page-tabs > .page-tab.active .ui-icon,
.app-shell > .page-tabs > .page-tab[aria-selected="true"] .ui-icon,
.app-shell > .page-tabs > .smart-assistant-launcher[aria-expanded="true"] .ui-icon {
  border-color: var(--sidebar-divider);
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-active-text);
}

.app-shell > .page-tabs > .page-tab > span,
.smart-assistant-launcher-label,
.sidebar-brand-copy {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--sidebar-divider);
  transition: width var(--sidebar-rail-transition), padding var(--sidebar-rail-transition), gap var(--sidebar-rail-transition);
}

.sidebar-brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--brand-image-radius);
  background: transparent;
  color: var(--sidebar-text);
  transition: background-color var(--sidebar-item-transition), border-color var(--sidebar-item-transition), transform var(--sidebar-item-transition);
}

.sidebar-brand-mark img {
  width: 86%;
  height: 86%;
  object-fit: contain;
}

.sidebar-brand-mark > span {
  color: var(--sidebar-text);
  font-family: var(--font-latin);
  font-size: var(--font-lg);
  font-weight: var(--weight-extrabold);
}

.sidebar-brand-copy {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  transition: max-width var(--sidebar-label-transition), opacity var(--sidebar-label-transition), transform var(--sidebar-label-transition), visibility 0s linear var(--sidebar-label-transition);
}

.sidebar-brand-copy strong {
  color: var(--sidebar-text);
  font-size: var(--font-md);
  font-weight: var(--weight-extrabold);
}

.sidebar-brand-copy small {
  overflow: hidden;
  color: var(--sidebar-text-muted);
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-floating-tooltip {
  position: fixed;
  z-index: var(--z-toast);
  max-width: 220px;
  border: 1px solid var(--sidebar-divider);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  box-shadow: var(--shadow-sm);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  pointer-events: none;
  text-align: start;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-50%) translateX(4px);
  transition: opacity 160ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar-floating-tooltip.is-visible {
  opacity: 1;
  transform: translateY(-50%);
}

.sidebar-floating-tooltip[hidden] {
  display: none;
}

.mobile-nav-backdrop:not([hidden]) {
  position: fixed;
  z-index: calc(var(--z-dropdown) - 1);
  inset: 0;
  display: block;
  border: 0;
  background: var(--overlay);
  padding: 0;
}

/* Keep one continuous resource list ordered by daily usage. Visual section
   labels are intentionally removed; the order itself provides the hierarchy. */
.page-tabs > .sidebar-brand { order: -2; }
.page-tabs > .mobile-nav-header { order: -3; }
.page-tabs > [data-page-tab="dashboard"] { order: 1; }
.page-tabs > [data-page-tab="members"] { order: 2; }
.page-tabs > [data-page-tab="attendance"] { order: 3; }
.page-tabs > [data-page-tab="reports"] { order: 4; }
.page-tabs > [data-page-tab="branches"] { order: 5; }
.page-tabs > [data-page-tab="store"] { order: 6; }
.page-tabs > [data-page-tab="expenses"] { order: 7; }
.page-tabs > [data-page-tab="management"] { order: 8; }
.page-tabs > [data-page-tab="member-subscription-requests"] { order: 9; }
.page-tabs > [data-page-tab="library"] { order: 10; }
.page-tabs > [data-page-tab="trainees"] { order: 11; }
.page-tabs > [data-page-tab="intelligence"] { order: 12; }
.page-tabs > [data-page-tab="feedback"] { order: 13; }
.page-tabs > [data-page-tab="branding"] { order: 14; }
.page-tabs > [data-page-tab="member-payment-methods"] { order: 15; }
.page-tabs > [data-page-tab="portal-analytics"] { order: 16; }
.page-tabs > [data-page-tab="saas-billing"] { order: 17; }
.page-tabs > [data-page-tab="backup-history"] { order: 18; }
.page-tabs > [data-page-tab="permissions"] { order: 19; }
.page-tabs > .smart-assistant-launcher { order: 99; }

/* Desktop: a stable grid track means hover expands the workspace rather than
   placing a floating rail on top of buttons and form fields. */
@media (min-width: 1200px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
    grid-template-rows: 80px minmax(0, 1fr);
    transition: grid-template-columns var(--sidebar-rail-transition);
  }

  .app-shell.sidebar-expanded,
  .app-shell:has(> .page-tabs:focus-within) {
    grid-template-columns: var(--sidebar-width-expanded) minmax(0, 1fr);
  }

  .app-shell > .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .app-shell > .topbar .mobile-nav-toggle {
    display: none;
  }

  .app-shell > .page-tabs {
    position: sticky;
    inset-block: auto;
    inset-inline: auto;
    top: 80px;
    z-index: var(--z-content);
    grid-column: 1;
    grid-row: 2;
    display: flex;
    width: 100%;
    height: calc(100dvh - 80px);
    min-height: calc(100dvh - 80px);
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: var(--sidebar-text-muted) transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    border: 0;
    border-inline-end: 1px solid var(--sidebar-divider);
    border-radius: 0;
    box-shadow: none;
    padding: var(--space-4) var(--space-3) var(--space-5);
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition: background-color var(--sidebar-rail-transition), border-color var(--sidebar-rail-transition), box-shadow var(--sidebar-rail-transition);
  }

  .app-shell > .page-tabs::-webkit-scrollbar {
    width: 5px;
    height: auto;
  }

  .app-shell > .page-tabs > .mobile-nav-header {
    display: none;
  }

  .app-shell > .page-tabs > .page-tab,
  .app-shell > .page-tabs > .smart-assistant-launcher {
    width: 56px;
    min-width: 56px;
    min-height: 50px;
    align-self: center;
    justify-content: center;
    gap: 0;
    padding-inline: 0;
  }

  .app-shell > .page-tabs > .page-tab > span,
  .app-shell > .page-tabs > .smart-assistant-launcher-label,
  .app-shell > .page-tabs > .sidebar-brand > .sidebar-brand-copy {
    max-width: 0;
    max-inline-size: 0;
    opacity: 0;
    transform: translateX(-4px);
    visibility: hidden;
    transition: max-inline-size var(--sidebar-label-transition), opacity 140ms ease, transform var(--sidebar-label-transition), visibility 0s linear var(--sidebar-label-transition);
  }

  .app-shell > .page-tabs > .sidebar-brand {
    width: 56px;
    align-self: center;
    justify-content: center;
    gap: 0;
    margin-inline: 0;
    padding-inline: 0;
  }

  .app-shell > .page-tabs > .sidebar-brand-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .app-shell > .page-tabs.is-hovered > .page-tab,
  .app-shell > .page-tabs.is-hovered > .smart-assistant-launcher,
  .app-shell > .page-tabs:focus-within > .page-tab,
  .app-shell > .page-tabs:focus-within > .smart-assistant-launcher {
    width: 100%;
    min-width: 0;
    align-self: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    padding-inline: var(--space-3);
  }

  .app-shell > .page-tabs.is-hovered > .page-tab > span,
  .app-shell > .page-tabs.is-hovered > .smart-assistant-launcher-label,
  .app-shell > .page-tabs.is-hovered > .sidebar-brand > .sidebar-brand-copy,
  .app-shell > .page-tabs:focus-within > .page-tab > span,
  .app-shell > .page-tabs:focus-within > .smart-assistant-launcher-label,
  .app-shell > .page-tabs:focus-within > .sidebar-brand > .sidebar-brand-copy {
    max-width: 220px;
    max-inline-size: 220px;
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: max-inline-size var(--sidebar-label-transition), opacity 160ms ease 40ms, transform var(--sidebar-label-transition), visibility 0s;
  }

  .app-shell > .page-tabs.is-hovered > .sidebar-brand,
  .app-shell > .page-tabs:focus-within > .sidebar-brand,
  .app-shell > .page-tabs:focus-within > .sidebar-brand {
    width: auto;
    align-self: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    padding-inline: var(--space-2);
  }

  .app-shell > main.page {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 30px clamp(20px, 3vw, 48px) 56px;
  }
}

@media (max-width: 1199px) {
  .app-shell > .topbar .mobile-nav-toggle {
    display: none;
  }

  .app-shell > .page-tabs {
    align-items: stretch;
    gap: 6px;
    padding-block: 7px;
  }

  .app-shell > .page-tabs > .mobile-nav-header,
  .app-shell > .page-tabs > .sidebar-brand {
    display: none;
  }

  .app-shell > .page-tabs > .page-tab,
  .app-shell > .page-tabs > .smart-assistant-launcher {
    width: auto;
    min-width: max-content;
    min-height: 44px;
    flex: 0 0 auto;
    align-self: stretch;
    justify-content: center;
    gap: var(--space-2);
    padding-inline: 13px;
    border-radius: var(--radius-md);
    font-size: var(--font-xs);
    text-align: center;
    scroll-snap-align: start;
  }

  .app-shell > .page-tabs > .page-tab::before,
  .app-shell > .page-tabs > .smart-assistant-launcher::before {
    inset-block: auto 3px;
    inset-inline: 10px;
    width: auto;
    height: 2px;
    transform: scaleX(.55);
  }

  .app-shell > .page-tabs > .page-tab:hover,
  .app-shell > .page-tabs > .page-tab:focus-visible,
  .app-shell > .page-tabs > .smart-assistant-launcher:hover,
  .app-shell > .page-tabs > .smart-assistant-launcher:focus-visible {
    transform: translateY(-1px);
  }

  .app-shell > .page-tabs > .page-tab.active::before,
  .app-shell > .page-tabs > .page-tab[aria-selected="true"]::before,
  .app-shell > .page-tabs > .smart-assistant-launcher[aria-expanded="true"]::before {
    transform: scaleX(1);
  }

  .app-shell > .page-tabs > .page-tab > span,
  .app-shell > .page-tabs > .smart-assistant-launcher-label {
    max-width: 220px;
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  .app-shell > .page-tabs > .page-tab .ui-icon,
  .app-shell > .page-tabs > .smart-assistant-launcher .ui-icon {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
    padding: 4px;
  }

  .app-shell > .mobile-nav-backdrop:not([hidden]) {
    display: none;
  }

  .app-shell > .page-tabs > .sidebar-brand {
    order: -2;
  }

  .topbar-quick-actions .header-backup,
  .topbar-quick-actions .header-refresh {
    display: none;
  }

  .app-shell > main.page {
    width: min(1440px, calc(100% - 32px));
    margin-inline: auto;
  }
}

@media (max-width: 767px) {
  .app-shell > .page-tabs {
    top: 68px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: minmax(50px, auto);
    align-items: stretch;
    min-height: 0;
    gap: 4px;
    overflow: visible;
    overflow-x: visible;
    overflow-y: visible;
    padding-inline: 10px;
    padding-block: 6px;
  }

  .app-shell > .page-tabs > .page-tab,
  .app-shell > .page-tabs > .smart-assistant-launcher {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    height: auto;
    flex: 0 1 auto;
    align-self: stretch;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-color: var(--sidebar-divider);
    background: var(--sidebar-hover-bg);
    padding: 5px 2px;
    font-size: 0.66rem;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  .app-shell > .page-tabs > .page-tab::before,
  .app-shell > .page-tabs > .smart-assistant-launcher::before {
    inset-block: auto 3px;
    inset-inline: 8px;
    width: auto;
    height: 2px;
    transform: scaleX(.55);
  }

  .app-shell > .page-tabs > .page-tab > span,
  .app-shell > .page-tabs > .smart-assistant-launcher-label {
    display: -webkit-box;
    width: 100%;
    max-width: 100%;
    min-height: 2.2em;
    flex: 0 1 auto;
    align-content: center;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.12;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .app-shell > .page-tabs > .page-tab .ui-icon,
  .app-shell > .page-tabs > .smart-assistant-launcher .ui-icon {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
    padding: 2px;
  }

  .topbar-inner {
    width: calc(100% - 20px);
    min-height: 68px;
    gap: var(--space-2);
    padding-block: 10px;
  }

  .topbar-brand-area {
    gap: var(--space-2);
  }

  .topbar-brand-area .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: var(--radius-md);
  }

  .topbar-brand-mark .brand-logo-primary {
    display: none;
  }

  .topbar-brand-mark .brand-logo-compact {
    display: block;
  }

  .topbar-brand-area .brand-copy h1 {
    font-size: var(--font-md);
  }

  .topbar-brand-area .brand-copy p {
    display: none;
  }

  .topbar-controls {
    gap: 5px;
  }

  .topbar-quick-actions {
    gap: 5px;
  }

  .topbar-quick-actions .btn,
  .topbar-quick-actions .header-search,
  .topbar-quick-actions .header-notification,
  .topbar-theme-toggle,
  .kiosk-toggle-button,
  .mobile-nav-toggle,
  .auth-logout-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    justify-content: center;
    padding: 0;
  }

  .topbar-quick-actions .btn {
    max-width: 40px;
    overflow: hidden;
    font-size: 0;
    white-space: nowrap;
  }

  .topbar-quick-actions .header-search span,
  .topbar-quick-actions .header-notification span,
  .topbar-controls > .auth-account-bar .auth-account-identity,
  .auth-logout-button > span {
    display: none;
  }

  .topbar-theme-toggle .ui-icon,
  .kiosk-toggle-button .ui-icon,
  .mobile-nav-toggle .ui-icon,
  .auth-logout-button .ui-icon {
    width: 18px;
    height: 18px;
  }

  .app-shell > main.page {
    width: calc(100% - 20px);
  }
}

@media (max-width: 379px) {
  .app-shell > .page-tabs {
    padding-inline: 6px;
  }

  .topbar-inner {
    width: calc(100% - 12px);
  }

  .topbar-quick-actions .header-search,
  .topbar-quick-actions #topPricingButton {
    display: none;
  }

  .app-shell > main.page {
    width: calc(100% - 16px);
  }
}

/* Kiosk remains a presentation mode controlled by the existing JS. */
.app-shell.is-kiosk-mode {
  display: block;
  min-height: 100dvh;
}

.app-shell.is-kiosk-mode > .topbar,
.app-shell.is-kiosk-mode > .page-tabs,
.app-shell.is-kiosk-mode > .mobile-nav-backdrop {
  display: none;
}

.app-shell.is-kiosk-mode > main.page {
  width: min(1600px, calc(100% - 32px));
  max-width: none;
  margin-inline: auto;
}

.kiosk-exit-control {
  position: fixed;
  z-index: var(--z-sticky);
  inset-block-start: var(--space-4);
  inset-inline-start: var(--space-4);
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding-inline: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.kiosk-exit-control[hidden] {
  display: none;
}

/* Runtime branding changes the active item without introducing a second
   navigation stylesheet. */
html[data-brand-active-style="indicator"] .app-shell > .page-tabs > .page-tab.active {
  border-inline-end: 3px solid var(--primary);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
}

html[data-brand-active-style="pill"] .app-shell > .page-tabs > .page-tab.active {
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  .app-shell > .page-tabs {
    scroll-behavior: auto;
  }

  .app-shell,
  .app-shell > .page-tabs,
  .topbar-theme-toggle,
  .kiosk-toggle-button,
  .mobile-nav-toggle,
  .auth-logout-button,
  .app-shell > .page-tabs > .page-tab > span,
  .app-shell > .page-tabs > .page-tab,
  .app-shell > .page-tabs > .page-tab .ui-icon,
  .app-shell > .page-tabs > .smart-assistant-launcher,
  .app-shell > .page-tabs > .smart-assistant-launcher .ui-icon,
  .sidebar-brand,
  .sidebar-brand-mark,
  .smart-assistant-launcher-label,
  .sidebar-brand-copy,
  .sidebar-floating-tooltip {
    transition: none;
  }
}

/* Gym workspace v2 navigation: the topbar carries identity and actions,
   while the primary destinations live in a readable right-side rail. The
   existing #pageTabs and data-page-tab hooks remain unchanged. */
.workspace-contextbar {
  box-sizing: border-box;
  display: block;
  width: 100%;
  border-block-end: 1px solid var(--border-secondary);
  background: color-mix(in srgb, var(--bg-app) 92%, var(--primary-soft));
}

.workspace-contextbar[hidden] { display: none; }

.workspace-contextbar-inner {
  box-sizing: border-box;
  display: flex;
  width: min(100% - 48px, 1520px);
  min-height: 66px;
  align-items: center;
  justify-content: flex-start;
  margin-inline: auto;
  padding-block: 8px;
}

.workspace-contextbar .branch-context-shell {
  width: min(100%, 660px);
  max-width: 660px;
}

.topbar-quick-actions #topAddMemberButton {
  min-height: 42px;
  border-color: color-mix(in srgb, var(--primary) 70%, white 10%);
  box-shadow: 0 8px 18px rgb(23 105 232 / .22);
}

@media (min-width: 1200px) {
  .app-shell {
    grid-template-columns: minmax(252px, var(--sidebar-width-expanded)) minmax(0, 1fr);
    grid-template-rows: 80px auto minmax(0, 1fr);
  }

  .app-shell.sidebar-expanded,
  .app-shell:has(> .page-tabs:focus-within) {
    grid-template-columns: minmax(252px, var(--sidebar-width-expanded)) minmax(0, 1fr);
  }

  .app-shell > .topbar { grid-column: 1 / -1; grid-row: 1; }

  .app-shell > .workspace-contextbar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .app-shell > .page-tabs {
    top: 0;
    grid-column: 1;
    grid-row: 3;
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 80px - 66px);
    padding: 18px 14px 24px;
    border-inline-end: 1px solid var(--sidebar-divider);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
  }

  .app-shell > .page-tabs > .page-tab,
  .app-shell > .page-tabs > .smart-assistant-launcher {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    align-self: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    padding-inline: 12px;
  }

  .app-shell > .page-tabs > .page-tab > span,
  .app-shell > .page-tabs > .smart-assistant-launcher-label,
  .app-shell > .page-tabs > .sidebar-brand > .sidebar-brand-copy {
    max-width: 220px;
    max-inline-size: 220px;
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  .app-shell > .page-tabs > .sidebar-brand {
    width: auto;
    align-self: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    margin-inline: 0;
    padding-inline: 8px;
  }

  .app-shell > main.page {
    grid-column: 2;
    grid-row: 3;
    min-width: 0;
  }
}

@media (max-width: 1199px) {
  .workspace-contextbar-inner {
    width: min(100% - 32px, 1440px);
    min-height: 62px;
  }

  .workspace-contextbar .branch-context-shell {
    width: 100%;
    max-width: 660px;
  }
}

@media (max-width: 767px) {
  .workspace-contextbar-inner {
    width: calc(100% - 20px);
    min-height: 58px;
    padding-block: 6px;
  }

  .workspace-contextbar .branch-context-shell {
    height: auto;
    min-height: 46px;
  }
}

@media (max-width: 379px) {
  .workspace-contextbar-inner { width: calc(100% - 12px); }
}

/* Gym shell refinement: one full-height navigation rail, one compact context
   control in the top bar, and an information hierarchy that matches daily use. */
.workspace-contextbar { display: none !important; }

.topbar-controls {
  flex-wrap: nowrap;
  align-items: center;
}

.topbar-controls > .branch-context-shell {
  order: -2;
  width: auto;
  max-width: 430px;
  height: 44px;
  min-height: 44px;
  padding: 3px 5px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgb(2 6 23 / .12), inset 0 1px 0 rgb(255 255 255 / .06);
}

.topbar-controls > .branch-context-shell .branch-context-kicker {
  min-width: 92px;
  gap: 6px;
  padding-inline: 4px 6px;
}

.topbar-controls > .branch-context-shell .branch-context-kicker-icon,
.topbar-controls > .branch-context-shell .branch-context-field-icon {
  width: 23px;
  height: 23px;
  flex-basis: 23px;
  border-radius: 7px;
}

.topbar-controls > .branch-context-shell .branch-context-kicker strong {
  font-size: 9px;
}

.topbar-controls > .branch-context-shell .branch-context-kicker small,
.topbar-controls > .branch-context-shell .branch-context-field-copy small {
  font-size: 8px;
}

.topbar-controls > .branch-context-shell .branch-context-field {
  min-width: 112px;
  gap: 6px;
  padding-inline: 6px;
  border-radius: 10px;
}

.topbar-controls > .branch-context-shell .branch-context-field-copy select {
  max-width: 102px;
  font-size: 11px;
}

.topbar-controls > .branch-context-shell .branch-context-status {
  min-height: 26px;
  gap: 5px;
  padding-inline: 7px;
  font-size: 8px;
}

.sidebar-section-label {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-block: 13px 3px;
  padding-inline: 10px;
  color: var(--sidebar-text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.4;
  opacity: .78;
}

.sidebar-section-label::after {
  display: block;
  width: 32px;
  height: 2px;
  margin-block-start: 5px;
  border-radius: 99px;
  background: var(--primary);
  content: '';
  opacity: .65;
}

@media (min-width: 1200px) {
  .app-shell {
    min-height: 100dvh;
    grid-template-rows: 80px minmax(0, 1fr);
  }

  .app-shell > .page-tabs {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 80px;
    height: calc(100dvh - 80px);
    min-height: calc(100dvh - 80px);
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 14px 24px;
    scrollbar-gutter: stable;
  }

  .app-shell > main.page {
    grid-column: 2;
    grid-row: 2;
    min-height: calc(100dvh - 80px);
  }

  .app-shell > .page-tabs > .sidebar-brand { order: -100; }
  .app-shell > .page-tabs > .mobile-nav-header { order: -99; }

  .app-shell > .page-tabs > [data-page-tab="dashboard"] { order: 1; }
  .app-shell > .page-tabs > [data-page-tab="members"] { order: 2; }
  .app-shell > .page-tabs > [data-page-tab="attendance"] { order: 3; }
  .app-shell > .page-tabs > [data-page-tab="reports"] { order: 4; }
  .app-shell > .page-tabs > [data-page-tab="branches"] { order: 5; }
  .app-shell > .page-tabs > [data-page-tab="store"] { order: 6; }
  .app-shell > .page-tabs > [data-page-tab="expenses"] { order: 7; }
  .app-shell > .page-tabs > [data-page-tab="management"] { order: 8; }
  .app-shell > .page-tabs > [data-page-tab="member-subscription-requests"] { order: 9; }
  .app-shell > .page-tabs > [data-page-tab="library"] { order: 10; }
  .app-shell > .page-tabs > [data-page-tab="trainees"] { order: 11; }
  .app-shell > .page-tabs > [data-page-tab="intelligence"] { order: 12; }
  .app-shell > .page-tabs > [data-page-tab="feedback"] { order: 13; }
  .app-shell > .page-tabs > [data-page-tab="branding"] { order: 14; }
  .app-shell > .page-tabs > [data-page-tab="member-payment-methods"] { order: 15; }
  .app-shell > .page-tabs > [data-page-tab="portal-analytics"] { order: 16; }
  .app-shell > .page-tabs > [data-page-tab="saas-billing"] { order: 17; }
  .app-shell > .page-tabs > [data-page-tab="backup-history"] { order: 18; }
  .app-shell > .page-tabs > [data-page-tab="permissions"] { order: 19; }
  .app-shell > .page-tabs > .smart-assistant-launcher { order: 99; }

  .app-shell > .page-tabs > .page-tab,
  .app-shell > .page-tabs > .smart-assistant-launcher {
    min-height: 46px;
    border-radius: 12px;
  }
}

@media (max-width: 1199px) {
  .topbar-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .topbar-controls > .branch-context-shell {
    order: -2;
    max-width: min(100%, 420px);
  }

  .sidebar-section-label { display: none; }
}

@media (max-width: 767px) {
  .topbar-controls > .branch-context-shell {
    max-width: 100%;
    height: 42px;
    min-height: 42px;
  }

  .topbar-controls > .branch-context-shell .branch-context-kicker {
    min-width: auto;
  }

  .topbar-controls > .branch-context-shell .branch-context-kicker small,
  .topbar-controls > .branch-context-shell .branch-context-field-icon {
    display: none;
  }

  .topbar-controls > .branch-context-shell .branch-context-field {
    min-width: 0;
    flex: 1 1 0;
  }

  .topbar-controls > .branch-context-shell .branch-context-field-copy select {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .topbar-controls > .branch-context-shell {
    width: 100%;
    border-radius: 10px;
  }
}

/* Final desktop rail behavior: the sidebar owns the full viewport height,
   stays compact by default, and expands only while hovered/focused or when
   the user explicitly pins it. The topbar and workspace keep their own
   column, so the rail never overlays application content. */
@media (min-width: 1200px) {
  .app-shell {
    display: grid;
    min-height: 100dvh;
    grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
    grid-template-rows: minmax(80px, auto) minmax(0, 1fr);
    transition: grid-template-columns var(--sidebar-rail-transition);
  }

  .app-shell.sidebar-expanded,
  .app-shell:has(> .page-tabs.is-hovered),
  .app-shell:has(> .page-tabs:focus-within),
  .app-shell:has(> .page-tabs.sidebar-pinned) {
    grid-template-columns: var(--sidebar-width-expanded) minmax(0, 1fr);
  }

  .app-shell > .topbar {
    grid-column: 2;
    grid-row: 1;
  }

  .app-shell > .topbar .mobile-nav-toggle {
    display: none;
  }

  .app-shell > .page-tabs {
    position: sticky;
    top: 0;
    z-index: var(--z-content);
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: none;
    align-self: start;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: var(--sidebar-text-muted) transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    border: 0;
    border-inline-end: 1px solid var(--sidebar-divider);
    border-radius: 0;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
    box-shadow: 10px 0 34px rgb(2 6 23 / .13);
    padding: 20px var(--space-3) 24px;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition: background-color var(--sidebar-rail-transition), border-color var(--sidebar-rail-transition), box-shadow var(--sidebar-rail-transition);
  }

  .app-shell > .page-tabs > .mobile-nav-header {
    display: none;
  }

  .app-shell > .page-tabs > .sidebar-brand {
    order: -2;
    width: 56px;
    min-width: 56px;
    align-self: center;
    justify-content: center;
    gap: 0;
    margin-inline: 0;
    padding-inline: 0;
  }

  .app-shell > .page-tabs > .sidebar-pin-toggle {
    order: -1;
    width: 56px;
    min-width: 56px;
    min-height: 42px;
    align-self: center;
    justify-content: center;
    gap: 0;
    padding-inline: 0;
  }

  .app-shell > .page-tabs > .page-tab,
  .app-shell > .page-tabs > .smart-assistant-launcher {
    width: 56px;
    min-width: 56px;
    min-height: 50px;
    align-self: center;
    justify-content: center;
    gap: 0;
    padding-inline: 0;
  }

  .app-shell > .page-tabs > .page-tab > span,
  .app-shell > .page-tabs > .smart-assistant-launcher-label,
  .app-shell > .page-tabs > .sidebar-brand > .sidebar-brand-copy,
  .app-shell > .page-tabs > .sidebar-pin-toggle > span {
    max-width: 0;
    max-inline-size: 0;
    opacity: 0;
    transform: translateX(-4px);
    visibility: hidden;
    transition: max-inline-size var(--sidebar-label-transition), opacity 140ms ease, transform var(--sidebar-label-transition), visibility 0s linear var(--sidebar-label-transition);
  }

  .app-shell > .page-tabs.is-hovered > .page-tab,
  .app-shell > .page-tabs.is-hovered > .smart-assistant-launcher,
  .app-shell > .page-tabs.is-hovered > .sidebar-pin-toggle,
  .app-shell > .page-tabs.sidebar-pinned > .page-tab,
  .app-shell > .page-tabs.sidebar-pinned > .smart-assistant-launcher,
  .app-shell > .page-tabs.sidebar-pinned > .sidebar-pin-toggle,
  .app-shell > .page-tabs:focus-within > .page-tab,
  .app-shell > .page-tabs:focus-within > .smart-assistant-launcher,
  .app-shell > .page-tabs:focus-within > .sidebar-pin-toggle {
    width: 100%;
    min-width: 0;
    align-self: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    padding-inline: var(--space-3);
  }

  .app-shell > .page-tabs.is-hovered > .page-tab > span,
  .app-shell > .page-tabs.is-hovered > .smart-assistant-launcher-label,
  .app-shell > .page-tabs.is-hovered > .sidebar-brand > .sidebar-brand-copy,
  .app-shell > .page-tabs.is-hovered > .sidebar-pin-toggle > span,
  .app-shell > .page-tabs.sidebar-pinned > .page-tab > span,
  .app-shell > .page-tabs.sidebar-pinned > .smart-assistant-launcher-label,
  .app-shell > .page-tabs.sidebar-pinned > .sidebar-brand > .sidebar-brand-copy,
  .app-shell > .page-tabs.sidebar-pinned > .sidebar-pin-toggle > span,
  .app-shell > .page-tabs:focus-within > .page-tab > span,
  .app-shell > .page-tabs:focus-within > .smart-assistant-launcher-label,
  .app-shell > .page-tabs:focus-within > .sidebar-brand > .sidebar-brand-copy,
  .app-shell > .page-tabs:focus-within > .sidebar-pin-toggle > span {
    max-width: 220px;
    max-inline-size: 220px;
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: max-inline-size var(--sidebar-label-transition), opacity 160ms ease 40ms, transform var(--sidebar-label-transition), visibility 0s;
  }

  .app-shell > .page-tabs.is-hovered > .sidebar-brand,
  .app-shell > .page-tabs.sidebar-pinned > .sidebar-brand,
  .app-shell > .page-tabs:focus-within > .sidebar-brand {
    width: auto;
    min-width: 0;
    align-self: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    padding-inline: var(--space-2);
  }

  .app-shell > .page-tabs > .sidebar-pin-toggle {
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    transition: width var(--sidebar-rail-transition), min-width var(--sidebar-rail-transition), background-color var(--sidebar-item-transition), border-color var(--sidebar-item-transition), color var(--sidebar-item-transition), gap var(--sidebar-item-transition), padding var(--sidebar-rail-transition);
  }

  .app-shell > .page-tabs > .sidebar-pin-toggle:hover,
  .app-shell > .page-tabs > .sidebar-pin-toggle:focus-visible,
  .app-shell > .page-tabs > .sidebar-pin-toggle[aria-pressed="true"] {
    border-color: var(--sidebar-divider);
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-active-text);
    outline: none;
  }

  .app-shell > .page-tabs > .sidebar-pin-toggle .ui-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    padding: 5px;
  }

  .app-shell > .topbar .topbar-brand-area {
    display: none;
  }

  .app-shell > .topbar .topbar-inner {
    width: min(100% - 40px, 1800px);
    max-width: none;
  }

  .app-shell > main.page {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: calc(100dvh - 80px);
    margin: 0;
    padding: 30px clamp(20px, 3vw, 48px) 56px;
  }
}

@media (max-width: 1199px) {
  .sidebar-pin-toggle { display: none; }
}

/* END TOP GYM layer */

/* Canonical visual layer: explicit component ownership keeps the legacy
   selectors as compatibility fallbacks while this system owns the rendered
   hierarchy, density and states. */

/* TOP GYM layer: public/css/components/visual-redesign.css */
/*
 * Logic Fit Visual Redesign
 * -------------------------
 * Vanilla translation of the HeroUI patterns researched through the live MCP:
 * semantic variants, composed surfaces, restrained elevation, strong focus,
 * and predictable loading/empty/error states.  This file is the final screen
 * layer in main.source.css.  It intentionally uses explicit body-scoped
 * selectors so old utility/page rules remain available as fallbacks without
 * winning the computed UI styles.
 */

/* Page canvas and typography ------------------------------------------------ */
body.gym-page-bg,
body.gym-page-bg.font-sans,
body.gym-page-bg.text-slate-900 {
  background: var(--rf-page);
  color: var(--rf-ink);
}

body.gym-page-bg::selection {
  background: var(--rf-accent);
  color: #fff;
}

body .app-shell {
  background: var(--rf-page);
  color: var(--rf-ink);
}

body .app-shell > main.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(20px, 3vw, 42px) clamp(16px, 3.2vw, 52px) 64px;
}

body .page > .workspace,
body .page > .content-grid,
body .page > .dashboard-section,
body .page > .section-stack {
  gap: 22px;
}

body .page-header h2,
body .section-heading h2,
body .section-heading h3,
body .page-title,
body .members-panel h3,
body .panel-header h3 {
  color: var(--rf-ink);
  letter-spacing: -.025em;
}

body .page-header h2,
body .section-heading h2 {
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
  font-weight: 800;
  line-height: 1.25;
}

body .page-header p,
body .section-heading p,
body .panel-header p,
body .card-header p {
  color: var(--rf-muted);
  line-height: 1.75;
}

/* Header and navigation ---------------------------------------------------- */
body .app-shell > .topbar {
  border-bottom: 1px solid rgb(255 255 255 / .08);
  background: linear-gradient(112deg, #071326 0%, #0c1b32 62%, #102a4b 100%);
  box-shadow: 0 8px 26px rgb(7 19 38 / .18);
}

body .topbar-inner {
  min-height: 76px;
  width: min(100% - 36px, 1540px);
  padding-block: 12px;
}

body .topbar-brand-area .brand-mark {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
  border: 1px solid rgb(255 255 255 / .14);
  border-radius: 14px;
  background: linear-gradient(145deg, rgb(92 168 255 / .2), rgb(18 169 154 / .14));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .04), 0 8px 20px rgb(0 0 0 / .18);
}

body .topbar-brand-area .brand-copy h1 {
  font-size: 1rem;
  letter-spacing: -.01em;
}

body .topbar-brand-area .brand-copy p {
  color: #9eb1c9;
  font-size: .7rem;
}

body .topbar-quick-actions .header-search,
body .topbar-quick-actions .header-notification,
body .topbar-quick-actions .header-backup,
body .topbar-quick-actions .header-refresh,
body .topbar-theme-toggle,
body .kiosk-toggle-button,
body .mobile-nav-toggle {
  border-color: rgb(255 255 255 / .14);
  border-radius: 12px;
  background: rgb(255 255 255 / .07);
  color: #d6e3f4;
}

body .topbar-quick-actions .header-search:hover,
body .topbar-quick-actions .header-search:focus-visible,
body .topbar-quick-actions .header-notification:hover,
body .topbar-quick-actions .header-notification:focus-visible,
body .topbar-quick-actions .header-backup:hover,
body .topbar-quick-actions .header-backup:focus-visible,
body .topbar-quick-actions .header-refresh:hover,
body .topbar-quick-actions .header-refresh:focus-visible,
body .topbar-theme-toggle:hover,
body .topbar-theme-toggle:focus-visible,
body .kiosk-toggle-button:hover,
body .kiosk-toggle-button:focus-visible,
body .mobile-nav-toggle:hover,
body .mobile-nav-toggle:focus-visible {
  border-color: rgb(92 168 255 / .58);
  background: rgb(92 168 255 / .16);
  color: #fff;
  transform: translateY(-1px);
}

body .auth-account-avatar {
  border-color: rgb(92 168 255 / .55);
  background: rgb(92 168 255 / .16);
  color: #ddecff;
}

body .app-shell > .page-tabs {
  background: linear-gradient(180deg, #0b1a2f 0%, #071326 100%);
  border-inline-end-color: rgb(255 255 255 / .08);
  border-block-end-color: rgb(255 255 255 / .08);
  box-shadow: 10px 0 30px rgb(7 19 38 / .08);
}

body .app-shell > .page-tabs > .page-tab,
body .app-shell > .page-tabs > .smart-assistant-launcher {
  min-height: 48px;
  border-color: transparent;
  border-radius: 13px;
  color: #9eb1c9;
  font-weight: 700;
}

body .app-shell > .page-tabs > .page-tab::before,
body .app-shell > .page-tabs > .smart-assistant-launcher::before {
  width: 4px;
  border-radius: 999px;
  background: #63b2ff;
}

body .app-shell > .page-tabs > .page-tab:hover,
body .app-shell > .page-tabs > .page-tab:focus-visible,
body .app-shell > .page-tabs > .smart-assistant-launcher:hover,
body .app-shell > .page-tabs > .smart-assistant-launcher:focus-visible {
  border-color: rgb(92 168 255 / .18);
  background: rgb(92 168 255 / .1);
  color: #f7fbff;
  transform: translateX(-3px);
}

body .app-shell > .page-tabs > .page-tab.active,
body .app-shell > .page-tabs > .page-tab[aria-selected="true"],
body .app-shell > .page-tabs > .smart-assistant-launcher[aria-expanded="true"] {
  border-color: rgb(92 168 255 / .34);
  background: linear-gradient(90deg, rgb(25 118 243 / .2), rgb(92 168 255 / .09));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .03), 0 8px 18px rgb(0 0 0 / .12);
}

body .app-shell > .page-tabs > .page-tab .ui-icon,
body .app-shell > .page-tabs > .smart-assistant-launcher .ui-icon {
  border: 0;
  border-radius: 10px;
  background: rgb(255 255 255 / .055);
}

body .app-shell > .page-tabs > .page-tab.active .ui-icon,
body .app-shell > .page-tabs > .page-tab[aria-selected="true"] .ui-icon,
body .app-shell > .page-tabs > .smart-assistant-launcher[aria-expanded="true"] .ui-icon {
  background: rgb(92 168 255 / .2);
  color: #74bcff;
}

body .sidebar-brand {
  border-bottom-color: rgb(255 255 255 / .11);
}

/* HeroUI-style primitive components --------------------------------------- */
body .btn,
body button.btn,
body a.btn,
body .platform-btn,
body .platform-link-btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--rf-radius-control);
  box-shadow: none;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: -.005em;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

body .btn:hover:not(:disabled),
body .platform-btn:hover:not(:disabled),
body .platform-link-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

body .btn:active:not(:disabled),
body .platform-btn:active:not(:disabled) {
  transform: translateY(0);
}

body .btn-primary,
body .btn.btn-primary,
body .platform-btn.primary {
  border-color: var(--rf-accent);
  background: var(--rf-accent);
  color: #fff;
  box-shadow: 0 7px 16px rgb(25 118 243 / .2);
}

body .btn-primary:hover:not(:disabled),
body .btn.btn-primary:hover:not(:disabled),
body .platform-btn.primary:hover:not(:disabled) {
  border-color: var(--rf-accent-strong);
  background: var(--rf-accent-strong);
  box-shadow: 0 10px 22px rgb(25 118 243 / .26);
}

body .btn-secondary,
body .btn-light,
body .btn.btn-light,
body .platform-btn.ghost {
  border-color: var(--rf-line);
  background: var(--rf-surface);
  color: var(--rf-ink-soft);
}

body .btn-secondary:hover:not(:disabled),
body .btn-light:hover:not(:disabled),
body .btn.btn-light:hover:not(:disabled),
body .platform-btn.ghost:hover:not(:disabled) {
  border-color: var(--rf-accent);
  background: var(--rf-accent-soft);
  color: var(--rf-accent-strong);
}

body .btn-ghost,
body .btn-link,
body .platform-link-btn {
  border-color: transparent;
  background: transparent;
  color: var(--rf-accent-strong);
}

body .btn-danger,
body .platform-btn.danger {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

body .btn-danger:hover:not(:disabled),
body .platform-btn.danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

body .btn:focus-visible,
body button:focus-visible,
body a.btn:focus-visible,
body input:focus-visible,
body select:focus-visible,
body textarea:focus-visible,
body .platform-btn:focus-visible {
  outline: 2px solid var(--rf-accent);
  outline-offset: 3px;
  box-shadow: var(--rf-shadow-focus);
}

body .btn:disabled,
body .platform-btn:disabled,
body .btn[aria-disabled="true"],
body .platform-btn[aria-disabled="true"] {
  opacity: .52;
  cursor: not-allowed;
  transform: none;
}

body .btn-small,
body .btn-sm {
  min-height: 36px;
  border-radius: 9px;
  padding-inline: 12px;
  font-size: .72rem;
}

/* Surfaces/cards ----------------------------------------------------------- */
body .panel,
body .card,
body .content-card,
body .shadow-panel,
body .stat-card,
body .management-card,
body .library-card,
body .finance-card,
body .attendance-card,
body .portal-tool-card,
body .store-card,
body .branches-card,
body .saas-panel,
body .platform-card,
body .platform-kpi {
  border: 1px solid var(--rf-line);
  border-radius: var(--rf-radius-card);
  background: var(--rf-surface);
  box-shadow: var(--rf-shadow-sm);
}

body .panel,
body .content-card,
body .shadow-panel,
body .branches-card,
body .store-card,
body .saas-panel {
  padding: clamp(16px, 2vw, 24px);
}

body .panel:hover,
body .card:hover,
body .content-card:hover,
body .stat-card:hover,
body .management-card:hover,
body .store-card:hover,
body .branches-card:hover,
body .saas-panel:hover {
  border-color: color-mix(in srgb, var(--rf-accent) 33%, var(--rf-line));
  box-shadow: var(--rf-shadow-md);
}

body .panel-header,
body .card-header,
body .section-heading,
body .store-card-header,
body .branches-card-header,
body .saas-panel-head,
body .platform-page-head {
  min-height: 44px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--rf-line-soft);
  background: transparent;
  padding: 0 0 15px;
}

body .panel-header > div,
body .card-header > div,
body .section-heading > div,
body .store-card-header > div,
body .branches-card-header > div,
body .saas-panel-head > div {
  min-width: 0;
}

body .stat-card,
body .platform-kpi {
  position: relative;
  min-height: 126px;
  overflow: hidden;
  padding: 18px;
}

body .stat-card::before,
body .platform-kpi::before {
  position: absolute;
  inset-inline: 18px;
  top: 0;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: var(--rf-accent);
  content: "";
}

body .stat-label,
body .platform-kpi-label {
  color: var(--rf-muted);
  font-size: .72rem;
  font-weight: 800;
}

body .stat-value,
body .platform-kpi-value {
  color: var(--rf-ink);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -.04em;
}

/* Inputs/forms ------------------------------------------------------------- */
body .form-field,
body .field,
body .auth-field,
body .branches-form label,
body .store-form-grid label,
body .platform-field {
  gap: 7px;
  color: var(--rf-ink-soft);
  font-size: .77rem;
  font-weight: 800;
}

body input:not([type="checkbox"]):not([type="radio"]),
body select,
body textarea,
body .members-search-field,
body .store-search-field,
body .platform-global-search,
body .platform-search-field {
  min-height: 44px;
  border: 1px solid var(--rf-line);
  border-radius: var(--rf-radius-control);
  background: var(--rf-surface-raised);
  color: var(--rf-ink);
  box-shadow: inset 0 1px 1px rgb(11 23 41 / .025);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

body input:not([type="checkbox"]):not([type="radio"]):hover:not(:disabled),
body select:hover:not(:disabled),
body textarea:hover:not(:disabled),
body .members-search-field:hover,
body .store-search-field:hover {
  border-color: color-mix(in srgb, var(--rf-accent) 45%, var(--rf-line));
}

body input:not([type="checkbox"]):not([type="radio"]):focus,
body select:focus,
body textarea:focus,
body .members-search-field:focus-within,
body .store-search-field:focus-within,
body .platform-global-search:focus-within,
body .platform-search-field:focus-within {
  border-color: var(--rf-accent);
  background: var(--rf-surface-raised);
  box-shadow: var(--rf-shadow-focus);
  outline: 0;
}

body input::placeholder,
body textarea::placeholder {
  color: var(--rf-muted);
  opacity: .8;
}

body .form-error,
body .field-error,
body .auth-message,
body .platform-form-message {
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger-text);
  line-height: 1.65;
}

body .form-help,
body .helper-text,
body .auth-helper,
body .field-hint {
  color: var(--rf-muted);
  font-size: .7rem;
  line-height: 1.65;
}

/* Tables, tabs and statuses ------------------------------------------------ */
body .table-container,
body .table-panel,
body .members-panel,
body .store-table-wrap,
body .saas-table-wrap,
body .platform-table-wrap,
body .auth-users-table-wrap,
body .attendance-table-wrap,
body .member-requests-table-wrap {
  border: 1px solid var(--rf-line);
  border-radius: 14px;
  background: var(--rf-surface);
  box-shadow: none;
}

body table {
  color: var(--rf-ink-soft);
}

body table thead,
body table th {
  background: var(--rf-surface-soft);
  color: var(--rf-muted);
}

body table th {
  min-height: 44px;
  border-bottom: 1px solid var(--rf-line);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .01em;
}

body table td {
  border-bottom-color: var(--rf-line-soft);
  color: var(--rf-ink-soft);
  font-size: .76rem;
}

body table tbody tr {
  transition: background-color 140ms ease;
}

body table tbody tr:hover {
  background: var(--rf-accent-soft);
}

body .tab-button,
body .library-type-tabs button,
body .store-tab,
body [role="tab"] {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--rf-muted);
  font-weight: 800;
}

body .tab-button:hover,
body .library-type-tabs button:hover,
body .store-tab:hover,
body [role="tab"]:hover {
  background: var(--rf-accent-soft);
  color: var(--rf-accent-strong);
}

body .tab-button.active,
body .tab-button[aria-selected="true"],
body .library-type-tabs button.active,
body .store-tab.active,
body [role="tab"][aria-selected="true"] {
  border-color: color-mix(in srgb, var(--rf-accent) 22%, var(--rf-line));
  background: var(--rf-accent-soft);
  color: var(--rf-accent-strong);
  box-shadow: inset 0 -2px 0 var(--rf-accent);
}

body .badge,
body .chip,
body .status-badge,
body .branch-status,
body .saas-status-pill,
body .saas-panel-badge,
body .platform-branch-usage {
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
}

/* Dashboard: the command centre should read as a deliberate hero, not a
   generic collection of cards. */
body .dashboard-hero {
  min-height: 248px;
  overflow: hidden;
  border: 1px solid rgb(92 168 255 / .28);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 12%, rgb(92 168 255 / .18), transparent 34%),
    linear-gradient(118deg, #0a1730 0%, #10294c 58%, #0f6b72 155%);
  box-shadow: 0 18px 42px rgb(10 23 48 / .18);
}

body .dashboard-hero-heading h2,
body .dashboard-hero-heading h2 strong,
body .dashboard-hero-eyebrow,
body .dashboard-hero-action-copy span {
  color: #fff;
}

body .dashboard-hero-heading-copy p,
body .dashboard-hero-heading-copy .dashboard-hero-meta,
body .dashboard-hero-meta,
body .dashboard-hero-action-copy small {
  color: #b6c9e1;
}

body .dashboard-hero-actions {
  border-inline-start-color: rgb(255 255 255 / .13);
  background: rgb(0 0 0 / .12);
}

body .dashboard-hero-actions .btn-light {
  border-color: rgb(255 255 255 / .18);
  background: rgb(255 255 255 / .1);
  color: #f1f7ff;
}

body .dashboard-hero-actions .btn-light:hover:not(:disabled) {
  border-color: rgb(255 255 255 / .42);
  background: rgb(255 255 255 / .18);
  color: #fff;
}

body .dashboard-hero-actions .btn-primary {
  border-color: #67b2ff;
  background: #348cf4;
}

body .dashboard-live-status {
  border-color: rgb(66 211 197 / .25);
  background: rgb(66 211 197 / .12);
  color: #8ef0e3;
}

/* Reference screens -------------------------------------------------------- */
body .saas-entry-card {
  width: min(1220px, 100%);
  border: 1px solid rgb(255 255 255 / .16);
  border-radius: 28px;
  background: linear-gradient(145deg, rgb(10 23 48 / .97), rgb(14 40 72 / .96));
  box-shadow: 0 26px 80px rgb(5 17 36 / .32);
}

body .auth-screen {
  background:
    radial-gradient(circle at 78% 15%, rgb(25 118 243 / .18), transparent 30%),
    radial-gradient(circle at 10% 90%, rgb(18 169 154 / .14), transparent 34%),
    #eef3f8;
}

html[data-theme="dark"] body .auth-screen,
body[data-theme="dark"] .auth-screen {
  background:
    radial-gradient(circle at 78% 15%, rgb(92 168 255 / .14), transparent 30%),
    #070c15;
}

body .saas-entry-brand,
body .saas-entry-copy,
body .saas-entry-action,
body .saas-entry-feature-icon,
body .saas-entry-features article {
  color: #eef7ff;
}

body .saas-entry-layout {
  gap: clamp(24px, 4vw, 58px);
  padding: clamp(24px, 4vw, 52px);
}

body .saas-entry-copy h1 {
  font-size: clamp(2.15rem, 5vw, 4.6rem);
  letter-spacing: -.055em;
  line-height: 1.08;
}

body .saas-entry-copy h1 span {
  color: #70b6ff;
}

body .saas-entry-copy p,
body .saas-entry-action p,
body .saas-entry-features small {
  color: #b0c4dd;
  line-height: 1.85;
}

body .saas-entry-action {
  border-color: rgb(112 182 255 / .27);
  border-radius: 18px;
  background: linear-gradient(145deg, rgb(255 255 255 / .1), rgb(255 255 255 / .04));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .07);
}

body .saas-entry-continue {
  min-height: 52px;
  border-color: #70b6ff;
  background: #2f86ef;
  box-shadow: 0 12px 24px rgb(25 118 243 / .28);
}

body .saas-entry-preview {
  border-color: rgb(112 182 255 / .25);
  border-radius: 20px;
  box-shadow: 0 20px 44px rgb(0 0 0 / .2);
}

body .auth-card {
  width: min(100%, 480px);
  border: 1px solid var(--rf-line);
  border-radius: 22px;
  background: var(--rf-surface);
  box-shadow: 0 24px 70px rgb(11 23 41 / .2);
}

body .auth-form-panel {
  padding: clamp(24px, 5vw, 42px);
}

body .auth-form-heading {
  text-align: start;
}

body .auth-form-heading h2 {
  color: var(--rf-ink);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

body .auth-form:not(#loginForm) .auth-input-wrap > input:not([type="checkbox"]):not([type="radio"]),
body .auth-form:not(#loginForm) .auth-password-wrap > input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 50px;
  border-color: var(--rf-line);
  border-radius: var(--rf-radius-control);
  background: var(--rf-surface-raised);
}

/* The reference login control is a compact two-state switch. Keep the
   existing data-theme click contract while making both states visible. */
.auth-screen[data-auth-stage="login"] .auth-theme-toggle {
  position: absolute;
  width: 112px;
  min-height: 44px;
  justify-content: space-between;
  padding: 4px 11px;
  border-radius: 999px;
  overflow: hidden;
}
.auth-screen[data-auth-stage="login"] .auth-theme-toggle::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 48px;
  height: 36px;
  border-radius: 999px;
  background: var(--auth-blue);
  box-shadow: 0 6px 14px rgb(23 105 232 / .26);
  content: "";
  transition: left .18s ease, right .18s ease;
}
.auth-screen[data-auth-stage="login"] .auth-theme-toggle .theme-toggle-icon-dark,
.auth-screen[data-auth-stage="login"] .auth-theme-toggle .theme-toggle-icon-light {
  position: relative;
  z-index: 1;
  display: block !important;
  width: 19px;
  height: 19px;
}
html[data-theme="dark"] .auth-screen[data-auth-stage="login"] .auth-theme-toggle::before {
  left: 3px;
  right: auto;
}
html:not([data-theme="dark"]) .auth-screen[data-auth-stage="login"] .auth-theme-toggle::before {
  right: 3px;
  left: auto;
}

body .auth-submit {
  min-height: 50px;
  border-radius: var(--rf-radius-control);
}

body .branches-page {
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body .branches-page-header {
  margin-bottom: 20px;
  border: 1px solid rgb(92 168 255 / .25);
  border-radius: 22px;
  background: linear-gradient(118deg, #0a1730, #12345c 65%, #0f6b72);
  box-shadow: 0 16px 34px rgb(10 23 48 / .17);
}

body .branches-page-heading h2,
body .branches-page-heading p,
body .branches-page-kicker {
  color: #f7fbff;
}

body .branches-page-heading p {
  color: #b6c9e1;
}

body .branches-page-summary span {
  border-color: rgb(255 255 255 / .16);
  background: rgb(255 255 255 / .08);
}

body .branches-page-summary small {
  color: #b6c9e1;
}

body .branch-list-item {
  border-color: var(--rf-line);
  border-radius: 14px;
  background: var(--rf-surface-raised);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body .branch-list-item:hover {
  border-color: var(--rf-accent);
  box-shadow: var(--rf-shadow-sm);
  transform: translateY(-1px);
}

/* Platform Admin ----------------------------------------------------------- */
body .platform-shell {
  background: var(--rf-page);
}

body .platform-sidebar {
  background: linear-gradient(180deg, #08162a, #071326);
  border-left-color: rgb(255 255 255 / .09);
}

body .platform-nav-item {
  min-height: 46px;
  border-radius: 12px;
  color: #9eb1c9;
}

body .platform-nav-item:hover,
body .platform-nav-item:focus-visible {
  background: rgb(92 168 255 / .12);
  color: #fff;
}

body .platform-nav-item.active {
  border-color: rgb(92 168 255 / .34);
  background: linear-gradient(90deg, rgb(25 118 243 / .24), rgb(92 168 255 / .1));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .03), 0 8px 18px rgb(0 0 0 / .13);
}

body .platform-main,
body .platform-content {
  background: var(--rf-page);
}

body .platform-topbar {
  border-bottom-color: var(--rf-line);
  background: color-mix(in srgb, var(--rf-surface) 94%, transparent);
}

body .platform-card,
body .platform-kpi,
body .saas-page,
body .saas-panel {
  border-color: var(--rf-line);
  background: var(--rf-surface);
  box-shadow: var(--rf-shadow-sm);
}

body .platform-page-head h2,
body .saas-page-header h2,
body .saas-panel h4 {
  color: var(--rf-ink);
}

/* Dialog, dropdown and state surfaces ------------------------------------- */
body dialog,
body .modal,
body .modal-dialog,
body [role="dialog"],
body .platform-dialog {
  border: 1px solid var(--rf-line);
  border-radius: 20px;
  background: var(--rf-surface);
  color: var(--rf-ink);
  box-shadow: 0 24px 80px rgb(5 17 36 / .24);
}

body dialog::backdrop,
body .modal-backdrop {
  background: rgb(4 13 26 / .62);
  backdrop-filter: blur(5px);
}

body .dropdown-menu,
body .popover,
body [role="listbox"] {
  border: 1px solid var(--rf-line);
  border-radius: 13px;
  background: var(--rf-surface-raised);
  box-shadow: var(--rf-shadow-md);
}

body .loading,
body .empty,
body .no-data,
body .empty-state,
body .saas-empty {
  min-height: 84px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--rf-line);
  border-radius: 14px;
  background: var(--rf-surface-soft);
  color: var(--rf-muted);
}

body .error-state,
body .page-error,
body .registration-error,
body .portal-error {
  border: 1px solid var(--danger-border);
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger-text);
}

body .skeleton,
body .loading-skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--rf-surface-soft), var(--rf-line-soft), var(--rf-surface-soft));
  background-size: 200% 100%;
  animation: rf-skeleton 1.4s ease-in-out infinite;
}

@keyframes rf-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive: recompose rather than merely shrink ------------------------ */
@media (max-width: 1199px) {
  body .app-shell > main.page {
    padding-inline: clamp(14px, 3vw, 28px);
  }

  body .app-shell > .page-tabs {
    background: #0a192e;
  }
}

@media (max-width: 767px) {
  body .app-shell > main.page {
    padding: 16px 10px 40px;
  }

  body .app-shell > .page-tabs {
    gap: 5px;
    border-bottom-color: rgb(255 255 255 / .1);
    padding: 6px 8px;
  }

  body .app-shell > .page-tabs > .page-tab,
  body .app-shell > .page-tabs > .smart-assistant-launcher {
    min-height: 54px;
    border-radius: 12px;
    background: rgb(255 255 255 / .055);
  }

  body .topbar-inner {
    width: calc(100% - 16px);
    min-height: 68px;
  }

  body .topbar-brand-area .brand-copy h1 {
    font-size: .9rem;
  }

  body .panel,
  body .content-card,
  body .shadow-panel,
  body .branches-card,
  body .store-card,
  body .saas-panel {
    border-radius: 15px;
    padding: 15px;
  }

  body .panel-header,
  body .card-header,
  body .section-heading,
  body .store-card-header,
  body .branches-card-header,
  body .saas-panel-head,
  body .platform-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  body .panel-header .header-actions,
  body .store-card-header .header-actions,
  body .page-header .actions-row,
  body .platform-page-head > .platform-btn {
    width: 100%;
  }

  body .panel-header .header-actions .btn,
  body .store-card-header .header-actions .btn {
    flex: 1 1 auto;
  }

  body .form-grid,
  body .field-grid,
  body .two-column-grid,
  body .content-grid-two,
  body .dashboard-grid,
  body .branches-layout,
  body .saas-entry-layout {
    grid-template-columns: 1fr;
  }

  body .dashboard-hero {
    border-radius: 18px;
  }

  body .dashboard-hero-actions {
    border-top-color: rgb(255 255 255 / .13);
    border-inline-start: 0;
  }

  body .dashboard-hero-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  body .dashboard-hero-buttons .btn {
    width: 100%;
  }

  body .saas-entry-card {
    border-radius: 20px;
  }

  body .saas-entry-layout {
    padding: 18px;
  }

  body .saas-entry-preview {
    order: 2;
  }

  body .saas-entry-copy {
    order: 1;
  }

  body .saas-entry-copy h1 {
    font-size: clamp(2rem, 11vw, 3.2rem);
  }

  body .branches-page-header {
    border-radius: 18px;
  }

  body .branches-page-summary {
    width: 100%;
  }

  body .branches-page-summary span {
    min-width: 0;
    flex: 1;
  }

  body .branch-list-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  body .branch-list-actions {
    grid-column: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  body .table-container,
  body .table-panel,
  body .members-panel,
  body .store-table-wrap,
  body .saas-table-wrap,
  body .platform-table-wrap,
  body .auth-users-table-wrap,
  body .attendance-table-wrap,
  body .member-requests-table-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 420px) {
  body .topbar-brand-area .brand-copy {
    display: none;
  }

  body .topbar-brand-area .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  body .page-tabs > .page-tab > span,
  body .page-tabs > .smart-assistant-launcher-label {
    font-size: .62rem;
  }

  body .btn,
  body button.btn,
  body a.btn {
    min-height: 44px;
  }

  body .btn-small,
  body .btn-sm {
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body *,
  body *::before,
  body *::after {
    animation: none;
    scroll-behavior: auto;
    transition: none;
  }
}

/* Branch management: compact summary + full-width directory --------------- */
body .branches-page {
  width: 100%;
  max-width: none;
  padding: 0;
  display: grid;
  gap: 16px;
}

body .branches-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 0;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--rf-line);
  border-radius: 16px;
  background: var(--rf-surface);
  box-shadow: var(--rf-shadow-sm);
}

body .branches-page-heading {
  min-width: 0;
}

body .branches-page-heading h2 {
  margin: 4px 0 0;
  color: var(--rf-ink);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  letter-spacing: -.025em;
}

body .branches-page-heading p {
  max-width: 560px;
  margin: 5px 0 0;
  color: var(--rf-muted);
  font-size: .76rem;
  line-height: 1.55;
}

body .branches-page-kicker,
body .branches-card-kicker {
  color: var(--rf-accent);
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .12em;
}

body .branches-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}

body .branches-page-summary {
  display: flex;
  gap: 8px;
}

body .branches-page-summary span {
  display: grid;
  gap: 1px;
  min-width: 82px;
  padding: 8px 11px;
  border: 1px solid var(--rf-line);
  border-radius: 11px;
  background: var(--rf-surface-soft);
}

body .branches-page-summary strong {
  color: var(--rf-ink);
  font-size: 1.15rem;
  line-height: 1.15;
}

body .branches-page-summary small {
  color: var(--rf-muted);
  font-size: .62rem;
  font-weight: 700;
  white-space: nowrap;
}

body .branches-create-trigger {
  min-height: 44px;
  padding-inline: 16px;
  white-space: nowrap;
}

body .branches-create-trigger > span {
  margin-inline-end: 4px;
  font-size: 1.15em;
  font-weight: 500;
  line-height: 0;
}

body .branches-layout {
  display: block;
}

body .branches-list-card {
  width: 100%;
  min-width: 0;
  padding: 20px;
}

body .branches-list-card .branches-card-header {
  align-items: center;
  margin-bottom: 18px;
}

body .branches-list-card .branches-card-header h3 {
  color: var(--rf-ink);
  font-size: 1rem;
}

body .branches-list-card .branches-card-header p {
  color: var(--rf-muted);
  font-size: .75rem;
}

body .branches-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 14px;
  align-items: stretch;
}

body .branch-list-item {
  min-height: 168px;
  padding: 16px;
  border-color: var(--rf-line);
  border-radius: 15px;
  background: var(--rf-surface-raised);
  box-shadow: 0 4px 16px rgb(11 23 41 / .045);
}

body .branch-list-item:hover {
  border-color: color-mix(in srgb, var(--rf-accent) 48%, var(--rf-line));
  box-shadow: var(--rf-shadow-sm);
  transform: translateY(-2px);
}

body .branch-list-marker {
  width: 4px;
  min-height: 82px;
  border-radius: 999px;
  background: var(--rf-accent);
}

body .branch-list-copy {
  gap: 4px;
}

body .branch-list-copy strong {
  color: var(--rf-ink);
  font-size: .94rem;
  line-height: 1.35;
}

body .branch-list-copy span {
  color: var(--rf-accent-strong);
  font-size: .68rem;
  letter-spacing: .02em;
}

body .branch-list-copy small {
  color: var(--rf-muted);
  font-size: .72rem;
}

body .branch-list-actions {
  align-items: center;
  padding-top: 12px;
}

body .branch-list-actions .btn {
  min-height: 36px;
}

body .branch-create-dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: 680px;
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
}

body .branch-create-dialog .dialog-body {
  max-height: min(760px, calc(100dvh - 32px));
  overflow-y: auto;
  padding: 22px;
}

body .branch-create-dialog .details-dialog-head {
  margin-bottom: 20px;
}

body .branch-create-dialog .details-dialog-head h3,
body .branch-create-dialog .details-dialog-head p {
  margin: 0;
}

body .branch-create-dialog .details-dialog-head h3 {
  margin-top: 5px;
  color: var(--rf-ink);
}

body .branch-create-dialog .details-dialog-head p {
  margin-top: 5px;
  color: var(--rf-muted);
  font-size: .78rem;
  line-height: 1.55;
}

body .branch-create-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body .branch-create-fields label,
body .branch-create-options label {
  color: var(--rf-ink-soft);
}

body .branch-create-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

body .branch-create-dialog .branches-form-status {
  min-height: 22px;
  margin: 14px 0 0;
}

body .branch-create-dialog .dialog-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rf-line-soft);
}

@media (max-width: 900px) {
  body .branches-page-header {
    align-items: stretch;
    flex-direction: column;
  }

  body .branches-page-actions {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  body .branches-page-header,
  body .branches-list-card {
    padding: 15px;
    border-radius: 14px;
  }

  body .branches-page-actions,
  body .branches-page-summary {
    width: 100%;
  }

  body .branches-page-actions {
    align-items: stretch;
    flex-direction: column;
  }

  body .branches-page-summary span {
    flex: 1 1 0;
  }

  body .branches-create-trigger {
    width: 100%;
  }

  body .branches-list-card .branches-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  body .branches-list-card .branches-card-header .btn {
    width: 100%;
  }

  body .branches-list {
    grid-template-columns: 1fr;
  }

  body .branch-create-fields,
  body .branch-create-options {
    grid-template-columns: 1fr;
  }

  body .branch-create-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  body .branch-create-dialog .dialog-body {
    max-height: calc(100dvh - 20px);
    padding: 16px;
  }
}

/* END TOP GYM layer */


/* TOP GYM layer: public/css/print.css */
@media print {
  :root {
    --color-bg: #fff;
    --color-surface: #fff;
    --color-text: #111827;
    --color-text-muted: #4b5563;
    --border-color: #d1d5db;
  }

  html,
  body {
    min-width: 0;
    background: #fff !important;
    color: #111827 !important;
  }

  .auth-screen,
  .topbar,
  .page-tabs,
  .auth-account-bar,
  .header-actions,
  .top-actions,
  .page-header-actions,
  .dashboard-page-actions,
  .dashboard-hero,
  .btn,
  button,
  .modal-backdrop,
  dialog,
  .toast,
  .pagination,
  .members-pagination,
  .library-pagination {
    display: none !important;
  }

  .app-shell,
  .page,
  .panel,
  .report-card,
  .members-panel,
  .library-section,
  .attendance-section,
  .coaching-section,
  .reports-section {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .page {
    padding: 0 !important;
  }

  .panel,
  .report-card {
    padding: 12px !important;
  }

  .table-scroll,
  .table-wrap,
  .data-table-wrap,
  .reports-table-wrap,
  .pricing-table-scroll {
    overflow: visible !important;
  }

  table,
  .data-table,
  .reports-table {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 10pt;
  }

  th,
  td {
    padding: 6px 8px !important;
  }

  .overview-grid,
  .reports-grid,
  .reports-detail-grid,
  .two-column-grid,
  .three-column-grid {
    display: block !important;
  }

  .overview-grid > *,
  .reports-grid > *,
  .reports-detail-grid > * {
    margin-bottom: 16px;
    break-inside: avoid;
  }

  img {
    max-height: 180px;
    break-inside: avoid;
  }

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }
}

.print-only {
  display: none;
}

/* Standalone A4 document system. These rules are intentionally outside the
   print media query because html2pdf renders the document in the screen
   context before converting it to a PDF. */
:root {
  --print-brand-primary: #1769e8;
  --print-brand-primary-hover: #0f56c9;
  --print-brand-text: #172033;
  --print-brand-muted: #718096;
  --print-brand-border: #d9e2ef;
  --print-brand-surface: #f5f9ff;
  --print-brand-border-soft: #e7edf5;
}

@page {
  size: A4;
  margin: 12mm;
}

body > .print-sheet,
.print-sheet {
  box-sizing: border-box;
  width: 190mm;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  color: var(--print-brand-text);
  direction: rtl;
  font-family: "Cairo", "Noto Naskh Arabic", Tahoma, Arial, sans-serif;
  font-size: 10pt;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

.print-sheet *,
.print-sheet *::before,
.print-sheet *::after {
  box-sizing: border-box;
}

.print-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--print-brand-border);
  padding: 4px 0 14px;
}

.print-brand,
.print-member-hero,
.print-system-hero,
.print-section-title,
.print-footer,
.print-system-info,
.print-system-kpi,
.print-info-item,
.print-billing-item {
  min-width: 0;
}

.print-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.print-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.print-brand-copy {
  display: grid;
  gap: 1px;
}

.print-brand-title {
  margin: 0;
  color: var(--print-brand-primary);
  font-family: Arial, sans-serif;
  font-size: 24pt;
  font-weight: 800;
  letter-spacing: 1.5px;
  line-height: 1;
}

.print-brand-kicker,
.print-brand-subtitle,
.print-section-kicker {
  color: var(--print-brand-muted);
  font-size: 8pt;
  font-weight: 700;
}

.print-document-meta {
  display: grid;
  gap: 2px;
  color: var(--print-brand-muted);
  font-size: 8.5pt;
  text-align: left;
}

.print-document-meta strong {
  color: var(--print-brand-text);
  font-size: 12pt;
}

.print-accent {
  height: 4px;
  margin: 12px 0 16px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--print-brand-primary), var(--print-brand-primary-hover));
}

.print-section {
  margin: 0 0 15px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--print-brand-primary);
  padding-bottom: 5px;
}

.print-section-title h2,
.print-section-title h3,
.print-section h3 {
  margin: 1px 0 0;
  color: var(--print-brand-text);
  font-size: 13pt;
  font-weight: 800;
  line-height: 1.35;
}

.print-section h3 {
  margin-bottom: 7px;
  font-size: 10.5pt;
}

.print-member-hero,
.print-system-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--print-brand-border);
  border-radius: 10px;
  background: var(--print-brand-surface);
  padding: 12px;
}

.print-member-hero {
  justify-content: flex-start;
}

.print-member-avatar {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--print-brand-primary);
  color: #fff;
  font-family: Arial, sans-serif;
  font-weight: 800;
}

.print-member-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.print-member-copy h2,
.print-system-hero h2 {
  margin: 0;
  color: var(--print-brand-text);
  font-size: 14pt;
}

.print-member-copy p,
.print-system-hero p {
  margin: 0;
  color: var(--print-brand-muted);
  font-size: 9pt;
}

.print-system-hero-title {
  display: grid;
  gap: 2px;
  text-align: left;
}

.print-system-hero-title span {
  color: var(--print-brand-primary);
  font-size: 8.5pt;
  font-weight: 700;
}

.print-system-hero-title strong {
  color: var(--print-brand-text);
  font-size: 12pt;
}

.print-info-grid,
.print-billing-grid,
.print-system-kpi-grid,
.print-system-info-grid {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.print-info-grid,
.print-billing-grid,
.print-system-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.print-system-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.print-info-item,
.print-billing-item,
.print-system-kpi,
.print-system-info {
  display: grid;
  gap: 1px;
  border: 1px solid var(--print-brand-border-soft);
  border-radius: 7px;
  background: #fbfcfe;
  padding: 7px 9px;
}

.print-info-item span,
.print-billing-item span,
.print-system-kpi span,
.print-system-info span {
  color: var(--print-brand-muted);
  font-size: 8pt;
}

.print-info-item strong,
.print-billing-item strong,
.print-system-kpi strong,
.print-system-info strong {
  color: var(--print-brand-text);
  font-size: 9.5pt;
  font-variant-numeric: tabular-nums;
}

.print-system-kpi {
  border-color: var(--print-brand-border);
  background: var(--print-brand-surface);
  text-align: center;
}

.print-system-kpi strong {
  color: var(--print-brand-primary);
  font-size: 14pt;
}

.print-system-kpi small,
.print-table-sub,
.print-system-count {
  display: block;
  color: var(--print-brand-muted);
  font-size: 7.5pt;
}

.print-billing-item.remaining,
.print-receipt-amount {
  border-color: #f1c7c7;
  background: #fff5f5;
}

.print-billing-item.remaining strong,
.print-receipt-amount strong {
  color: #c53030;
}

.print-system-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.print-system-overview-grid > div {
  border: 1px solid var(--print-brand-border-soft);
  border-radius: 8px;
  padding: 9px;
}

.print-table-wrap {
  width: 100%;
  overflow: visible;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8.5pt;
}

.print-table th {
  border: 1px solid #17304f;
  background: #17304f;
  color: #fff;
  padding: 6px;
  font-weight: 700;
  text-align: center;
  direction: rtl;
  unicode-bidi: isolate;
}

.print-table td {
  border: 1px solid #d7e0eb;
  padding: 6px;
  color: #26364c;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: anywhere;
  direction: rtl;
  unicode-bidi: isolate;
}

.print-table [dir="ltr"] {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: center;
}

.print-table tbody tr:nth-child(even) td { background: #f8fafc; }
.print-table-main { display: block; color: var(--print-brand-text); font-weight: 700; }
.print-status { display: inline-flex; border-radius: 99px; padding: 2px 7px; font-size: 7.5pt; font-weight: 700; }
.print-status.active { background: #e8f8f1; color: #087f5b; }
.print-status.expiring_soon { background: #fff5df; color: #a15c00; }
.print-status.expired,
.print-status.cancelled { background: #fff0f0; color: #b42323; }
.print-status.frozen { background: #edf4ff; color: #1d4ed8; }

.print-system-total,
.print-system-callout,
.print-notes,
.print-receipt-amount {
  margin-top: 9px;
  border: 1px solid var(--print-brand-border);
  border-radius: 8px;
  background: var(--print-brand-surface);
  padding: 9px 11px;
}

.print-system-total { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.print-system-total strong { color: var(--print-brand-primary); font-size: 10pt; }
.print-notes { color: #475569; }
.print-notes strong,
.print-system-callout b { color: #17304f; }
.print-system-callout p { margin: 4px 0 0; }

.print-system-distribution { display: grid; gap: 6px; }
.print-system-bar { display: grid; gap: 3px; }
.print-system-bar > div { display: flex; justify-content: space-between; gap: 8px; font-size: 8pt; }
.print-system-bar i { display: block; height: 6px; overflow: hidden; border-radius: 99px; background: #e8eef7; }
.print-system-bar i em { display: block; width: 70%; height: 100%; border-radius: inherit; background: var(--print-brand-primary); }

.print-system-reference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.print-system-reference { border: 1px solid var(--print-brand-border-soft); border-radius: 8px; padding: 9px; break-inside: avoid; page-break-inside: avoid; }
.print-system-reference h3 { margin: 0; }
.print-system-reference-meta { color: var(--print-brand-muted); font-size: 7.5pt; }
.print-system-reference-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 7px; }
.print-system-reference-columns > div { color: #475569; font-size: 7.5pt; }
.print-system-reference-columns b { display: block; color: #17304f; margin-bottom: 2px; }
.print-system-list { margin: 0; padding: 0 14px 0 0; }
.print-system-list li { margin: 2px 0; }
.print-system-muted,
.print-empty { color: var(--print-brand-muted); font-size: 8.5pt; }

.print-exercise-cell { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.print-exercise-thumb { display: inline-block; width: 30px; height: 22px; object-fit: cover; border-radius: 4px; background: #edf2f7; vertical-align: middle; }
.print-exercise-fallback { color: var(--print-brand-primary); font-size: 14px; text-align: center; }
.print-exercise-gallery { display: flex; gap: 8px; margin: 7px 0; }
.print-exercise-gallery figure { margin: 0; text-align: center; }
.print-exercise-detail-image { width: 78px; height: 52px; object-fit: cover; border-radius: 5px; }
.print-exercise-gallery figcaption { color: var(--print-brand-muted); font-size: 7pt; }

.print-receipt-amount { display: grid; gap: 2px; text-align: center; }
.print-receipt-amount span { color: var(--print-brand-muted); font-size: 8pt; }
.print-receipt-amount strong { font-size: 20pt; }
.print-receipt-amount small { color: var(--print-brand-muted); font-size: 8pt; }
.print-receipt-id { color: var(--print-brand-primary); font-family: Arial, sans-serif; font-size: 11pt; font-weight: 800; }

.print-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  border-top: 1px solid var(--print-brand-border);
  padding-top: 9px;
  color: var(--print-brand-muted);
  font-size: 8pt;
}

.print-footer-management { display: grid; gap: 1px; }
.print-footer-management strong { color: var(--print-brand-text); }
.print-signature { min-width: 120px; border-top: 1px solid var(--print-brand-muted); padding-top: 4px; text-align: center; }
.print-loading,
.print-error { padding: 40px; color: #17304f; font-family: Cairo, Tahoma, sans-serif; text-align: center; }

@media (max-width: 700px) {
  body > .print-sheet,
  .print-sheet { width: 100%; padding: 12px; }
  .print-header,
  .print-system-hero,
  .print-section-title,
  .print-footer { align-items: stretch; flex-direction: column; }
  .print-document-meta,
  .print-system-hero-title { text-align: right; }
  .print-info-grid,
  .print-billing-grid,
  .print-system-kpi-grid,
  .print-system-overview-grid,
  .print-system-reference-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .print-system-info-grid,
  .print-system-reference-columns { grid-template-columns: 1fr; }
}

/* END TOP GYM layer */
