/* ═══════════════════════════════════════════════════════════════
   AST9 ELITE COACHING PLATFORM — DESIGN SYSTEM v2
   Aesthetic: Premium Dark Fitness SaaS · Noir + Electric Lime
   Font: Cabinet Grotesk (display) + Satoshi (body) + JetBrains Mono
═══════════════════════════════════════════════════════════════ */

@import url('https://api.fontshare.com/v2/css?f[]=cabinet-grotesk@800,700,500,400&f[]=satoshi@700,500,400,300&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-void:    #060709;
  --bg-base:    #0b0d12;
  --bg-surface: #10131a;
  --bg-raised:  #161b24;
  --bg-overlay: #1c2230;
  --bg-hover:   rgba(255,255,255,0.025);

  /* Borders */
  --border-subtle: rgba(255,255,255,0.05);
  --border-default: rgba(255,255,255,0.08);
  --border-strong:  rgba(255,255,255,0.14);

  /* Brand */
  --lime:       #c8f04a;
  --lime-dim:   #a8d038;
  --lime-glow:  rgba(200,240,74,0.15);
  --lime-ghost: rgba(200,240,74,0.06);

  /* Semantic accents */
  --teal:       #3df5c1;
  --teal-glow:  rgba(61,245,193,0.12);
  --amber:      #f5c842;
  --amber-glow: rgba(245,200,66,0.12);
  --rose:       #f5426c;
  --rose-glow:  rgba(245,66,108,0.12);
  --blue:       #4290f5;
  --blue-glow:  rgba(66,144,245,0.12);

  /* Text */
  --text-primary:   #f0f2f7;
  --text-secondary: #7a8399;
  --text-tertiary:  #3d4558;
  --text-inverse:   #060709;

  /* Typography */
  --font-display: 'Cabinet Grotesk', 'Syne', sans-serif;
  --font-body:    'Satoshi', 'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Spacing scale */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.6);
  --shadow-xl:   0 24px 80px rgba(0,0,0,0.7);
  --shadow-lime: 0 0 40px rgba(200,240,74,0.12), 0 0 80px rgba(200,240,74,0.06);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 4px 20px rgba(0,0,0,0.4);

  /* Transitions */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:  0.12s;
  --t-base:  0.22s;
  --t-slow:  0.4s;

  /* Sidebar */
  --sidebar-w: 248px;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── SELECTION ───────────────────────────────────────────────── */
::selection { background: rgba(200,240,74,0.2); color: var(--lime); }

/* ── UTILITIES ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }

/* ── GRID LAYOUTS ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY
═══════════════════════════════════════════════════════════════ */
.display-xl {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 0.95;
}
.display-lg {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}
.display-md {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.label-xs {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.label-sm {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.mono { font-family: var(--font-mono); }

/* ═══════════════════════════════════════════════════════════════
   LOADING SCREEN
═══════════════════════════════════════════════════════════════ */
#loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-void);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: var(--sp-5);
}
.loader-logo {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--lime) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: loader-pulse 1.8s ease-in-out infinite;
}
@keyframes loader-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.97); }
}
.loader-bar {
  width: 120px; height: 2px;
  background: var(--border-default);
  border-radius: 1px; overflow: hidden;
}
.loader-bar::after {
  content: '';
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--lime), var(--teal));
  border-radius: 1px;
  animation: loader-sweep 1.4s ease-in-out infinite;
  transform-origin: left;
}
@keyframes loader-sweep {
  0% { width: 0; margin-left: 0; }
  50% { width: 80px; margin-left: 20px; }
  100% { width: 0; margin-left: 120px; }
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════════════ */
#screen-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  background: var(--bg-void);
  position: relative;
  overflow: hidden;
}

/* Animated mesh background */
#screen-login::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 15%, rgba(200,240,74,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 85%, rgba(61,245,193,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(200,240,74,0.03) 0%, transparent 70%);
  animation: bg-shift 12s ease-in-out infinite alternate;
}
@keyframes bg-shift {
  0%   { opacity: 0.7; transform: scale(1) rotate(0deg); }
  100% { opacity: 1;   transform: scale(1.05) rotate(1deg); }
}
/* Dot grid */
#screen-login::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl), var(--shadow-lime);
  overflow: hidden;
  animation: card-in 0.6s var(--ease-out) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-shimmer {
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%, var(--lime) 30%, var(--teal) 70%, transparent 100%);
  animation: shimmer-slide 3s ease-in-out infinite;
  background-size: 200% 100%;
}
@keyframes shimmer-slide {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.login-body { padding: var(--sp-8) var(--sp-8) var(--sp-8); }

.login-wordmark {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 800; letter-spacing: -1px;
  display: inline-flex; align-items: baseline; gap: 2px;
  margin-bottom: var(--sp-1);
}
.login-wordmark .word-ast { color: var(--text-primary); }
.login-wordmark .word-9   {
  color: var(--lime);
  text-shadow: 0 0 20px rgba(200,240,74,0.5);
}
.login-tagline {
  font-size: 11px; font-weight: 500; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-tertiary);
  margin-bottom: var(--sp-8);
}

