/* ============================================================
   ETERNITY PLATFORM — Global Styles
   All values from UI Style Guide. No additions without approval.
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  /* Brand colours */
  --color-green:        #16a34a;
  --color-green-dark:   #15803d;
  --color-gold:         #eab308;
  --color-purple:       #9333ea;
  --color-blue:         #3b82f6;
  --color-red:          #ef4444;
  --color-teal:         #10b981;

  /* Light backgrounds */
  --color-green-light:  #dcfce7;
  --color-green-lightest: #f0fdf4;
  --color-yellow-light: #fef9c3;
  --color-amber-tint:   #fef3c7;

  /* Text */
  --color-text-primary:   #111827;
  --color-text-secondary: #374151;
  --color-text-muted:     #6b7280;
  --color-text-disabled:  #9ca3af;

  /* Borders */
  --color-border:        #e5e7eb;
  --color-border-subtle: #d1d5db;

  /* Backgrounds */
  --color-bg-alt:  #f9fafb;
  --color-bg-base: #ffffff;

  /* Gradients */
  --gradient-primary:  linear-gradient(135deg, #16a34a 0%, #eab308 100%);
  --gradient-vertical: linear-gradient(180deg, #16a34a 0%, #eab308 100%);

  /* Shadows */
  --shadow-card:        0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-card-hover:  0 12px 35px rgba(0, 0, 0, 0.15);
  --shadow-card-large:  0 20px 40px rgba(0, 0, 0, 0.15);
  --shadow-modal:       0 25px 50px rgba(0, 0, 0, 0.3);
  --shadow-green:       0 4px 20px rgba(22, 163, 74, 0.3);
  --shadow-green-strong: 0 8px 30px rgba(22, 163, 74, 0.3);
  --shadow-center-node: 0 0 0 4px #16a34a, 0 20px 60px rgba(22, 163, 74, 0.4);
  --shadow-avatar:      0 4px 15px rgba(22, 163, 74, 0.3);
  --shadow-hero-card:   0 20px 60px rgba(0, 0, 0, 0.1);
}

/* ── Base Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-primary);
  background: var(--color-bg-base);
  -webkit-font-smoothing: antialiased;
}

/* ── Typography Utilities ── */
.text-mono        { font-family: 'Courier New', monospace; }
.text-code        { font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace; }

/* ── Approved Animations ── */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-20px); }
}

