/* Elite Fitness Member Portal — shared styles */

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

:root {
  --color-primary-dark:    #1A1A2E;
  --color-primary-accent:  #72c0ae;
  --color-secondary-accent:#16213E;
  --color-bg-light:        #F8F9FA;
  --color-white:           #FFFFFF;
  --color-body-text:       #333333;
  --color-muted:           #6C757D;
  --color-border:          #DEE2E6;
  --color-success:         #28A745;
  --color-warning:         #FFC107;
  --color-error:           #DC3545;
  --color-accent-hover:    #5ca591;
  --color-accent-light:    rgba(114, 192, 174, 0.14);
  --color-accent-glow:     rgba(114, 192, 174, 0.35);
  --color-overlay-dark:    rgba(26, 26, 46, 0.75);

  --gradient-accent: linear-gradient(135deg, #72c0ae 0%, #8ed1c1 100%);
  --gradient-dark:   linear-gradient(135deg, #1A1A2E 0%, #16213E 100%);

  --font-heading: 'Montserrat', sans-serif;
  --font-body:    'Open Sans', sans-serif;

  --space-1: 0.25rem;  --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem;     --space-10: 2.5rem; --space-12: 3rem;

  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px;
  --radius-xl: 16px; --radius-2xl: 24px;

  --text-sm: 0.875rem; --text-base: 1rem; --text-md: 1.125rem;
  --text-lg: 1.25rem; --text-xl: 1.5rem; --text-2xl: 2rem;

  --shadow-sm:  0 1px 2px rgba(26,26,46,0.06);
  --shadow-md:  0 4px 16px rgba(26,26,46,0.08);
  --shadow-lg:  0 10px 32px rgba(26,26,46,0.12);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body { min-height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--color-body-text);
  background: var(--color-bg-light);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

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

a { color: var(--color-primary-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--color-primary-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ────────────────────────────────────────────
   Auth pages — centered card on dim gradient
   ──────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  background: var(--color-bg-light);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(114,192,174,0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(22,33,62,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 95%, rgba(26,26,46,0.05) 0%, transparent 55%);
  background-attachment: fixed;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--color-white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-10) var(--space-8);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gradient-accent);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-6);
}
.auth-logo img { height: 48px; width: auto; }

.auth-card h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}
.auth-card .auth-subtitle {
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-8);
}

/* Form elements */

.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary-dark);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--color-body-text);
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--color-primary-accent);
  box-shadow: 0 0 0 4px var(--color-accent-light);
}
.form-input::placeholder { color: #adb5bd; }

.form-hint {
  display: block;
  margin-top: var(--space-2);
  font-size: 0.8rem;
  color: var(--color-muted);
}

.form-input-wrap { position: relative; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
}
.password-toggle:hover { color: var(--color-primary-accent); }
.password-toggle svg { width: 20px; height: 20px; }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.85rem 1.25rem;
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s, opacity 0.2s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  background: var(--gradient-accent);
  color: var(--color-white);
  box-shadow: 0 4px 14px rgba(114,192,174,0.25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px var(--color-accent-glow);
  text-decoration: none;
  color: var(--color-white);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-secondary {
  background: var(--color-white);
  color: var(--color-primary-dark);
  border: 1.5px solid var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-primary-accent);
  color: var(--color-primary-accent);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary-accent);
  padding: 0.5rem 0.75rem;
}
.btn-ghost:hover { background: var(--color-accent-light); text-decoration: none; }

