@media (max-width: 768px) {
  /* =========================================================
       1. WRAPPER — aktifkan scroll horizontal
       ========================================================= */
  .fs-diagram-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* padding-top di-set via JS (fixSearchBoxTop) */
  }

  /* =========================================================
       2. SEARCH BOX — tetap fixed di atas
       ========================================================= */
  .fs-search-box {
    position: fixed !important;
    left: 0;
    right: 0;
    z-index: 999;
    background: #fff;
    padding: 10px 12px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* top di-set via JS */
  }

  /* =========================================================
       3. NAV BACK / BREADCRUMB — tetap fixed di bawah search box
       ========================================================= */
  .fs-diagram-nav {
    position: fixed !important;
    left: 0;
    right: 0;
    z-index: 998;
    background: #f5f3ff;
    padding: 6px 12px;
    border-bottom: 1px solid #ede9fe;
    /* top di-set via JS */
  }

  /* =========================================================
       4. TREE LAYOUT — ubah dari horizontal ke vertikal (column)
       ========================================================= */
  .fs-tree-layout {
    flex-direction: column !important;
    align-items: center !important;
    gap: 0 !important;
    /* min-width agar konten bisa di-scroll secara horizontal
           jika jumlah downline sangat banyak */
    min-width: max-content;
    padding: 12px 16px 24px;
  }

  /* =========================================================
       5. ROOT CARD — center di atas
       ========================================================= */
  .fs-root-col {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    min-width: unset !important;
  }

  .fs-root-card {
    width: auto !important;
    min-width: 160px;
    max-width: 220px;
  }

  /* =========================================================
       6. CONNECTOR SVG — horizontal penuh, tinggi tetap 70px
          Garis digambar dari bawah root card ke atas card downline
       ========================================================= */
  .fs-connector-col {
    display: flex !important; /* override display:none dari style lama jika ada */
    width: 100% !important;
    min-width: max-content;
    height: 70px !important;
    align-items: stretch;
    overflow: visible;
  }

  .fs-connector-svg {
    width: 100% !important;
    height: 70px !important;
    display: block;
    overflow: visible;
  }

  /* Warna & stroke garis mobile (sama dengan desktop) */
  .fs-connector-svg line,
  .fs-connector-svg path {
    stroke: #7c3aed;
    stroke-width: 1.8;
    fill: none;
    stroke-dasharray: none;
  }

  .fs-connector-svg circle {
    fill: #7c3aed;
  }

  /* =========================================================
       7. DOWNLINE LIST — row horizontal, scroll jika overflow
       ========================================================= */
  .fs-downline-col {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    padding: 0 16px 8px !important;
    justify-content: flex-start !important;
    /* Lebar minimal mengikuti konten agar scroll bekerja */
    min-width: max-content;
    align-items: flex-start;
  }

  /* =========================================================
       8. CARD DOWNLINE — lebar seragam, tidak terlalu lebar
       ========================================================= */
  .fs-dl-card,
  .fs-dl-card-empty {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    flex-shrink: 0;
  }

  /* Card kosong — pastikan konten center vertikal & horizontal */
  .fs-dl-card-empty {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 10px !important;
  }

  /* Sembunyikan elemen mobile lama yang tidak lagi dipakai */
  .fs-mobile-vline,
  .fs-mobile-node-dot,
  .fs-dl-mobile-wrap {
    display: none !important;
  }

  /* =========================================================
       9. TOMBOL DAFTAR & CLONING — vertikal, center, full width
       ========================================================= */
  .fs-dl-empty-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  .fs-btn-daftar,
  .fs-btn-cloning {
    padding: 5px 8px !important;
    border-radius: 999px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    gap: 4px !important;
    white-space: nowrap !important;
    width: 100% !important;
    justify-content: center !important;
  }

  .fs-btn-daftar span,
  .fs-btn-cloning span {
    display: inline !important;
  }
}

/* ── Header ─────────────────────────────────────────── */
.fs-sponsor-header {
  position: relative;
  background: linear-gradient(135deg, #00d4ff 0%, #7b2ff7 100%);
  border-radius: 14px;
  overflow: hidden;
}

.fs-sponsor-header-glow {
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.fs-sponsor-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}

/* ── Table Card ─────────────────────────────────────── */
.fs-sponsor-card {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 14px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
  overflow: hidden;
}

/* ── Table ──────────────────────────────────────────── */
.fs-sponsor-table {
  color: rgba(255, 255, 255, 0.85);
}

.fs-sponsor-table thead tr {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, 0.15),
    rgba(123, 47, 247, 0.15)
  );
  border-bottom: 1px solid rgba(0, 212, 255, 0.25);
}

.fs-sponsor-table thead th {
  color: #00d4ff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border: none;
  padding: 13px 14px;
  white-space: nowrap;
}

.fs-sponsor-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

.fs-sponsor-table tbody tr:last-child {
  border-bottom: none;
}

.fs-sponsor-table tbody tr:hover {
  background: rgba(0, 212, 255, 0.06);
}

.fs-sponsor-table tbody td {
  border: none;
  padding: 12px 14px;
  vertical-align: middle;
  font-size: 13px;
}

/* ── Nomor urut ─────────────────────────────────────── */
.fs-num {
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px !important;
  width: 36px;
}

/* ── Badge Member ID ────────────────────────────────── */
.fs-badge-id {
  display: inline-block;
  background: rgba(0, 212, 255, 0.12);
  color: #00d4ff;
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ── Avatar inisial ─────────────────────────────────── */
.fs-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #7b2ff7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

/* ── Link WhatsApp ──────────────────────────────────── */
.fs-link-wa {
  color: #25d366;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}

.fs-link-wa:hover {
  color: #1ebe5b;
  text-decoration: underline;
}

/* ── Link TikTok ────────────────────────────────────── */
.fs-link-tiktok {
  color: #ee1d52;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}

.fs-link-tiktok:hover {
  color: #ff3b6a;
  text-decoration: underline;
}

/* ── Nilai kosong ───────────────────────────────────── */
.fs-empty-val {
  color: rgba(255, 255, 255, 0.25);
}

/* ── Empty state ────────────────────────────────────── */
.fs-sponsor-empty {
  text-align: center;
  padding: 52px 20px;
}

.fs-sponsor-empty-icon {
  width: 72px;
  height: 72px;
  margin: auto;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #00d4ff;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 575px) {
  .fs-sponsor-table thead th,
  .fs-sponsor-table tbody td {
    padding: 10px 10px;
  }
}