/* Login tabs */
.login-tab-row {
  display: flex; gap: var(--sp-1);
  background: var(--bg-raised);
  border-radius: var(--r-sm); padding: 3px;
  margin-bottom: var(--sp-6);
}
.login-tab-btn {
  flex: 1; padding: 8px 12px;
  border: none; border-radius: 6px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--text-secondary);
  background: transparent; transition: all var(--t-base) var(--ease-out);
}
.login-tab-btn.active {
  background: var(--bg-overlay);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Error state */
.login-error {
  background: rgba(245,66,108,0.08);
  border: 1px solid rgba(245,66,108,0.2);
  border-radius: var(--r-sm); padding: 12px 14px;
  font-size: 13px; color: var(--rose);
  margin-bottom: var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-2);
}
.login-error::before { content: '⚠'; font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   FORM SYSTEM
═══════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: var(--sp-4); }

.form-label {
  display: block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.form-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-family: var(--font-body); font-size: 14px;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
}
.form-input::placeholder { color: var(--text-tertiary); }
.form-input:hover { border-color: var(--border-strong); background: var(--bg-overlay); }
.form-input:focus {
  border-color: rgba(200,240,74,0.4);
  background: var(--bg-overlay);
  box-shadow: 0 0 0 3px rgba(200,240,74,0.08);
}
.form-input.error { border-color: rgba(245,66,108,0.4); }
.form-input:read-only { opacity: 0.5; cursor: default; }

select.form-input { cursor: pointer; }
select.form-input option { background: var(--bg-overlay); }
textarea.form-input { resize: vertical; min-height: 88px; line-height: 1.6; }

.form-hint  { font-size: 12px; color: var(--text-tertiary); margin-top: var(--sp-1); }
.form-error { font-size: 12px; color: var(--rose); margin-top: var(--sp-1); }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.input-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }

/* ═══════════════════════════════════════════════════════════════
   BUTTON SYSTEM
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 20px;
  border: none; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all var(--t-base) var(--ease-out);
  position: relative; overflow: hidden;
  letter-spacing: 0.2px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Ripple effect */
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--t-fast);
}
.btn:hover::after { background: rgba(255,255,255,0.04); }

/* Variants */
.btn-primary {
  background: var(--lime);
  color: var(--text-inverse);
  box-shadow: 0 2px 12px rgba(200,240,74,0.25);
}
.btn-primary:hover {
  background: #d4f55a;
  box-shadow: 0 4px 20px rgba(200,240,74,0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.btn-ghost:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-teal {
  background: rgba(61,245,193,0.1);
  color: var(--teal);
  border: 1px solid rgba(61,245,193,0.2);
}
.btn-teal:hover {
  background: rgba(61,245,193,0.16);
  box-shadow: 0 0 20px rgba(61,245,193,0.1);
}

.btn-rose {
  background: rgba(245,66,108,0.08);
  color: var(--rose);
  border: 1px solid rgba(245,66,108,0.18);
}
.btn-rose:hover { background: rgba(245,66,108,0.14); }

.btn-amber {
  background: rgba(245,200,66,0.08);
  color: var(--amber);
  border: 1px solid rgba(245,200,66,0.18);
}
.btn-amber:hover { background: rgba(245,200,66,0.14); }

/* Sizes */
.btn-xs  { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-sm  { padding: 7px 14px; font-size: 12px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-xl  {
  padding: 16px 40px; font-size: 16px;
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.3px;
  border-radius: var(--r-md);
}
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 1px solid var(--border-default);
  border-radius: var(--r-sm); color: var(--text-secondary);
  font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-base);
}
.btn-icon:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-hover); }

/* ═══════════════════════════════════════════════════════════════
   BADGE SYSTEM
═══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
}
.badge-dot::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor; display: block;
}

.badge-admin  { background: var(--lime-ghost);  color: var(--lime);  border: 1px solid rgba(200,240,74,0.2); }
.badge-coach  { background: var(--teal-glow);   color: var(--teal);  border: 1px solid rgba(61,245,193,0.2); }
.badge-client { background: var(--blue-glow);   color: var(--blue);  border: 1px solid rgba(66,144,245,0.2); }
.badge-phase1 { background: var(--teal-glow);   color: var(--teal);  border: 1px solid rgba(61,245,193,0.2); }
.badge-phase2 { background: var(--amber-glow);  color: var(--amber); border: 1px solid rgba(245,200,66,0.2); }
.badge-phase3 { background: var(--rose-glow);   color: var(--rose);  border: 1px solid rgba(245,66,108,0.2); }
.badge-active   { background: rgba(61,245,130,0.08); color: #3df582; border: 1px solid rgba(61,245,130,0.2); }
.badge-expired  { background: var(--rose-glow);  color: var(--rose);  border: 1px solid rgba(245,66,108,0.2); }
.badge-pending  { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(245,200,66,0.2); }

/* ═══════════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════════ */
#screen-app {
  display: none;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform var(--t-slow) var(--ease-out);
}