.btn-block { width: 100%; display: flex; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Banner alerts (inline, above form) */

.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.banner[hidden] { display: none; }
.banner svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.banner-error {
  background: rgba(220, 53, 69, 0.08);
  color: var(--color-error);
  border: 1px solid rgba(220, 53, 69, 0.2);
}
.banner-success {
  background: rgba(40, 167, 69, 0.08);
  color: var(--color-success);
  border: 1px solid rgba(40, 167, 69, 0.2);
}
.banner-info {
  background: var(--color-accent-light);
  color: var(--color-accent-hover);
  border: 1px solid rgba(114, 192, 174, 0.3);
}

.auth-meta {
  margin-top: var(--space-6);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.auth-meta a { font-weight: 600; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-5);
  color: var(--color-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.forgot-link {
  display: block;
  text-align: right;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ────────────────────────────────────────────
   Portal header (logged-in pages)
   ──────────────────────────────────────────── */

.portal-header {
  background: var(--gradient-dark);
  color: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.portal-header::after {
  content: '';
  display: block;
  height: 3px;
  background: var(--gradient-accent);
}

.portal-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.portal-header-logo {
  display: inline-flex;
  align-items: center;
}
.portal-header-logo img { height: 38px; width: auto; }

.portal-header-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.portal-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-primary-accent);
  color: var(--color-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
}

.portal-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-white);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signout-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 0.85rem;
  background: rgba(255,255,255,0.08);
  color: var(--color-white);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.signout-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.3);
  color: var(--color-white);
  text-decoration: none;
}
.signout-btn svg { width: 16px; height: 16px; }

@media (max-width: 640px) {
  .portal-user-name { display: none; }
  .signout-btn .signout-label { display: none; }
  .signout-btn { padding: 0.5rem; }
}

/* ────────────────────────────────────────────
   Dashboard
   ──────────────────────────────────────────── */

.portal-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
}

.dash-greeting {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.dash-greeting h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.dash-subtitle {
  color: var(--color-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-8);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-family: var(--font-heading);
}
.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active   { background: rgba(40,167,69,0.12);  color: var(--color-success); }
.badge-past_due { background: rgba(255,193,7,0.18);  color: #b08000; }
.badge-inactive { background: rgba(108,117,125,0.15);color: var(--color-muted); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-10);
}
@media (min-width: 768px) {
  .dash-grid { grid-template-columns: repeat(3, 1fr); }
}

.dash-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(114,192,174,0.4);
}

.dash-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-accent-light);
  color: var(--color-primary-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.dash-card-icon svg { width: 22px; height: 22px; }

.dash-card h2 {
  font-size: var(--text-md);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.dash-card p {
  color: var(--color-muted);
  font-size: var(--text-sm);
  flex: 1;
}

.dash-card-tag {
  margin-top: var(--space-4);
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--color-bg-light);
  color: var(--color-muted);
  border-radius: 999px;
}

/* Account info */

.account-section {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.account-section h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
}
.account-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  align-items: center;
}
.account-row:last-child { border-bottom: none; }
.account-row dt { color: var(--color-muted); font-weight: 600; }
.account-row dd { color: var(--color-body-text); word-break: break-word; }
@media (max-width: 540px) {
  .account-row { grid-template-columns: 1fr; gap: 4px; }
}

/* Footer */

.portal-footer {
  margin-top: var(--space-12);
  padding: var(--space-6) var(--space-5);
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.portal-footer a { color: var(--color-muted); text-decoration: underline; }
.portal-footer a:hover { color: var(--color-primary-accent); }

/* ────────────────────────────────────────────
   Toast
   ──────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--color-primary-dark);
  color: var(--color-white);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease-out);
  max-width: 90vw;
}
.toast.dismissing { animation: toast-out 0.2s ease-in forwards; }
.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-error); }
.toast-info    { background: var(--color-primary-dark); }
.toast svg { width: 16px; height: 16px; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translate(-50%, 12px); }
}

/* Skeleton/blocked state for first paint of protected page */
.auth-loading {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}
.auth-loading .spinner {
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary-accent);
  width: 28px;
  height: 28px;
}

