/* ============================================================
   Dr. J Membership — Global Stylesheet
   Dark/elegant luxury med-spa theme
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --bg-primary:    #FFFFFF;
  --bg-secondary:  #F8F4F2;
  --bg-card:       #FFFFFF;
  --bg-card-light: #F3EDEB;
  --accent:        #7B1E1E;
  --accent-hover:  #9B2828;
  --accent-light:  rgba(123, 30, 30, 0.08);
  --text-primary:  #1A1A1A;
  --text-secondary:#595959;
  --text-muted:    #8C8C8C;
  --border:        rgba(123, 30, 30, 0.22);
  --border-subtle: rgba(0, 0, 0, 0.09);
  --success:       #2E7D32;
  --danger:        #C62828;
  --warning:       #D84315;
  --info:          #1565C0;

  /* Tier colors */
  --tier-essential: #757575;
  --tier-premier:   #1565C0;
  --tier-elite:     #6A1B9A;
  --tier-executive: #7B1E1E;

  --radius:    12px;
  --radius-sm: 6px;
  --shadow:    0 4px 24px rgba(0,0,0,0.10);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
  --transition: all 0.25s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

img { max-width: 100%; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.75rem); }

.text-gold    { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-sm {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section { padding: 4rem 0; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  padding: 0.75rem 0;
}

.navbar .container { display: flex; align-items: center; justify-content: space-between; position: relative; }

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-logo-icon {
  width: auto;
  height: 61px;
  background: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  flex-shrink: 0;
}

.nav-logo-icon img {
  height: 61px;
  width: auto;
  object-fit: contain;
  border-radius: 0;
}

.nav-brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-brand-text span { color: var(--accent); }

.nav-user-name { color: var(--text-secondary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  background: var(--accent-light);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-user-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #A52828);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #A52828, var(--accent));
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(123, 30, 30, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent-light);
  color: var(--accent-hover);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #c82333; }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #218838; }

.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i { color: var(--accent); }

.card-glow {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow), 0 0 40px rgba(123, 30, 30, 0.04);
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.gold   { background: rgba(123, 30, 30, 0.10); color: var(--accent); }
.stat-icon.blue   { background: rgba(13, 110, 253, 0.15); color: #0d6efd; }
.stat-icon.purple { background: rgba(111, 66, 193, 0.15); color: #6f42c1; }
.stat-icon.green  { background: rgba(40, 167, 69, 0.15);  color: var(--success); }
.stat-icon.red    { background: rgba(220, 53, 69, 0.15);  color: var(--danger); }

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Tier Cards ──────────────────────────────────────────────── */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.tier-card {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.tier-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.tier-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

.tier-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), #A52828);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  white-space: nowrap;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: center;
}

.tier-badge.essential { background: #546E7A; color: #FFFFFF; border: none; letter-spacing: 1px; }
.tier-badge.premier   { background: #1565C0; color: #FFFFFF; border: none; letter-spacing: 1px; }
.tier-badge.elite     { background: #6A1B9A; color: #FFFFFF; border: none; letter-spacing: 1px; }
.tier-badge.executive { background: var(--accent); color: #FFFFFF; border: none; letter-spacing: 1px; }

.tier-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.tier-price .amount {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.tier-price .period {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tier-price .annual-note {
  font-size: 0.75rem;
  background: rgba(40, 167, 69, 0.2);
  color: #5cb85c;
  border: 1px solid rgba(40,167,69,0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  margin-left: 0.25rem;
  font-weight: 600;
}

.tier-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: center;
}

.tier-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
  width: 100%;
  text-align: left;
}

.tier-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tier-features li i {
  color: var(--success);
  margin-top: 0.15rem;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.tier-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 0;
}

.milestone-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.milestone-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.8rem;
}

.milestone-item .month-tag {
  font-size: 0.65rem;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* ── Tier bar chart ──────────────────────────────────────────── */
.tier-chart { display: flex; flex-direction: column; gap: 1rem; }

.tier-bar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tier-bar-label {
  width: 90px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tier-bar-track {
  flex: 1;
  height: 10px;
  background: var(--bg-card-light);
  border-radius: 99px;
  overflow: hidden;
}

.tier-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s ease;
  min-width: 4px;
}

.tier-bar-fill.essential { background: var(--tier-essential); }
.tier-bar-fill.premier   { background: var(--tier-premier); }
.tier-bar-fill.elite     { background: var(--tier-elite); }
.tier-bar-fill.executive { background: var(--tier-executive); }

.tier-bar-count {
  width: 30px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  background: var(--bg-card-light);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 0.65rem 0.875rem;
  transition: var(--transition);
  width: 100%;
  font-family: inherit;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.1);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2378909c' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── Billing Toggle ──────────────────────────────────────────── */
.billing-toggle {
  display: flex;
  background: var(--bg-card-light);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
  gap: 0.25rem;
}

.billing-toggle .toggle-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
}

.billing-toggle .toggle-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.billing-toggle .toggle-btn .savings-badge {
  font-size: 0.65rem;
  background: rgba(46,125,50,0.15);
  color: var(--success);
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-left: 0;
}

.billing-toggle .toggle-btn.active .savings-badge {
  background: rgba(255,255,255,0.25);
  color: #FFFFFF;
}

/* ── Stripe card element ─────────────────────────────────────── */
.stripe-element-wrapper {
  background: var(--bg-card-light);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.875rem;
  transition: var(--transition);
}

.stripe-element-wrapper.focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.1);
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--bg-secondary);
}

thead th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: rgba(255,255,255,0.02); }

tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: rgba(212,160,23,0.05); }
tbody tr.selected { background: rgba(212,160,23,0.08) !important; }

td {
  padding: 0.875rem 1rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

td strong { color: var(--text-primary); }

.td-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-essential { background: #546E7A; color: #FFFFFF; border: none; }
.badge-premier   { background: #1565C0; color: #FFFFFF; border: none; }
.badge-elite     { background: #6A1B9A; color: #FFFFFF; border: none; }
.badge-executive { background: var(--accent); color: #FFFFFF; border: none; }

.badge-active    { background: rgba(40,167,69,0.2);  color: #5cb85c; border: 1px solid rgba(40,167,69,0.3); }
.badge-paused    { background: rgba(255,193,7,0.2);  color: #ffc107; border: 1px solid rgba(255,193,7,0.3); }
.badge-cancelled { background: rgba(220,53,69,0.2);  color: #dc3545; border: 1px solid rgba(220,53,69,0.3); }

.badge-success   { background: rgba(40,167,69,0.2);  color: #5cb85c; }
.badge-info      { background: rgba(23,162,184,0.2); color: #17a2b8; }
.badge-warning   { background: rgba(255,193,7,0.2);  color: #ffc107; }
.badge-danger    { background: rgba(220,53,69,0.2);  color: #dc3545; }
.badge-secondary { background: rgba(108,117,125,0.2);color: #adb5bd; }

.badge-monthly { background: rgba(23,162,184,0.15); color: #17a2b8; }
.badge-annual  { background: rgba(40,167,69,0.15);  color: #5cb85c; }

.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

/* ── Progress Bar ────────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-card-light);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #A52828);
  border-radius: 99px;
  transition: width 0.6s ease;
}

/* ── Milestones Timeline ─────────────────────────────────────── */
.milestones-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.milestone-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
}

.milestone-row:not(:last-child) .milestone-line {
  position: absolute;
  left: 15px;
  top: 32px;
  width: 2px;
  height: calc(100% + 0.25rem);
  background: var(--border-subtle);
}

.milestone-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.milestone-icon.claimed    { background: rgba(40,167,69,0.2); color: var(--success); border: 2px solid var(--success); }
.milestone-icon.available  { background: var(--accent-light); color: var(--accent); border: 2px solid var(--accent); }
.milestone-icon.locked     { background: var(--bg-card-light); color: var(--text-muted); border: 2px dashed var(--border-subtle); }

.milestone-content {
  flex: 1;
  padding-bottom: 1.5rem;
}

.milestone-month {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.milestone-perk {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
}

.milestone-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.milestone-status.claimed-text    { color: var(--success); }
.milestone-status.available-text  { color: var(--accent); }

/* ── Points display ──────────────────────────────────────────── */
.points-display {
  text-align: center;
  padding: 1rem 0;
}

.points-value {
  font-size: 4rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.points-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-top: 0.25rem;
}

.points-dollar {
  font-size: 1.2rem;
  color: var(--success);
  font-weight: 700;
  margin-top: 0.5rem;
}

/* ── Referral box ────────────────────────────────────────────── */
.referral-link-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}

.referral-link-box .link-text {
  flex: 1;
  font-size: 0.8rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-lg { max-width: 800px; }

.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

.modal-close:hover { background: var(--bg-card-light); color: var(--text-primary); }

.modal-body { padding: 1.5rem; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ── Admin Sidebar Layout ────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 500;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

.sidebar-header .nav-brand {
  position: static;
  transform: none;
}

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

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem 0.35rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-light);
  border-left-color: var(--accent);
}

.sidebar-link i { width: 16px; text-align: center; font-size: 0.9rem; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.main-content {
  margin-left: 240px;
  flex: 1;
  min-width: 0;
}

.page-header {
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.page-body { padding: 2rem; }

/* ── Tab System ──────────────────────────────────────────────── */
.tab-section { display: none; }
.tab-section.active { display: block; }

/* ── Search / Filter Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrapper i {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-input-wrapper .form-control {
  padding-left: 2.25rem;
}

/* ── Member Detail Panel ─────────────────────────────────────── */
.detail-panel {
  position: fixed;
  right: -480px;
  top: 0;
  width: 480px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 600;
  overflow-y: auto;
  transition: right 0.3s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}

.detail-panel.open { right: 0; }

.detail-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.detail-panel-body { padding: 1.5rem; }

.panel-section {
  margin-bottom: 1.5rem;
}

.panel-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.member-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.meta-item {}
.meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.meta-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: toast-in 0.3s ease;
  min-width: 280px;
  max-width: 400px;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 4px solid;
  backdrop-filter: blur(12px);
}

.toast.success { background: rgba(255,255,255,0.98); border-color: var(--success); color: var(--text-primary); }
.toast.error   { background: rgba(255,255,255,0.98); border-color: var(--danger);  color: var(--text-primary); }
.toast.warning { background: rgba(255,255,255,0.98); border-color: var(--warning); color: var(--text-primary); }
.toast.info    { background: rgba(255,255,255,0.98); border-color: var(--info);    color: var(--text-primary); }

.toast i { font-size: 1rem; flex-shrink: 0; }
.toast.success i { color: var(--success); }
.toast.error   i { color: var(--danger); }
.toast.warning i { color: var(--warning); }
.toast.info    i { color: var(--info); }

.toast-message { flex: 1; }
.toast-close   { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; padding: 0; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(4px);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
  border-color: rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ── Hero Section ────────────────────────────────────────────── */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(123,30,30,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(212,160,23,0.3);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  margin-bottom: 1.5rem;
}

.hero-headline {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-headline span {
  background: linear-gradient(135deg, var(--accent), #B52B2B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtext {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.trust-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.trust-item i { color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 4rem;
}

/* ── Login Page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 2rem 1rem;
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(123,30,30,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-circle {
  width: 96px;
  height: 96px;
  background: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  overflow: visible;
  box-shadow: none;
}

.login-logo .logo-circle img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 0;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
  color: var(--accent);
}

.empty-state p { font-size: 0.9rem; margin-top: 0.5rem; }

/* ── Dashboard grid ──────────────────────────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

/* ── Info Row ────────────────────────────────────────────────── */
.info-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.info-row .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
}

.info-row .value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Two-col layout ──────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ── Scrollable mini table ───────────────────────────────────── */
.mini-table-wrapper {
  max-height: 320px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
}

/* ── Manager page ────────────────────────────────────────────── */
.member-result-card {
  background: var(--bg-card-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
}

.member-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.member-name-large {
  font-size: 1.2rem;
  font-weight: 700;
}

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .tier-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .detail-panel { width: 100%; right: -100%; }
}

@media (max-width: 768px) {
  .tier-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-body { padding: 1.25rem; }
}

@media (max-width: 480px) {
  .tier-grid { grid-template-columns: 1fr; }
  .dashboard-stats { grid-template-columns: 1fr; }
  .trust-bar { gap: 1rem; flex-direction: column; }
  .hero { padding: 4rem 0 3rem; }
  .modal { max-width: calc(100vw - 2rem); }
  .login-card { padding: 1.75rem 1.25rem; }
}

/* ── Utilities ───────────────────────────────────────────────── */
.hidden  { display: none !important; }
.visible { display: block !important; }
.w-100   { width: 100%; }
.fw-bold { font-weight: 700; }
.fs-sm   { font-size: 0.8rem; }
.fs-xs   { font-size: 0.7rem; }
.rounded { border-radius: var(--radius); }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.cursor-pointer { cursor: pointer; }
.opacity-60 { opacity: 0.6; }

.positive { color: var(--success) !important; }
.negative { color: var(--danger) !important; }

.gold-text {
  background: linear-gradient(135deg, var(--accent), #B52B2B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