/* Subtle noise texture on sidebar */
.sidebar::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5; pointer-events: none;
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.sidebar-wordmark {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800; letter-spacing: -0.8px;
  line-height: 1;
}
.sidebar-wordmark .w-ast { color: var(--text-primary); }
.sidebar-wordmark .w-9   { color: var(--lime); text-shadow: 0 0 16px rgba(200,240,74,0.4); }
.sidebar-sub {
  font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--text-tertiary); margin-top: 4px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }

.nav-section {
  padding: 14px 16px 6px;
  font-size: 9px; font-weight: 700; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--text-tertiary);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 1px 8px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
  position: relative; border: 1px solid transparent;
}
.nav-item-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; opacity: 0.7;
  transition: opacity var(--t-base);
}
.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}
.nav-item:hover .nav-item-icon { opacity: 1; }
.nav-item.active {
  color: var(--lime);
  background: var(--lime-ghost);
  border-color: rgba(200,240,74,0.12);
}
.nav-item.active .nav-item-icon { opacity: 1; }
.nav-item.active::before {
  content: '';
  position: absolute; left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--lime);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(200,240,74,0.5);
}
.nav-badge {
  margin-left: auto;
  background: var(--rose); color: white;
  border-radius: var(--r-full); font-size: 10px; font-weight: 700;
  padding: 1px 6px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: var(--sp-3) var(--sp-3);
  border-top: 1px solid var(--border-subtle);
}
.user-card {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px 12px;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); cursor: default;
  transition: border-color var(--t-base);
}
.user-card:hover { border-color: var(--border-default); }
.user-avatar-ring {
  width: 32px; height: 32px; border-radius: 50%;
  background: conic-gradient(from 180deg, var(--lime) 0%, var(--teal) 60%, var(--lime) 100%);
  padding: 2px; flex-shrink: 0;
}
.user-avatar {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--bg-overlay);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--lime);
}
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.user-role-tag { font-size: 10px; color: var(--text-tertiary); margin-top: 1px; }
.logout-icon {
  color: var(--text-tertiary); font-size: 14px; cursor: pointer;
  padding: 4px; border-radius: 4px;
  transition: color var(--t-base);
}
.logout-icon:hover { color: var(--rose); }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: var(--sp-8) var(--sp-8);
  position: relative;
}

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--sp-6); gap: var(--sp-4);
}
.page-header-left {}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 800; letter-spacing: -1px;
  color: var(--text-primary); line-height: 1;
}
.page-title .accent { color: var(--lime); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.page-actions { display: flex; gap: var(--sp-2); align-items: flex-start; flex-shrink: 0; }

/* ── SECTIONS ────────────────────────────────────────────────── */
.section { display: none; animation: section-in 0.3s var(--ease-out) both; }
.section.active { display: block; }
@keyframes section-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   CARD SYSTEM
═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: border-color var(--t-base);
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
.card-hover:hover { border-color: var(--border-default); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4); padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}
.card-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--text-primary); letter-spacing: -0.3px;
}

/* Accent top-line on cards */
.card-accent-lime::after  { content: ''; position: absolute; top: 0; left: 20px; right: 20px; height: 1px; background: linear-gradient(90deg, transparent, var(--lime), transparent); opacity: 0.5; }
.card-accent-teal::after  { content: ''; position: absolute; top: 0; left: 20px; right: 20px; height: 1px; background: linear-gradient(90deg, transparent, var(--teal), transparent); opacity: 0.5; }
.card-accent-amber::after { content: ''; position: absolute; top: 0; left: 20px; right: 20px; height: 1px; background: linear-gradient(90deg, transparent, var(--amber), transparent); opacity: 0.5; }
.card-accent-rose::after  { content: ''; position: absolute; top: 0; left: 20px; right: 20px; height: 1px; background: linear-gradient(90deg, transparent, var(--rose), transparent); opacity: 0.5; }

/* ═══════════════════════════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════════════════════════ */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--t-base) var(--ease-out), border-color var(--t-base);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-default); }