/* ────────────────────────────────────────────
   Reusable card / page bits
   ──────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-subtitle {
  color: var(--color-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-8);
}

.card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.card + .card { margin-top: var(--space-5); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.card-header h2 {
  font-size: var(--text-lg);
  font-weight: 700;
}
.card-header .subtle {
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 400;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: minmax(280px, 380px) 1fr;
    align-items: start;
  }
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 600px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
}

/* Photo block */
.photo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
}
.photo-block .photo-frame {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.2rem;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
}
.photo-block .photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-block .name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--color-primary-dark);
}
.photo-block .meta {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* Sub-tabs */
.sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-6);
  padding: 6px;
  background: var(--color-white);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  box-shadow: var(--shadow-sm);
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  padding: 10px 18px;
  color: var(--color-muted);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 10px;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
}
.sub-tab:hover { color: var(--color-primary-dark); background: var(--color-accent-light); }
.sub-tab.active {
  color: #fff;
  background: var(--gradient-accent);
  box-shadow: 0 4px 14px rgba(114,192,174,0.3);
}
.sub-panel { display: none; }
.sub-panel.active {
  display: block;
  animation: panelFadeIn 0.3s var(--ease-out);
}
@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Empty / error / loading states */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-5);
  color: var(--color-muted);
}
.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-primary-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state .empty-icon svg { width: 28px; height: 28px; }
.empty-state h3 {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: var(--space-2);
}
.empty-state p { font-size: var(--text-sm); margin-bottom: var(--space-4); max-width: 36ch; margin-inline: auto; }

.error-state {
  padding: var(--space-6);
  text-align: center;
  background: rgba(220, 53, 69, 0.06);
  border: 1px solid rgba(220, 53, 69, 0.15);
  border-radius: var(--radius-lg);
  color: var(--color-error);
}
.error-state h3 {
  color: var(--color-error);
  font-size: var(--text-md);
  margin-bottom: var(--space-2);
}
.error-state p { font-size: var(--text-sm); margin-bottom: var(--space-3); }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.loading-state .spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary-accent);
}

/* Skeletons */
.skeleton {
  display: block;
  background: linear-gradient(90deg, #eef0f3 0%, #f7f8fa 50%, #eef0f3 100%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s linear infinite;
}
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.short { width: 50%; }
.skeleton-line.tall { height: 22px; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Inline list rows (history, PRs) */
.list-rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-border);
}
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  cursor: pointer;
  width: 100%;
  font: inherit;
  color: inherit;
  transition: background 0.15s;
}
.list-row:hover { background: var(--color-accent-light); }
.list-row .row-main {
  flex: 1;
  min-width: 0;
}
.list-row .row-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-primary-dark);
  margin-bottom: 2px;
}
.list-row .row-meta {
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.list-row .row-stats {
  text-align: right;
  font-size: var(--text-sm);
  color: var(--color-body-text);
  flex-shrink: 0;
}
.list-row .row-stats strong { color: var(--color-primary-dark); }
.list-row .chevron {
  color: var(--color-muted);
  flex-shrink: 0;
}

/* Workout day card */
.day-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow: hidden;
}
.day-card-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background 0.15s;
}
.day-card-head:hover { background: var(--color-accent-light); }
.day-card-head .day-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--color-primary-dark);
}
.day-card-head .day-meta {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: 2px;
}
.day-card-head .arrow {
  color: var(--color-muted);
  transition: transform 0.2s var(--ease-out);
  flex-shrink: 0;
}
.day-card.open .day-card-head .arrow { transform: rotate(180deg); }
.day-card-body {
  display: none;
  padding: 0 var(--space-5) var(--space-5);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
}
.day-card.open .day-card-body { display: block; }

.exercise-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--color-border);
  font-size: var(--text-sm);
}
.exercise-line:last-child { border-bottom: none; }
.exercise-line .ex-name { font-weight: 600; color: var(--color-primary-dark); }
.exercise-line .ex-target { color: var(--color-muted); }

.day-card-body .day-cta {
  margin-top: var(--space-4);
  display: flex;
  justify-content: flex-end;
}

/* PR cards */
.pr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}
.pr-card {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}
.pr-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-accent);
}
.pr-card .pr-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-primary-dark);
  margin-bottom: var(--space-2);
}
.pr-card .pr-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.65rem;
  color: var(--color-primary-accent);
  letter-spacing: -0.01em;
}
.pr-card .pr-date {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--space-2);
}

/* Drawer (slide-in modal for log detail) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.55);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100%);
  background: var(--color-white);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.28s var(--ease-out);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.14);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.drawer-head h2 {
  font-size: var(--text-lg);
  font-weight: 700;
}
.drawer-close {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}
.drawer-close:hover { color: var(--color-primary-dark); background: var(--color-bg-light); }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

/* Exercise group inside drawer */
.exercise-group { margin-bottom: var(--space-5); }
.exercise-group h3 {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--color-primary-dark);
}
.set-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  border-bottom: 1px dashed var(--color-border);
  align-items: baseline;
}
.set-row:last-child { border-bottom: none; }
.set-row .set-label { color: var(--color-muted); font-weight: 600; }