@keyframes pulse-center {
  0%, 100% { box-shadow: 0 0 0 4px #16a34a, 0 20px 60px rgba(22, 163, 74, 0.4); }
  50%       { box-shadow: 0 0 0 8px #16a34a, 0 20px 60px rgba(22, 163, 74, 0.4); }
}

@keyframes pulse-active {
  0%, 100% { box-shadow: 0 4px 20px rgba(22, 163, 74, 0.3); }
  50%       { box-shadow: 0 4px 20px rgba(22, 163, 74, 0.5); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInNode {
  from { opacity: 0; transform: translateY(20px) scale(0.8); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── Floating Card Delays ── */
.card-float-1 { animation: float 6s ease-in-out infinite 0s; }
.card-float-2 { animation: float 6s ease-in-out infinite 2s; }
.card-float-3 { animation: float 6s ease-in-out infinite 4s; }

/* ── FadeInNode nth-child delays ── */
.fade-in-node { animation: fadeInNode 0.5s ease-out both; }
.fade-in-node:nth-child(1) { animation-delay: 0.0s; }
.fade-in-node:nth-child(2) { animation-delay: 0.1s; }
.fade-in-node:nth-child(3) { animation-delay: 0.2s; }
.fade-in-node:nth-child(4) { animation-delay: 0.3s; }
.fade-in-node:nth-child(5) { animation-delay: 0.4s; }
.fade-in-node:nth-child(6) { animation-delay: 0.5s; }
.fade-in-node:nth-child(7) { animation-delay: 0.6s; }
.fade-in-node:nth-child(8) { animation-delay: 0.7s; }

/* ── Loading Spinner ── */
.loading {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-green);
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

/* ── Gradient Text (hero headline) ── */
.gradient-text {
  background: var(--gradient-primary);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradientShift 5s ease infinite;
}

/* ── Buttons ── */
.eternity-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--gradient-primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.eternity-btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.eternity-btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.eternity-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-green);
}

.eternity-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--color-green);
  font-weight: 600;
  font-size: 0.9375rem;
  border: 2px solid var(--color-green);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.eternity-btn-secondary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(22, 163, 74, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.eternity-btn-secondary:hover::before {
  width: 300px;
  height: 300px;
}

.eternity-btn-secondary:hover {
  background: var(--color-green);
  color: #ffffff;
  transform: translateY(-2px);
}

.eternity-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-red);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.eternity-btn-danger::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.eternity-btn-danger:hover::before {
  width: 300px;
  height: 300px;
}

.eternity-btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* ── Form Input ── */
.eternity-input {
  width: 100%;
  border: 2px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-bg-base);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.eternity-input:focus {
  border-color: var(--color-green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.eternity-input::placeholder {
  color: var(--color-text-disabled);
}

/* ── Cards ── */
.eternity-card {
  background: var(--color-bg-base);
  border: 2px solid var(--color-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
}

.eternity-card.hover-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-card-large);
}

.eternity-card.card-active {
  background: var(--gradient-primary);
  border-color: var(--color-green);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-green);
}

.eternity-card.card-paid {
  border-color: var(--color-green);
  background: linear-gradient(135deg, var(--color-green-lightest), var(--color-green-light));
}

.eternity-card.card-pending {
  border-color: var(--color-gold);
  background: linear-gradient(135deg, var(--color-yellow-light), var(--color-amber-tint));
}

.eternity-card.card-empty {
  border-color: var(--color-border);
  background: var(--color-bg-alt);
  opacity: 0.6;
}

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active  { background: var(--color-green); color: #ffffff; }
.badge-pending { background: var(--color-amber-tint); color: #854d0e; }
.badge-empty   { background: #f3f4f6; color: var(--color-text-muted); }
.badge-error   { background: #fee2e2; color: #991b1b; }

/* ── Wallet Connected Badge ── */
.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(22, 163, 74, 0.1);
  border: 2px solid var(--color-green);
  border-radius: 9999px;
  font-weight: 600;
  color: var(--color-green);
  font-size: 0.875rem;
}

.wallet-badge::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-teal);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

/* ── Progress Bar ── */
.progress-bar-track {
  height: 8px;
  background: var(--color-border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-green), var(--color-gold));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ── Section Title ── */
.level-title {
  text-align: center;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--color-green-lightest) 0%, var(--color-yellow-light) 100%);
  border-radius: 0.75rem;
  border: 2px solid var(--color-green);
  display: inline-block;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

/* ── Matrix Nodes ── */
.matrix-node {
  background: var(--color-bg-base);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 2px solid var(--color-border);
  min-width: 180px;
  transition: all 0.3s ease;
}

.matrix-node:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.matrix-node.node-active {
  animation: pulse-active 2s ease-in-out infinite;
}

.matrix-node.node-you {
  background: var(--gradient-primary);
  color: #ffffff;
  border-color: var(--color-green);
  box-shadow: var(--shadow-green-strong);
}

.node-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--shadow-green);
  flex-shrink: 0;
}

/* ── Network Nodes ── */
.network-node {
  border-radius: 1rem;
  padding: 1.5rem;
  min-width: 160px;
  border-width: 3px;
  border-style: solid;
  transition: all 0.3s ease;
}

.network-node:hover {
  transform: translateY(-6px) scale(1.05);
}

/* Foundation ring */
.network-node.ring-foundation {
  border-color: var(--color-blue);
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.network-node.ring-foundation .node-avatar {
  background: linear-gradient(135deg, var(--color-blue), #60a5fa);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Direct referrals ring */
.network-node.ring-direct {
  border-color: var(--color-green);
  background: linear-gradient(135deg, var(--color-green-light), #bbf7d0);
}

.network-node.ring-direct .node-avatar {
  background: linear-gradient(135deg, var(--color-green), #22c55e);
  box-shadow: var(--shadow-green);
}

/* Descendants ring */
.network-node.ring-descendants {
  border-color: var(--color-gold);
  background: linear-gradient(135deg, var(--color-yellow-light), #fde68a);
}

.network-node.ring-descendants .node-avatar {
  background: linear-gradient(135deg, var(--color-gold), #facc15);
  box-shadow: 0 4px 15px rgba(234, 179, 8, 0.3);
}

/* ── Center Node ── */
.center-node {
  border-radius: 50%;
  width: 180px;
  height: 180px;
  background: var(--gradient-primary);
  border: 4px solid #ffffff;
  box-shadow: var(--shadow-center-node);
  animation: pulse-center 3s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  text-align: center;
}

/* ── Wallet Modal ── */
.wallet-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wallet-modal-overlay.open {
  opacity: 1;
}

.wallet-modal-panel {
  background: var(--color-bg-base);
  border-radius: 20px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s ease;
}

.wallet-modal-overlay.open .wallet-modal-panel {
  transform: scale(1);
  opacity: 1;
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.wallet-option::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(22, 163, 74, 0.1);
  transition: left 0.3s ease;
}

.wallet-option:hover::after {
  left: 100%;
}

/* ── Referral Code Box ── */
.referral-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-green);
  border-radius: 0.5rem;
  background: var(--color-green-lightest);
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  word-break: break-all;
}

/* ── Error Modal ── */
.error-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.error-modal-panel {
  background: var(--color-bg-base);
  border-radius: 1rem;
  box-shadow: var(--shadow-modal);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

/* ── Utility: Mobile Bottom Sheet ── */
.bottom-sheet {
  border-radius: 20px 20px 0 0;
}

/* ── Utility: Floating Hero Card ── */
.hero-float-card {
  border-radius: 1.5rem;
  box-shadow: var(--shadow-hero-card);
}

/* ================================================================
   MATRIX TREE — Permanent Genealogical View (2026-05-28)
   ================================================================ */

/* Tree section wrapper */
.gtree-card {
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}
.gtree-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.gtree-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

/* Pan canvas — drag to move; nodes stay at constant size.
   Mimics Supabase's dotted-grid project canvas. */
.gtree-canvas {
  position: relative;
  height: 480px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  overflow: hidden;
  cursor: grab;
  background-color: #f9fafb;
  background-image: radial-gradient(circle, #d1d5db 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: 0 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* let pointer events handle pan; disable native scrolling */
}
.gtree-canvas.is-dragging { cursor: grabbing; }
.gtree-canvas-recenter {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 4;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.gtree-canvas-recenter:hover {
  background: var(--color-bg-alt);
  color: var(--color-text-primary);
}
.gtree-inner {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1.5rem 2rem;
  will-change: transform;
  transform-origin: 0 0;
}

/* Binary matrix: nodes are absolutely positioned inside #bm-tree-container */
.bm-node {
  position: absolute !important;
}
@media (max-width: 640px) {
  .gtree-canvas { height: 420px; }
}

/* Levels */
.gtree-level {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
  width: 100%;
}
.gtree-level-l1 { gap: 6rem; margin-top: 0.25rem; }
.gtree-level-l2 { gap: 1rem; margin-top: 0.25rem; }

/* L1 node */
.gtree-l1 {
  width: 104px;
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  background: linear-gradient(135deg, #bfdbfe, #93c5fd);
  border: 2px solid #1e40af;
  color: #1e3a8a;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gtree-l1:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.gtree-l1.empty {
  background: transparent;
  border: 2px dashed #93c5fd;
  color: #1e40af;
  cursor: default;
}
.gtree-l1 .gtree-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px;
  font-weight: 800; font-size: 0.95rem;
}
.gtree-l1.empty .gtree-avatar {
  background: rgba(191, 219, 254, 0.4);
  color: #1e40af;
}
.gtree-l1 .gtree-name { font-size: 0.8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtree-l1 .gtree-meta { font-size: 0.65rem; opacity: 0.8; margin-top: 2px; }
.gtree-l1 .gtree-cta {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--color-blue);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: none;
}
.gtree-l1 .gtree-cta:hover { background: #2563eb; }

/* L2 node */
.gtree-l2 {
  width: 90px;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  background: linear-gradient(135deg, #bbf7d0, #86efac);
  border: 2px solid #166534;
  color: #14532d;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gtree-l2:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.gtree-l2.empty {
  background: transparent;
  border: 2px dashed #86efac;
  color: #166534;
  cursor: default;
}
.gtree-l2 .gtree-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 5px;
  font-weight: 800; font-size: 0.85rem;
}
.gtree-l2.empty .gtree-avatar {
  background: rgba(187, 247, 208, 0.4);
  color: #166534;
}
.gtree-l2 .gtree-name { font-size: 0.75rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtree-l2 .gtree-meta { font-size: 0.6rem; opacity: 0.8; margin-top: 2px; }
.gtree-l2 .gtree-info {
  position: absolute;
  top: 4px; right: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(22, 101, 52, 0.15);
  color: #166534;
  font-size: 0.55rem;
  display: flex; align-items: center; justify-content: center;
  cursor: help;
  font-weight: 800;
}

/* Y-shape connectors */
.gtree-conn-vert {
  width: 2px; height: 22px;
  background: var(--color-border-subtle);
  margin: 0 auto;
}
.gtree-conn-pair {
  display: flex;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  position: relative;
  height: 22px;
}
.gtree-conn-pair::before,
.gtree-conn-pair::after {
  content: '';
  position: absolute;
  top: 0; bottom: 50%;
  width: 50%;
  border-top: 2px solid var(--color-border-subtle);
}
.gtree-conn-pair::before { left: 25%; border-left: 2px solid var(--color-border-subtle); border-right: none; }
.gtree-conn-pair::after  { right: 25%; border-right: 2px solid var(--color-border-subtle); border-left: none; }
.gtree-conn-pair .gtree-conn-stub {
  width: 2px;
  background: var(--color-border-subtle);
  margin-top: 22px;
  height: 0;
}

/* Per-L1 sub-tree wrapper to hold each L1's 2 L2 children */
.gtree-subtree {
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.gtree-subtree .gtree-conn-vert { height: 18px; }
.gtree-subtree .gtree-l2-pair {
  display: flex; gap: 0.75rem;
}

/* Pulse arrow (L2 → YOU) */
@keyframes gtreePulse {
  0%   { opacity: 0; transform: translateY(0); }
  20%  { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-140px); }
}
.gtree-pulse {
  position: absolute;
  top: -8px; left: 50%; margin-left: -8px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0;
  animation: gtreePulse 3s ease-in-out infinite;
}
.gtree-l2:nth-child(1) .gtree-pulse { animation-delay: 0s; }
.gtree-l2:nth-child(2) .gtree-pulse { animation-delay: 0.7s; }
.gtree-l2:nth-child(3) .gtree-pulse { animation-delay: 1.4s; }
.gtree-l2:nth-child(4) .gtree-pulse { animation-delay: 2.1s; }
@media (prefers-reduced-motion: reduce), (max-width: 480px) {
  .gtree-pulse { display: none; }
}

/* "Pays you" caption */
.gtree-pays {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-green-dark);
  background: var(--color-green-light);
  padding: 6px 14px;
  border-radius: 9999px;
  display: inline-block;
}

/* Loading shimmer */
.gtree-shimmer {
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation: gtreeShimmer 1.4s linear infinite;
  border-radius: 12px;
}
@keyframes gtreeShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Side panel */
.gtree-panel-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}
.gtree-panel-backdrop.open { opacity: 1; pointer-events: auto; }

.gtree-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 320px; max-width: 85vw;
  background: var(--color-bg-base);
  box-shadow: var(--shadow-modal);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 61;
  display: flex; flex-direction: column;
}
.gtree-panel.open { transform: translateX(0); }
.gtree-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.gtree-panel-header h3 {
  font-size: 1rem; font-weight: 800; color: var(--color-text-primary);
}
.gtree-panel-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.5rem; line-height: 1;
  color: var(--color-text-muted);
  padding: 0.25rem 0.5rem;
}
.gtree-panel-close:hover { color: var(--color-text-primary); }
.gtree-panel-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}
.gtree-panel-body .panel-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; font-weight: 800;
  margin: 0 auto 1rem;
}
.gtree-panel-body .panel-name {
  text-align: center;
  font-size: 1.125rem; font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}
.gtree-panel-body .panel-status {
  text-align: center;
  margin-bottom: 1.5rem;
}
.gtree-panel-body .panel-row {
  display: flex; justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
}
.gtree-panel-body .panel-row:last-child { border-bottom: none; }
.gtree-panel-body .panel-row .label {
  color: var(--color-text-muted);
  font-weight: 600;
}
.gtree-panel-body .panel-row .value {
  color: var(--color-text-primary);
  font-weight: 700;
}

/* Error state */
.gtree-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted);
}
.gtree-error i { color: var(--color-red); font-size: 1.5rem; margin-bottom: 0.5rem; }
.gtree-error .retry-btn {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--color-green);
  color: white;
  border: none; border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.gtree-error .retry-btn:hover { background: var(--color-green-dark); }