.stat-card-bg {
  position: absolute; right: -10px; bottom: -10px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  background: var(--stat-color, var(--lime));
  filter: blur(20px);
}
.stat-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-bottom: var(--sp-4);
  background: var(--stat-color-ghost, var(--lime-ghost));
  border: 1px solid var(--stat-color-border, rgba(200,240,74,0.15));
}
.stat-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-tertiary);
  margin-bottom: var(--sp-2);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 40px; font-weight: 800; letter-spacing: -2px;
  color: var(--text-primary); line-height: 1;
}
.stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: var(--sp-1); }
.stat-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; margin-top: var(--sp-2);
}
.stat-trend.up   { color: var(--teal); }
.stat-trend.down { color: var(--rose); }

/* ═══════════════════════════════════════════════════════════════
   IN-PAGE TABS
═══════════════════════════════════════════════════════════════ */
.tab-row {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-6);
}
.tab-btn {
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; border: none;
  background: transparent; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all var(--t-base);
  font-family: var(--font-body);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--lime); border-bottom-color: var(--lime); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: section-in 0.25s var(--ease-out) both; }

/* ═══════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-tertiary);
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--t-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 13px 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody td:first-child { color: var(--text-primary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════
   CLIENT / USER ROWS
═══════════════════════════════════════════════════════════════ */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: conic-gradient(from 180deg, var(--lime) 0%, var(--teal) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  color: var(--text-inverse); flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 17px; }

.client-row-name { display: flex; align-items: center; gap: 10px; }
.client-row-info {}
.client-row-info .name { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.client-row-info .sub  { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BAR
═══════════════════════════════════════════════════════════════ */
.progress-bar {
  height: 4px; border-radius: 2px;
  background: var(--border-default); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--teal), var(--lime));
  transition: width 0.6s var(--ease-out);
}
.progress-fill.danger { background: linear-gradient(90deg, var(--rose), var(--amber)); }

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATES
═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px; text-align: center; color: var(--text-secondary);
}
.empty-icon {
  font-size: 36px; margin-bottom: var(--sp-4);
  opacity: 0.3; filter: grayscale(0.5);
}
.empty-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text-secondary); margin-bottom: var(--sp-2); }
.empty-desc  { font-size: 13px; color: var(--text-tertiary); max-width: 320px; margin: 0 auto var(--sp-5); line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════
   ASSESSMENT SECTION LAYOUT
═══════════════════════════════════════════════════════════════ */
.assess-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.assess-section-head {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--lime);
  padding-bottom: 10px; margin-bottom: var(--sp-3);
  border-bottom: 1px solid rgba(200,240,74,0.12);
  display: flex; align-items: center; gap: var(--sp-2);
}

/* ═══════════════════════════════════════════════════════════════
   MODAL SYSTEM
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(6,7,9,0.8);
  backdrop-filter: blur(8px) saturate(0.8);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.28s var(--ease-out) both;
  max-height: 90vh; overflow-y: auto;
  position: relative;
}
.modal::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--lime), var(--teal));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-lg { max-width: 680px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(-16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; letter-spacing: -0.3px;
}
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; gap: var(--sp-2); justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6);
  z-index: 9999; display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  font-size: 13px; max-width: 320px;
  animation: toast-in 0.3s var(--ease-spring) both;
  pointer-events: all;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-leaving {
  animation: toast-out 0.25s var(--ease-out) both;
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(24px); }
}

.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast-msg  { flex: 1; color: var(--text-primary); line-height: 1.4; }

.toast.success { border-color: rgba(61,245,193,0.25); }
.toast.success .toast-icon { color: var(--teal); }
.toast.error   { border-color: rgba(245,66,108,0.25); }
.toast.error   .toast-icon { color: var(--rose); }
.toast.info    { border-color: rgba(200,240,74,0.15); }
.toast.info    .toast-icon { color: var(--lime); }
.toast.warning { border-color: rgba(245,200,66,0.25); }
.toast.warning .toast-icon { color: var(--amber); }

/* ═══════════════════════════════════════════════════════════════
   SPINNER
═══════════════════════════════════════════════════════════════ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(200,240,74,0.15);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-sm { width: 12px; height: 12px; border-width: 1.5px; }
.spinner-lg { width: 24px; height: 24px; border-width: 3px; }

/* ═══════════════════════════════════════════════════════════════
   PHASE GUIDE CARDS
═══════════════════════════════════════════════════════════════ */
.phase-guide-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.phase-guide-item:last-child { border-bottom: none; padding-bottom: 0; }