/* Inline button variants */
.btn-sm {
  padding: 0.55rem 0.95rem;
  font-size: var(--text-sm);
}
.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--color-white);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { color: var(--color-primary-accent); border-color: var(--color-primary-accent); }
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon.spinning svg { animation: spin 0.9s linear infinite; }

/* Dashboard card with active link state */
.dash-card.is-link { cursor: pointer; }
.dash-card.is-link:hover { border-color: var(--color-primary-accent); }
.dash-card a.dash-card-link { color: inherit; text-decoration: none; }

.dash-card .preview {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--color-accent-light);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-primary-dark);
  font-weight: 600;
}

/* Photo edit pill button overlaying the avatar */
.photo-edit-btn {
  margin-top: var(--space-2);
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .auth-card { padding: var(--space-8) var(--space-5); border-radius: var(--radius-xl); }
  .auth-card h1 { font-size: 1.6rem; }
  .portal-main { padding: var(--space-6) var(--space-4); }
  .dash-greeting h1 { font-size: 1.55rem; }
  .page-header h1 { font-size: 1.55rem; }
  .pr-card .pr-value { font-size: 1.4rem; }
  .set-row { grid-template-columns: 50px 1fr 1fr; }
  .list-row { padding: var(--space-3) var(--space-1); gap: var(--space-3); }
  .list-row .row-stats { font-size: 0.8rem; }
}

/* ────────────────────────────────────────────
   Dashboard card — unread badge
   ──────────────────────────────────────────── */
.dash-card-icon { position: relative; }
.dash-card-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-error);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(220,53,69,0.35);
}

/* ────────────────────────────────────────────
   Classes page
   ──────────────────────────────────────────── */
.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--color-accent-light);
  color: var(--color-primary-dark);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  border: 1px solid rgba(114,192,174,0.35);
}
.balance-pill strong { color: var(--color-primary-accent); font-size: var(--text-md); }
.balance-pill.is-zero {
  background: rgba(220, 53, 69, 0.08);
  border-color: rgba(220, 53, 69, 0.25);
  color: var(--color-error);
}
.balance-pill.is-zero strong { color: var(--color-error); }

.balance-callout {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: 1.5;
}
.balance-callout a { font-weight: 600; }

/* Legacy range tabs (kept for any other consumer). New classes page uses the calendar below. */
.range-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.range-tab {
  padding: 6px 14px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--color-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.range-tab:hover { color: var(--color-primary-dark); }
.range-tab.active {
  background: var(--gradient-accent);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(114,192,174,0.3);
}

/* Calendar header (month label + nav arrows + today link) */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.calendar-header .cal-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.calendar-header .cal-nav-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  padding: 0;
}
.calendar-header .cal-nav-btn:hover:not(:disabled) {
  color: var(--color-primary-accent);
  border-color: var(--color-primary-accent);
}
.calendar-header .cal-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.calendar-header .cal-nav-btn svg { width: 16px; height: 16px; }
.calendar-header .cal-month-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--color-primary-dark);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}
.calendar-header .cal-month-label:hover { background: var(--color-accent-light); }
.calendar-header .cal-chevron {
  width: 16px;
  height: 16px;
  color: var(--color-muted);
  transition: transform 0.2s var(--ease-out);
}
.calendar-header .cal-month-label[aria-expanded="true"] .cal-chevron { transform: rotate(180deg); }
.calendar-header .cal-today-link {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-primary-accent);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.calendar-header .cal-today-link:hover {
  background: var(--color-accent-light);
  border-color: var(--color-primary-accent);
}

/* Compact week strip (collapsed view) */
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

/* Month grid (expanded view) */
.calendar-grid-wrap {
  animation: calFade 0.18s var(--ease-out);
}
@keyframes calFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cal-grid-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--color-muted);
  text-align: center;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* A single day cell — used in both week strip and month grid */
.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  color: var(--color-primary-dark);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s var(--ease-out);
  min-height: 56px;
}
.cal-cell:hover:not(:disabled):not(.cal-cell--selected) {
  border-color: var(--color-primary-accent);
  background: var(--color-accent-light);
}
.cal-cell:disabled { opacity: 0.3; cursor: not-allowed; }
.cal-cell .cal-dow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--color-muted);
  text-transform: uppercase;
}
.cal-cell .cal-dow-min { display: none; }
.cal-cell .cal-day-num {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
}
.cal-cell .cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  margin-top: 2px;
}
.cal-cell.cal-cell--has-classes .cal-dot { background: var(--color-primary-accent); }
.cal-cell.cal-cell--today { border-color: rgba(114,192,174,0.55); }
.cal-cell.cal-cell--today .cal-day-num { color: var(--color-primary-accent); }
.cal-cell.cal-cell--past { color: var(--color-muted); }
.cal-cell.cal-cell--past .cal-day-num { color: var(--color-muted); }
.cal-cell.cal-cell--other-month { color: #b9bdc4; background: transparent; border-color: transparent; }
.cal-cell.cal-cell--other-month .cal-day-num { color: #b9bdc4; }
.cal-cell.cal-cell--other-month .cal-dot { background: transparent !important; }
.cal-cell.cal-cell--selected {
  background: var(--gradient-accent);
  border-color: transparent;
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(114,192,174,0.32);
}
.cal-cell.cal-cell--selected .cal-dow,
.cal-cell.cal-cell--selected .cal-day-num { color: var(--color-white); }
.cal-cell.cal-cell--selected .cal-dot { background: rgba(255,255,255,0.85); }

/* Month grid cells: tighter (no weekday label inside the cell) */
.calendar-grid .cal-cell {
  min-height: 44px;
  padding: 6px 2px;
}
.calendar-grid .cal-cell .cal-dow,
.calendar-grid .cal-cell .cal-dow-min { display: none; }

/* Past pill + capacity pill + placeholder loading pill */
.signup-pill.is-past {
  background: rgba(108,117,125,0.10);
  color: var(--color-muted);
  border-color: rgba(108,117,125,0.18);
}
.signup-pill.is-loading {
  background: var(--color-bg-light);
  color: var(--color-muted);
  border-color: var(--color-border);
}
.cap-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--color-bg-light);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.cap-pill.is-full {
  background: rgba(220,53,69,0.08);
  color: var(--color-error);
  border-color: rgba(220,53,69,0.2);
}

/* Placeholder rows fade so users know they're not live yet */
.class-row.is-placeholder { opacity: 0.55; }
.class-row.is-placeholder .class-name,
.class-row.is-placeholder .class-meta,
.class-row.is-placeholder .class-time { filter: saturate(0.8); }
.class-row.is-past { opacity: 0.7; }

/* Narrow viewports: collapse weekday abbreviations to single letters */
@media (max-width: 540px) {
  .week-strip { gap: 4px; }
  .week-strip .cal-cell { padding: 6px 2px; min-height: 56px; }
  .week-strip .cal-cell .cal-dow { display: none; }
  .week-strip .cal-cell .cal-dow-min {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--color-muted);
    text-transform: uppercase;
  }
  .week-strip .cal-cell.cal-cell--selected .cal-dow-min { color: var(--color-white); }
  .calendar-grid { gap: 3px; }
  .cal-grid-dow { gap: 3px; }
  .cal-grid-dow > span { font-size: 0.62rem; }
  .calendar-grid .cal-cell { min-height: 38px; padding: 4px 0; }
  .calendar-grid .cal-cell .cal-day-num { font-size: 0.85rem; }
  .calendar-header .cal-month-label { font-size: var(--text-base); padding: 6px 8px; }
  .calendar-header .cal-today-link { padding: 6px 10px; font-size: 0.7rem; }
}

.day-group { margin-bottom: var(--space-6); }
.day-group-head {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-muted);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.class-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.class-row:hover { border-color: rgba(114,192,174,0.4); box-shadow: var(--shadow-sm); }
.class-row.is-mine { border-color: rgba(114,192,174,0.6); background: rgba(114,192,174,0.04); }