/* ═══════════════════════════════════════════════════════════════
   PROGRAM OUTPUT
═══════════════════════════════════════════════════════════════ */
.program-output {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.9;
  color: var(--text-secondary); white-space: pre-wrap;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: var(--sp-5);
  max-height: 520px; overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════
   SUBSCRIPTION PROGRESS
═══════════════════════════════════════════════════════════════ */
.sub-progress-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-tertiary); margin-bottom: 5px;
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS ROWS
═══════════════════════════════════════════════════════════════ */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border-subtle);
}
.setting-row:last-child { border-bottom: none; }
.setting-label h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.setting-label p  { font-size: 12px; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════════
   DIVIDER
═══════════════════════════════════════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border-subtle); margin: var(--sp-5) 0; }
.divider-text {
  position: relative; text-align: center; margin: var(--sp-4) 0;
}
.divider-text::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--border-subtle);
}
.divider-text span {
  position: relative; background: var(--bg-surface);
  padding: 0 12px; font-size: 12px; color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════════
   GLOW EFFECTS
═══════════════════════════════════════════════════════════════ */
.glow-lime  { box-shadow: 0 0 20px rgba(200,240,74,0.15); }
.glow-teal  { box-shadow: 0 0 20px rgba(61,245,193,0.15); }
.glow-rose  { box-shadow: 0 0 20px rgba(245,66,108,0.15); }
.glow-amber { box-shadow: 0 0 20px rgba(245,200,66,0.15); }

/* ═══════════════════════════════════════════════════════════════
   PHASE UPGRADE BANNER
═══════════════════════════════════════════════════════════════ */
.phase-banner {
  background: linear-gradient(135deg,
    rgba(200,240,74,0.04) 0%,
    rgba(61,245,193,0.03) 100%);
  border: 1px solid rgba(200,240,74,0.12);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  position: relative; overflow: hidden;
}
.phase-banner::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--lime), var(--teal), transparent);
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════════
   EXERCISE LIBRARY
═══════════════════════════════════════════════════════════════ */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-4);
}
.exercise-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  transition: all var(--t-base) var(--ease-out);
  cursor: pointer;
}
.exercise-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ═══════════════════════════════════════════════════════════════
   COMING SOON / YT PLACEHOLDER
═══════════════════════════════════════════════════════════════ */
.coming-soon-banner {
  background: linear-gradient(135deg, rgba(200,240,74,0.03), rgba(61,245,193,0.02));
  border: 1px dashed rgba(200,240,74,0.18);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  text-align: center;
  margin-bottom: var(--sp-5);
}
.coming-soon-icon { font-size: 40px; margin-bottom: var(--sp-4); display: block; opacity: 0.4; }
.coming-soon-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--lime); margin-bottom: var(--sp-2);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-248px);
    width: 248px;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open {
    transform: translateX(0);
    --sidebar-w: 248px;
  }
  .main-content { margin-left: 0; padding: var(--sp-5) var(--sp-4); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .assess-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .input-row, .input-row-3 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   MICRO ANIMATIONS
═══════════════════════════════════════════════════════════════ */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scale-in {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes bounce-in {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

/* Stagger children */
.stagger > * { animation: fade-in-up 0.4s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }

/* ═══════════════════════════════════════════════════════════════
   CELEBRATION / CONFETTI OVERLAY
═══════════════════════════════════════════════════════════════ */
#celebration-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(6,7,9,0.9);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
}
.celebration-card {
  background: var(--bg-surface);
  border: 1px solid rgba(200,240,74,0.2);
  border-radius: var(--r-xl); padding: var(--sp-10) var(--sp-12);
  text-align: center; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-xl), var(--shadow-lime);
  animation: bounce-in 0.6s var(--ease-spring) both;
  position: relative; overflow: hidden;
}
.celebration-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--lime), var(--teal), var(--lime));
  background-size: 200% 100%;
  animation: shimmer-slide 2s linear infinite;
}
.celebration-emoji {
  font-size: 60px; display: block; margin-bottom: var(--sp-4);
  animation: bounce-in 0.8s var(--ease-spring) 0.2s both;
}
.celebration-title {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800; letter-spacing: -1px;
  color: var(--lime); margin-bottom: var(--sp-2);
}
.celebration-msg { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: var(--sp-6); }

#confetti-canvas { position: absolute; inset: 0; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   PHASE 3 — COMMUNITY FEATURES
═══════════════════════════════════════════════════════════════ */

/* Community avatar */
.comm-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(from 180deg, var(--av-color, var(--lime)), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  color: var(--text-inverse);
}

/* Loading placeholder */
.comm-loading { display: flex; align-items: center; justify-content: center; padding: 48px; }

/* Section header row */
.comm-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); }
.comm-section-title  { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }

/* ── Messaging layout ───────────────────────────────────────── */
.comm-msg-layout {
  display: grid; grid-template-columns: 280px 1fr;
  gap: 0; height: calc(100vh - 220px); min-height: 440px;
  border: 1px solid var(--border-subtle); border-radius: var(--r-lg);
  overflow: hidden; background: var(--bg-surface);
}
.comm-conv-list {
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; overflow: hidden;
}
.comm-conv-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border-subtle);
  font-weight: 600; font-size: 13px;
}
.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--t-fast);
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--lime-ghost); }
.conv-item-body { flex: 1; min-width: 0; }
.conv-item-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.conv-item-preview { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.conv-item-time { font-size: 10px; color: var(--text-tertiary); }
.conv-unread-badge {
  background: var(--rose); color: white; border-radius: 9999px;
  font-size: 10px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center;
}

/* Thread panel */
.comm-thread-panel { display: flex; flex-direction: column; overflow: hidden; }
.thread-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-subtle);
}
.thread-partner-name { font-size: 14px; font-weight: 600; }
.thread-messages {
  flex: 1; overflow-y: auto; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg-bubble {
  max-width: 68%; padding: 10px 14px; border-radius: var(--r-md);
  position: relative;
}
.msg-bubble.mine {
  align-self: flex-end;
  background: var(--lime-ghost); border: 1px solid rgba(200,240,74,0.15);
}
.msg-bubble.theirs {
  align-self: flex-start;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
}
.msg-text { font-size: 13px; line-height: 1.5; color: var(--text-primary); }
.msg-time { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; text-align: right; }
.thread-input-row {
  display: flex; gap: 8px; padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
}
.thread-input { resize: none; min-height: unset; }

/* ── Referrals ──────────────────────────────────────────────── */
.referral-card {
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: var(--sp-4);
  margin-bottom: var(--sp-3); transition: border-color var(--t-base);
}
.referral-card:hover { border-color: var(--border-default); }
.referral-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.referral-card-name { font-size: 14px; font-weight: 600; }
.referral-card-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.referral-card-notes { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; padding: 8px 10px; background: var(--bg-overlay); border-radius: 6px; }
.referral-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: var(--text-tertiary); }

/* ── Case shares ────────────────────────────────────────────── */
.case-share-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4); margin-top: var(--sp-4);
}
.case-share-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: var(--sp-4);
  transition: all var(--t-base); cursor: default;
}
.case-share-card:hover { border-color: var(--border-default); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.case-share-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.case-share-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.case-share-meta  { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }
.case-share-desc  { font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 10px; }
.case-share-tags  { display: flex; flex-wrap: wrap; gap: 5px; }
.case-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 9999px;
  background: var(--bg-raised); border: 1px solid var(--border-default);
  color: var(--text-tertiary);
}

/* ── Client posts feed ──────────────────────────────────────── */
.post-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: var(--sp-4);
  margin-bottom: var(--sp-3); transition: border-color var(--t-base);
}
.post-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.post-card-meta { flex: 1; }
.post-author { font-size: 13px; font-weight: 600; }
.post-time   { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.post-content { font-size: 13px; color: var(--text-primary); line-height: 1.6; margin-bottom: 10px; white-space: pre-wrap; word-break: break-word; }
.post-actions { display: flex; gap: 8px; }
.post-type-btn.active { background: var(--lime-ghost); color: var(--lime); border-color: rgba(200,240,74,0.2); }

/* Comments */
.post-comments { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.comment-item  { display: flex; align-items: flex-start; gap: 10px; }
.comment-body  { flex: 1; background: var(--bg-raised); border-radius: var(--r-sm); padding: 8px 12px; }
.comment-author { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.comment-text   { font-size: 12px; color: var(--text-primary); line-height: 1.5; }
.comment-time   { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; }
.comment-input-row { display: flex; gap: 8px; }

/* ── Support groups ─────────────────────────────────────────── */
.support-group-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4); margin-top: var(--sp-4);
}
.support-group-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: var(--sp-4);
  transition: all var(--t-base);
}
.support-group-card:hover { border-color: var(--border-default); transform: translateY(-1px); }
.sg-card-focus { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--teal); margin-bottom: 6px; }
.sg-card-name  { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.sg-card-desc  { font-size: 12px; color: var(--text-tertiary); line-height: 1.5; margin-bottom: 10px; }
.sg-card-footer { display: flex; justify-content: space-between; align-items: center; }
.sg-card-count  { font-size: 12px; color: var(--text-tertiary); }

/* ── Toggle switch ──────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--bg-raised); border: 1px solid var(--border-default);
  position: relative; transition: all var(--t-base);
}
.toggle-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-tertiary); transition: all var(--t-base);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--lime-ghost); border-color: rgba(200,240,74,0.4);
}
.toggle-switch input:checked + .toggle-track::after {
  left: 21px; background: var(--lime);
}

/* ═══════════════════════════════════════════════════════════════
   PHASE 3 — EXERCISE LIBRARY (Enhanced)
═══════════════════════════════════════════════════════════════ */
.ex-filter-bar {
  display: flex; gap: var(--sp-3); align-items: center;
  margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.exercise-grid-ph3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}
.ex-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); overflow: hidden;
  transition: all var(--t-base) var(--ease-out);
}
.ex-card:hover { border-color: var(--border-default); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ex-card-thumb {
  position: relative; cursor: pointer; overflow: hidden;
  height: 140px; background: var(--bg-raised);
}
.ex-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--t-slow); }
.ex-card-thumb:hover img { transform: scale(1.04); }
.ex-card-play-btn {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(6,7,9,0.4); font-size: 20px; color: white;
  opacity: 0; transition: opacity var(--t-base);
}
.ex-card-thumb:hover .ex-card-play-btn { opacity: 1; }
.ex-card-body { padding: var(--sp-4); }
.ex-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; line-height: 1.3; }
.ex-card-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.ex-card-cues { font-size: 11px; color: var(--text-tertiary); line-height: 1.5; margin-bottom: 8px; }
.ex-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.ex-card-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   PHASE 3 — PROGRESS CHARTS
═══════════════════════════════════════════════════════════════ */
.chart-container {
  position: relative; width: 100%;
}
.chart-container.chart-empty::after {
  content: 'No data yet — generate sessions to see charts';
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-tertiary); pointer-events: none;
}