.class-time {
  flex-shrink: 0;
  width: 80px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-primary-dark);
}
.class-time .class-time-meridiem {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-left: 2px;
}

.class-info { flex: 1; min-width: 0; }
.class-info .class-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-primary-dark);
  margin-bottom: 2px;
}
.class-info .class-meta {
  font-size: var(--text-sm);
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.class-action { flex-shrink: 0; }

.signup-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--color-accent-light);
  color: var(--color-primary-accent);
  border: 1px solid rgba(114,192,174,0.3);
}
.signup-pill.is-full {
  background: rgba(108,117,125,0.12);
  color: var(--color-muted);
  border-color: rgba(108,117,125,0.2);
}
.signup-pill svg { width: 13px; height: 13px; }

.class-row.is-cancel-row {
  background: var(--color-bg-light);
}
.class-row.is-cancel-row .btn-cancel {
  background: var(--color-white);
  color: var(--color-error);
  border: 1px solid rgba(220, 53, 69, 0.3);
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.class-row.is-cancel-row .btn-cancel:hover {
  background: rgba(220, 53, 69, 0.08);
  border-color: var(--color-error);
}

@media (max-width: 540px) {
  .class-row { flex-wrap: wrap; }
  .class-time { width: auto; font-size: var(--text-sm); }
  .class-action { width: 100%; display: flex; justify-content: flex-end; }
}

/* ────────────────────────────────────────────
   Messages / chat
   ──────────────────────────────────────────── */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 480px;
  max-height: 760px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--color-bg-light);
}

.chat-day-separator {
  align-self: center;
  margin: var(--space-3) 0 var(--space-2);
  padding: 4px 12px;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-muted);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.chat-row {
  display: flex;
  width: 100%;
}
.chat-row.is-out { justify-content: flex-start; }
.chat-row.is-in  { justify-content: flex-end; }

.chat-bubble {
  max-width: min(78%, 520px);
  padding: 10px 14px;
  border-radius: 18px;
  font-size: var(--text-sm);
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
}

.chat-bubble--out {
  background: var(--gradient-accent);
  color: var(--color-white);
  border-bottom-left-radius: 6px;
}
.chat-bubble--in {
  background: var(--color-white);
  color: var(--color-body-text);
  border: 1px solid var(--color-border);
  border-bottom-right-radius: 6px;
}
.chat-bubble--pending {
  opacity: 0.6;
}
.chat-bubble--failed {
  border-color: var(--color-error);
  background: rgba(220, 53, 69, 0.06);
  color: var(--color-error);
  cursor: pointer;
}

.chat-bubble-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.8;
  letter-spacing: 0.2px;
}
.chat-bubble--in .chat-bubble-meta { color: var(--color-muted); }
.chat-bubble--out .chat-bubble-meta { color: rgba(255,255,255,0.85); }

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-sm);
  max-width: 36ch;
  padding: var(--space-6);
}

.chat-composer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  background: var(--color-white);
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
}

.chat-textarea {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--color-border);
  border-radius: 18px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--color-body-text);
  background: var(--color-white);
  max-height: 130px;
  min-height: 42px;
  overflow-y: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-textarea:focus {
  outline: none;
  border-color: var(--color-primary-accent);
  box-shadow: 0 0 0 4px var(--color-accent-light);
}

.chat-send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-accent);
  color: var(--color-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(114,192,174,0.3);
  transition: transform 0.15s var(--ease-out), opacity 0.15s;
}
.chat-send:hover:not(:disabled) { transform: translateY(-1px); }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.chat-send svg { width: 18px; height: 18px; }

.chat-counter {
  font-size: 0.75rem;
  color: var(--color-muted);
  padding: 0 var(--space-4) var(--space-2);
  background: var(--color-white);
  text-align: right;
}
.chat-counter.is-warn { color: var(--color-warning); }
.chat-counter.is-error { color: var(--color-error); }

@media (max-width: 540px) {
  .chat-shell { height: calc(100vh - 180px); border-radius: var(--radius-md); }
  .chat-bubble { max-width: 86%; }
}