/* Dashboard sparkline widget */
.sparkline-wrap { height: 40px; width: 80px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   PHASE 3 — COMMUNITY SUB-TABS
═══════════════════════════════════════════════════════════════ */
#section-community .tab-row { margin-bottom: var(--sp-4); }

/* ═══════════════════════════════════════════════════════════════
   PHASE 3 — MOBILE RESPONSIVE (Workstream D)
═══════════════════════════════════════════════════════════════ */

/* Hamburger button — shown only on mobile */
.hamburger {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 300;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  background: var(--bg-surface); border: 1px solid var(--border-default);
  align-items: center; justify-content: center; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.hamburger-icon { display: flex; flex-direction: column; gap: 4px; }
.hamburger-icon span { display: block; width: 18px; height: 2px; background: var(--text-secondary); border-radius: 1px; transition: all var(--t-base); }

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 190;
  background: rgba(6,7,9,0.6); backdrop-filter: blur(4px);
}
.sidebar-overlay.visible { display: block; }

/* Bottom tab nav */
.mobile-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--bg-surface); border-top: 1px solid var(--border-subtle);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.mobile-bottom-nav-inner { display: flex; }
.mob-nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; cursor: pointer; border: none; background: transparent;
  color: var(--text-tertiary); font-size: 10px; font-family: var(--font-body);
  transition: color var(--t-base);
}
.mob-nav-btn.active { color: var(--lime); }
.mob-nav-icon { font-size: 18px; line-height: 1; }

@media (max-width: 768px) {
  /* Show hamburger & overlay */
  .hamburger { display: flex; }

  /* Bottom nav visible on mobile */
  .mobile-bottom-nav { display: block; }

  /* Extra bottom padding so content isn't behind bottom nav */
  .main-content { padding-bottom: 80px; padding-top: var(--sp-8); }

  /* Messaging layout stacks vertically */
  .comm-msg-layout { grid-template-columns: 1fr; height: auto; }
  .comm-conv-list { border-right: none; border-bottom: 1px solid var(--border-subtle); max-height: 220px; overflow-y: auto; }
  .comm-thread-panel { height: 400px; }

  /* Case share grid — single column */
  .case-share-grid, .support-group-grid, .exercise-grid-ph3 { grid-template-columns: 1fr; }

  /* Toasts bottom spacing on mobile */
  #toast-container { bottom: 80px; }

  /* Filter bar stacks */
  .ex-filter-bar { flex-direction: column; align-items: stretch; }
  .ex-filter-bar input, .ex-filter-bar select { max-width: 100% !important; width: 100% !important; }
}

@media (max-width: 480px) {
  .comm-msg-layout { min-height: 300px; }
  .thread-messages { padding: 10px 12px; }
  .page-title { font-size: 22px; }
}

/* Touch-friendly: bigger tap targets on mobile */
@media (hover: none) and (pointer: coarse) {
  .nav-item { padding: 12px 16px; }
  .btn-xs   { padding: 8px 12px; font-size: 12px; }
  .conv-item { padding: 14px; }
}

/* Mobile topbar (hamburger + logo, shown only on small screens) */
.mobile-topbar {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 10px var(--sp-4); height: 52px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 180;
}
.mobile-logo {
  font-family: var(--font-display); font-size: 18px; font-weight: 800;
  letter-spacing: -0.5px; color: var(--text-primary);
}
/* Override hamburger position when inside mobile-topbar */
.mobile-topbar .hamburger {
  position: static; display: flex;
  top: auto; left: auto;
  box-shadow: none; background: transparent; border: none;
  width: 36px; height: 36px;
}
.mobile-topbar .hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--text-secondary); border-radius: 1px;
}
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }
  /* Hide the floating fixed hamburger since we have the topbar one */
  .main-content > .hamburger { display: none; }
}

/* ═══════════════════════════════════════════
   NEUCORE — Holographic Design System
   Source palette: reference skeleton image
═══════════════════════════════════════════ */
:root {
  --nc-cyan:       #00D4FF;
  --nc-magenta:    #FF2D78;
  --nc-teal:       #00FFF0;
  --nc-navy:       #050D1A;
  --nc-glass:      rgba(5,13,26,0.88);
  --nc-glass-lt:   rgba(10,22,40,0.75);
  --nc-border:     rgba(0,212,255,0.22);
  --nc-border-hot: rgba(255,45,120,0.45);
  --nc-text:       rgba(200,240,255,0.95);
  --nc-text-dim:   rgba(0,212,255,0.55);
  --nc-text-muted: rgba(0,212,255,0.30);
}

/* Pop panel */
.pop-panel {
  background: var(--nc-glass);
  border: 0.5px solid var(--nc-border);
  border-radius: 10px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0 22px rgba(0,212,255,0.07),
              0 0 1px rgba(0,212,255,0.28) inset;
  color: var(--nc-text);
  font-family: var(--font-sans, system-ui);
}
.pop-panel.pain-severe { border-color: var(--nc-border-hot); }

/* Pain slider */
.pain-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 99px; outline: none;
  background: linear-gradient(to right,
    #00FF88 0%, #FFDD00 40%, #FF6600 60%, #FF2D78 80%, #8B0033 100%);
}
.pain-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: #fff;
  border: 2px solid var(--nc-cyan); cursor: pointer;
  box-shadow: 0 0 8px rgba(0,212,255,0.6);
}

/* Location pills */
.nc-pill {
  font-size: 11px; padding: 3px 9px; border-radius: 99px; cursor: pointer;
  border: 0.5px solid rgba(0,212,255,0.28); background: transparent;
  color: rgba(0,212,255,0.55); transition: all .12s ease;
}
.nc-pill.active, .nc-pill:hover {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.55); color: var(--nc-cyan);
}

/* Toolbar buttons */
.nc-toolbar-btn {
  font-size: 12px; padding: 6px 14px; border-radius: 8px; cursor: pointer;
  border: 0.5px solid rgba(0,212,255,0.28);
  background: rgba(5,13,26,0.85); color: rgba(0,212,255,0.8);
  backdrop-filter: blur(8px); transition: all .12s ease;
}
.nc-toolbar-btn:hover {
  background: rgba(0,212,255,0.1); border-color: rgba(0,212,255,0.55);
  box-shadow: 0 0 10px rgba(0,212,255,0.15);
}
.nc-toolbar-btn--danger { border-color: rgba(255,45,120,0.32); color: rgba(255,45,120,0.8); }
.nc-toolbar-btn--danger:hover {
  background: rgba(255,45,120,0.08); border-color: rgba(255,45,120,0.6); }

/* Labels */
.nc-label {
  font-size: 10px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--nc-text-muted);
}
.nc-divider { border: none; border-top: 0.5px solid rgba(0,212,255,0.1); margin: 10px 0; }

/* ROM gauge */
.rom-gauge__bar {
  flex: 1; height: 5px; background: rgba(0,212,255,0.1);
  border-radius: 99px; overflow: hidden;
}
.rom-gauge__fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(to right, var(--nc-teal), var(--nc-cyan));
  transition: width .45s cubic-bezier(.34,1.56,.64,1);
}

/* Activation chart area */
.activation-chart-wrap canvas {
  border-radius: 6px;
}

/* Gait page grid */
.gait-page {
  color: var(--nc-text);
  font-family: var(--font-sans, system-ui);
}

/* Worst case panel */
#worst-case-panel {
  animation: slideUp .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Sparkline */
.sparkline-svg { display: block; }

/* NeuCore body canvas sidebar */
.neucore-assess-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  align-items: start;
}
.neucore-assess-layout .assess-grid {
  grid-column: 1;
}
#neucore-body-canvas {
  position: sticky;
  top: 16px;
  height: 480px;
  background: rgba(5,13,26,0.85);
  border: 0.5px solid rgba(0,212,255,0.18);
  border-radius: 12px;
  overflow: hidden;
}
#neucore-gait-container {
  background: rgba(5,13,26,0.92);
  border: 0.5px solid rgba(0,212,255,0.18);
  border-radius: 12px;
  overflow: hidden;
  min-height: 600px;
}

/* Print / export */
@media print {
  .nc-toolbar-btn { display: none; }
  #neucore-container { height: 400px; }
  .gait-page { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .neucore-assess-layout { grid-template-columns: 1fr; }
  #neucore-body-canvas { display: none; }
}
